Skip to content

Commit d3e43d0

Browse files
author
Hovsep
committed
Merge pull request #1749 from dscsolutions/DataCollectionRb2
Add Opt-out for DSC Extension DataCollection
2 parents e85f962 + ff2b6e9 commit d3e43d0

File tree

5 files changed

+78
-1
lines changed

5 files changed

+78
-1
lines changed

src/ResourceManager/Compute/Commands.Compute/Extension/DSC/SetAzureVMDscExtensionCommand.cs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
using Microsoft.WindowsAzure.Storage.Blob;
1111
using System;
1212
using System.Collections;
13+
using System.Collections.Generic;
1314
using System.Globalization;
1415
using System.IO;
1516
using System.Management.Automation;
@@ -207,6 +208,17 @@ public class SetAzureVMDscExtensionCommand : VirtualMachineExtensionBaseCmdlet
207208
[ValidateSetAttribute(new[] { "4.0", "latest", "5.0PP" })]
208209
public string WmfVersion { get; set; }
209210

211+
/// <summary>
212+
/// The Extension Data Collection state
213+
/// </summary>
214+
[Parameter(ValueFromPipelineByPropertyName = true,
215+
HelpMessage = "Enables or Disables Data Collection in the extension. It is enabled if it is not specified. " +
216+
"The value is persisted in the extension between calls.")
217+
]
218+
[ValidateSet("Enable", "Disable")]
219+
[AllowNull]
220+
public string DataCollection { get; set; }
221+
210222
//Private Variables
211223
private const string VersionRegexExpr = @"^(([0-9])\.)\d+$";
212224

@@ -309,6 +321,11 @@ private void CreateConfiguration()
309321

