{"id":11483,"date":"2016-02-02T17:42:26","date_gmt":"2016-02-03T01:42:26","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/powershell\/?p=11483"},"modified":"2019-03-05T12:04:30","modified_gmt":"2019-03-05T20:04:30","slug":"azure-dsc-extension-data-collection-2","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/powershell\/azure-dsc-extension-data-collection-2\/","title":{"rendered":"Azure DSC Extension Data Collection"},"content":{"rendered":"<div class=\"markdown-body\">\n<p><strong>NOTE: For information on OS support, and other features, please refer to our<\/strong> <a href=\"http:\/\/blogs.msdn.com\/b\/powershell\/archive\/2014\/11\/20\/release-history-for-the-azure-dsc-extension.aspx\"><span style=\"color: #4183c4;\">release history<\/span><\/a>.<\/p>\n<h2>Overview<\/h2>\n<p>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.<\/p>\n<ol>\n<li>How to disable DSC Extension Data Collection using the Azure PowerShell SDK<\/li>\n<li>How to disable DSC Extension Data Collection using ARM JSON<\/li>\n<\/ol>\n<h2>Disabling Data Collection using the Azure PowerShell SDK<\/h2>\n<p>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.<\/p>\n<p>Starting with version 2.9 of the extension, you can disable Data Collection, when you call <code><span style=\"font-family: Consolas;\">Set-AzureVMDscExtension<\/span><\/code> (see our <a href=\"http:\/\/blogs.msdn.com\/b\/powershell\/archive\/2014\/08\/07\/introducing-the-azure-powershell-dsc-desired-state-configuration-extension.aspx\"><span style=\"color: #4183c4;\">introduction blog<\/span><\/a> for how to use this) add the parameter <code><span style=\"font-family: Consolas;\">-DataCollection<\/span><\/code> with the value <code><span style=\"font-family: Consolas;\">Disable<\/span><\/code>. 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:<\/p>\n<div class=\"highlight highlight-source-powershell\">\n<pre class=\"lang:default decode:true \">$vm = Set-AzureVMDSCExtension  -DataCollection Disable -VM $vm -ConfigurationArchive \"IISInstall.ps1.zip\" -ConfigurationName \"IISInstall\"<\/pre>\n<p>&nbsp;<\/p>\n<\/div>\n<p>If you have never set <code><span style=\"font-family: Consolas;\">DataCollection<\/span><\/code> on a VM, the default is <code><span style=\"font-family: Consolas;\">Enable<\/span><\/code>.<\/p>\n<h2>Disabling Data Collection using ARM JSON<\/h2>\n<p>The previous <a href=\"http:\/\/blogs.msdn.com\/b\/powershell\/archive\/2015\/10\/02\/how-to-use-wmf-4-with-azure-dsc-extension-in-azure-resource-manager-arm.aspx\"><span style=\"color: #4183c4;\">ARM blog<\/span><\/a>, 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 <a href=\"https:\/\/github.com\/PowerShell\/PowerShell-Blog-Samples\/tree\/master\/2019-09-30-DSC-Extension-v2.7\/ARM\"><span style=\"color: #4183c4;\">Git Hub<\/span><\/a> from that blog to demonstrate how to disable Data Collection in the ARM JSON.<\/p>\n<div class=\"highlight highlight-source-js\">\n<pre class=\"lang:default decode:true\">{\r\n    \"name\": \"Microsoft.Powershell.DSC\",\r\n    \"type\": \"extensions\",\r\n    \"location\": \"[variables('location')]\",\r\n    \"apiVersion\": \"2015-05-01-preview\",\r\n    \"dependsOn\": [\r\n        \"[concat('Microsoft.Compute\/virtualMachines\/', variables('vmName'))]\"\r\n    ],\r\n    \"tags\": {\r\n        \"displayName\": \"Microsoft.Powershell.DSC\"\r\n    },\r\n    \"properties\": {\r\n        \"publisher\": \"Microsoft.Powershell\",\r\n        \"type\": \"DSC\",\r\n        \"typeHandlerVersion\": \"2.9\",\r\n        \"autoUpgradeMinorVersion\": true,\r\n        \"settings\": {\r\n            \"modulesUrl\": \"[concat(parameters('_artifactsLocation'), '\/', 'dsc.zip')]\",\r\n            \"sasToken\": \"[parameters('_artifactsLocationSasToken')]\",\r\n            \"wmfVersion\": \"[parameters('wmfVersion')]\",\r\n            \"configurationFunction\": \"[variables('Microsoft.Powershell.DSCConfigurationFunction')]\",\r\n            \"properties\": {\r\n                \"nodeName\": \"[variables('vmName')]\"\r\n            }\r\n        },\r\n        \"protectedSettings\": { }\r\n    }\r\n}<\/pre>\n<\/div>\n<p>To that we will add the following JSON after <code><span style=\"font-family: Consolas;\">modulesUrl<\/span><\/code>.<\/p>\n<div class=\"highlight highlight-source-js\">\n<pre class=\"lang:default decode:true\"> \"privacy\":  {\r\n        \"DataCollection\": \"Disable\"\r\n    },<\/pre>\n<\/div>\n<p>This will result in the following JSON.<\/p>\n<div class=\"highlight highlight-source-js\">\n<pre class=\"lang:default decode:true\">{\r\n    \"name\": \"Microsoft.Powershell.DSC\",\r\n    \"type\": \"extensions\",\r\n    \"location\": \"[variables('location')]\",\r\n    \"apiVersion\": \"2015-05-01-preview\",\r\n    \"dependsOn\": [\r\n        \"[concat('Microsoft.Compute\/virtualMachines\/', variables('vmName'))]\"\r\n    ],\r\n    \"tags\": {\r\n        \"displayName\": \"Microsoft.Powershell.DSC\"\r\n    },\r\n    \"properties\": {\r\n        \"publisher\": \"Microsoft.Powershell\",\r\n        \"type\": \"DSC\",\r\n        \"typeHandlerVersion\": \"2.9\",\r\n        \"autoUpgradeMinorVersion\": true,\r\n        \"settings\": {\r\n            \"modulesUrl\": \"[concat(parameters('_artifactsLocation'), '\/', 'dsc.zip')]\",\r\n            \"privacy\":  {\r\n                \"DataCollection\": \"Disable\"\r\n            },\r\n            \"sasToken\": \"[parameters('_artifactsLocationSasToken')]\",\r\n            \"wmfVersion\": \"[parameters('wmfVersion')]\",\r\n            \"configurationFunction\": \"[variables('Microsoft.Powershell.DSCConfigurationFunction')]\",\r\n            \"properties\": {\r\n                \"nodeName\": \"[variables('vmName')]\"\r\n            }\r\n        },\r\n        \"protectedSettings\": { }\r\n    }\r\n}<\/pre>\n<\/div>\n<p>In order to deploy this ARM JSON, follow the instruction from the previous <a href=\"http:\/\/blogs.msdn.com\/b\/powershell\/archive\/2015\/10\/02\/how-to-use-wmf-4-with-azure-dsc-extension-in-azure-resource-manager-arm.aspx\"><span style=\"color: #4183c4;\">blog<\/span><\/a>.<\/p>\n<h2>Enabling Data Collection<\/h2>\n<p>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 <code><span style=\"font-family: Consolas;\">DataCollection<\/span><\/code> from <code><span style=\"font-family: Consolas;\">Disable<\/span><\/code> to <code><span style=\"font-family: Consolas;\">Enable<\/span><\/code>. Again, this will follow the same persistence rule for Datacollection on the VM.<\/p>\n<h2>Feedback<\/h2>\n<p>Please feel free to reach to us posting comments to this post, or by posting feedback on <a href=\"https:\/\/connect.microsoft.com\/PowerShell\/Feedback\"><span style=\"color: #4183c4;\">Connect<\/span><\/a>.<\/p>\n<h2>Resources<\/h2>\n<p><a href=\"http:\/\/azure.microsoft.com\/en-us\/support\/legal\/%0Ahttp:\/\/go.microsoft.com\/fwlink\/p\/?linkid=131004&amp;clcid=0x409\"><span style=\"color: #4183c4;\">Privacy Statement<\/span><\/a><\/p>\n<p><a href=\"http:\/\/azure.microsoft.com\/en-us\/support\/legal\/\"><span style=\"color: #4183c4;\">End User License Agreement<\/span><\/a><\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>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 [&hellip;]<\/p>\n","protected":false},"author":600,"featured_media":13641,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[],"class_list":["post-11483","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-powershell"],"acf":[],"blog_post_summary":"<p>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 [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/posts\/11483","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/users\/600"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/comments?post=11483"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/posts\/11483\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/media\/13641"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/media?parent=11483"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/categories?post=11483"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/tags?post=11483"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}