Azure DSC Extension Data Collection

PowerShell Team

NOTE: For information on OS support, and other features, please refer to our release history.

Overview

In order to improve the quality of the DSC Extension, the DSC Extension will start automatically sending information to Microsoft containing operational and reliability data about the DSC Extension in a future version of the DSC Extension. While we strongly encourage you to participate in improving the quality of our software, participation is voluntary, so we are adding the ability to disable it through the Azure PowerShell SDK and Azure Resource Manager (ARM) templates. We encourage you to leave this feature enabled.

  1. How to disable DSC Extension Data Collection using the Azure PowerShell SDK
  2. How to disable DSC Extension Data Collection using ARM JSON

Disabling Data Collection using the Azure PowerShell SDK

This option was added in version 1.2 of the Azure PowerShell SDK, previous versions of the SDK do not have a way to disable Data Collection, therefore ensure that you are running that version or a newer one.

Starting with version 2.9 of the extension, you can disable Data Collection, when you call Set-AzureVMDscExtension (see our introduction blog for how to use this) add the parameter -DataCollection with the value Disable. On version 2.9 and higher, the extension will remember this setting for the VM. Using the Data Collection parameter will have no effect if you are using DSC Extension version prior to 2.9. See the examples below:

$vm = Set-AzureVMDSCExtension  -DataCollection Disable -VM $vm -ConfigurationArchive "IISInstall.ps1.zip" -ConfigurationName "IISInstall"

 

If you have never set DataCollection on a VM, the default is Enable.

Disabling Data Collection using ARM JSON

The previous ARM blog, described how to use visual studio to create an ARM Template to disable data collection. The following example starts with the DSC Resource JSON snippet from Git Hub from that blog to demonstrate how to disable Data Collection in the ARM JSON.

{
    "name": "Microsoft.Powershell.DSC",
    "type": "extensions",
    "location": "[variables('location')]",
    "apiVersion": "2015-05-01-preview",
    "dependsOn": [
        "[concat('Microsoft.Compute/virtualMachines/', variables('vmName'))]"
    ],
    "tags": {
        "displayName": "Microsoft.Powershell.DSC"
    },
    "properties": {
        "publisher": "Microsoft.Powershell",
        "type": "DSC",
        "typeHandlerVersion": "2.9",
        "autoUpgradeMinorVersion": true,
        "settings": {
            "modulesUrl": "[concat(parameters('_artifactsLocation'), '/', 'dsc.zip')]",
            "sasToken": "[parameters('_artifactsLocationSasToken')]",
            "wmfVersion": "[parameters('wmfVersion')]",
            "configurationFunction": "[variables('Microsoft.Powershell.DSCConfigurationFunction')]",
            "properties": {
                "nodeName": "[variables('vmName')]"
            }
        },
        "protectedSettings": { }
    }
}

To that we will add the following JSON after modulesUrl.

 "privacy":  {
        "DataCollection": "Disable"
    },

This will result in the following JSON.

{
    "name": "Microsoft.Powershell.DSC",
    "type": "extensions",
    "location": "[variables('location')]",
    "apiVersion": "2015-05-01-preview",
    "dependsOn": [
        "[concat('Microsoft.Compute/virtualMachines/', variables('vmName'))]"
    ],
    "tags": {
        "displayName": "Microsoft.Powershell.DSC"
    },
    "properties": {
        "publisher": "Microsoft.Powershell",
        "type": "DSC",
        "typeHandlerVersion": "2.9",
        "autoUpgradeMinorVersion": true,
        "settings": {
            "modulesUrl": "[concat(parameters('_artifactsLocation'), '/', 'dsc.zip')]",
            "privacy":  {
                "DataCollection": "Disable"
            },
            "sasToken": "[parameters('_artifactsLocationSasToken')]",
            "wmfVersion": "[parameters('wmfVersion')]",
            "configurationFunction": "[variables('Microsoft.Powershell.DSCConfigurationFunction')]",
            "properties": {
                "nodeName": "[variables('vmName')]"
            }
        },
        "protectedSettings": { }
    }
}

In order to deploy this ARM JSON, follow the instruction from the previous blog.

Enabling Data Collection

If you have previously disabled Data Collection, and would like to re-enable it, then remove the existing extension and while re-installing change the value of DataCollection from Disable to Enable. Again, this will follow the same persistence rule for Datacollection on the VM.

Feedback

Please feel free to reach to us posting comments to this post, or by posting feedback on Connect.

Resources

Privacy Statement

End User License Agreement

0 comments

Discussion is closed.

Feedback usabilla icon