310322
publicSettings.SasToken = configurationUris.SasToken;
311323
publicSettings.ModulesUrl = configurationUris.ModulesUrl;
324+
325+
Hashtable privacySetting = new Hashtable();
326+
privacySetting.Add("DataCollection", DataCollection);
327+
publicSettings.Privacy = privacySetting;
328+
312329
publicSettings.ConfigurationFunction = string.Format(
313330
CultureInfo.InvariantCulture,
314331
"{0}\\{1}",

src/ResourceManager/Compute/Commands.Compute/Microsoft.Azure.Commands.Compute.dll-Help.xml

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14089,6 +14089,13 @@ Set-AzureRmVMDiskEncryptionExtension -ResourceGroupName $rgname -VMName $vmName
1408914089
</maml:description>
1409014090
<command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue>
1409114091
</command:parameter>
14092+
<command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named">
14093+
<maml:name>DataCollection</maml:name>
14094+
<maml:description>
14095+
<maml:para>Enables or Disables Data Collection in the extension. It is enabled if it is not specified. The value is persisted in the extension between calls. Allowed Values are: Enable and Disable</maml:para>
14096+
</maml:description>
14097+
<command:parameterValue required="true" variableLength="false">string</command:parameterValue>
14098+
</command:parameter>
1409214099
</command:syntaxItem>
1409314100
</command:syntax>
1409414101
<command:parameters>
@@ -14287,6 +14294,18 @@ Set-AzureRmVMDiskEncryptionExtension -ResourceGroupName $rgname -VMName $vmName
1428714294
</dev:type>
1428814295
<dev:defaultValue>latest</dev:defaultValue>
1428914296
</command:parameter>
14297+
<command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named">
14298+
<maml:name>DataCollection</maml:name>
14299+
<maml:description>
14300+
<maml:para>Enables or Disables Data Collection in the extension. It is enabled if it is not specified. The value is persisted in the extension between calls. Allowed Values are: Enable and Disable</maml:para>
14301+
</maml:description>
14302+
<command:parameterValue required="true" variableLength="false">string</command:parameterValue>
14303+
<dev:type>
14304+
<maml:name>string</maml:name>
14305+
<maml:uri/>
14306+
</dev:type>
14307+
<dev:defaultValue></dev:defaultValue>
14308+
</command:parameter>
1429014309
<command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named">
1429114310
<maml:name>InformationAction</maml:name>
1429214311
<maml:description>
@@ -17670,4 +17689,4 @@ PS C:\&gt; $VirtualMachine07 = Set-AzureRmVMSourceImage -VM $VirtualMachine07 -I
1767017689
<maml:relatedLinks>
1767117690
</maml:relatedLinks>
1767217691
</command:command>
17673-
</helpItems>
17692+
</helpItems>

src/ServiceManagement/Compute/Commands.ServiceManagement/IaaS/Extensions/DSC/DscExtensionPublicSettings.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,11 @@ public class Property
9292
/// </summary>
9393
public Property[] Properties { get; set; }
9494

95+
/// <summary>
96+
/// Privacy parameters
97+
/// </summary>
98+
public Hashtable Privacy { get; set; }
99+
95100
/// <summary>
96101
/// Version of the protocol (DscExtensionPublicSettings and DscExtensionPrivateSettings mostly).
97102
/// </summary>

src/ServiceManagement/Compute/Commands.ServiceManagement/IaaS/Extensions/DSC/SetAzureVMDscExtension.cs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
using Microsoft.WindowsAzure.Storage.Blob;
2424
using System;
2525
using System.Collections;
26+
using System.Collections.Generic;
2627
using System.Globalization;
2728
using System.IO;
2829
using System.Management.Automation;
@@ -156,6 +157,17 @@ public class SetAzureVMDscExtension : VirtualMachineExtensionCmdletBase
156157
[ValidateSetAttribute(new[] { "4.0", "latest", "5.0PP" })]
157158
public string WmfVersion { get; set; }
158159

160+
/// <summary>
161+
/// The Extension Data Collection state
162+
/// </summary>
163+
[Parameter(ValueFromPipelineByPropertyName = true,
164+
HelpMessage = "Enables or Disables Data Collection in the extension. It is enabled if it is not specified. " +
165+
"The value is persisted in the extension between calls.")
166+
]
167+
[ValidateSet("Enable", "Disable")]
168+
[AllowNull]
169+
public string DataCollection { get; set; }
170+
159171
/// <summary>
160172
/// Credentials used to access Azure Storage
161173
/// </summary>
@@ -389,6 +401,11 @@ private void CreateConfiguration()
389401

390402
publicSettings.SasToken = configurationUris.SasToken;
391403
publicSettings.ModulesUrl = configurationUris.ModulesUrl;
404+
405+
Hashtable privacySetting = new Hashtable();
406+
privacySetting.Add("DataCollection",DataCollection);
407+
publicSettings.Privacy = privacySetting;
408+
392409
publicSettings.ConfigurationFunction = string.Format(
393410
CultureInfo.InvariantCulture,
394411
"{0}\\{1}",

src/ServiceManagement/Compute/Commands.ServiceManagement/Microsoft.WindowsAzure.Commands.ServiceManagement.dll-Help.xml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36528,6 +36528,13 @@ PS C:\&gt; Update-AzureVM -ServiceName $Service_Name -Name $VM_Name -VM $VM_Upda
3652836528
</maml:description>
3652936529
<command:parameterValue required="true" variableLength="false">IPersistentVM</command:parameterValue>
3653036530
</command:parameter>
36531+
<command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named">
36532+
<maml:name>DataCollection</maml:name>
36533+
<maml:description>
36534+
<maml:para>Enables or Disables Data Collection in the extension. It is enabled if it is not specified. The value is persisted in the extension between calls. Allowed Values are: Enable and Disable</maml:para>
36535+
</maml:description>
36536+
<command:parameterValue required="true" variableLength="false">string</command:parameterValue>
36537+
</command:parameter>
3653136538
<command:parameter required="false" variableLength="true" globbing="false" pipelineInput="false" position="named">
3653236539
<maml:name>Confirm</maml:name>
3653336540
<maml:description>
@@ -36695,6 +36702,18 @@ PS C:\&gt; Update-AzureVM -ServiceName $Service_Name -Name $VM_Name -VM $VM_Upda
3669536702
</dev:type>
3669636703
<dev:defaultValue>none</dev:defaultValue>
3669736704
</command:parameter>
36705+
<command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named">
36706+
<maml:name>DataCollection</maml:name>
36707+
<maml:description>
36708+
<maml:para>Enables or Disables Data Collection in the extension. It is enabled if it is not specified. The value is persisted in the extension between calls. Allowed Values are: Enable and Disable</maml:para>
36709+
</maml:description>
36710+
<command:parameterValue required="true" variableLength="false">string</command:parameterValue>
36711+
<dev:type>
36712+
<maml:name>string</maml:name>
36713+
<maml:uri/>
36714+
</dev:type>
36715+
<dev:defaultValue></dev:defaultValue>
36716+
</command:parameter>
3669836717
<command:parameter required="false" variableLength="true" globbing="false" pipelineInput="false" position="named">
3669936718
<maml:name>Confirm</maml:name>
3670036719
<maml:description>

0 commit comments

Comments
 (0)