-
Notifications
You must be signed in to change notification settings - Fork 4k
Add Opt-out for DSC Extension DataCollection #1749
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,7 @@ | |
using Microsoft.WindowsAzure.Storage.Blob; | ||
using System; | ||
using System.Collections; | ||
using System.Collections.Generic; | ||
using System.Globalization; | ||
using System.IO; | ||
using System.Management.Automation; | ||
|
@@ -207,6 +208,17 @@ public class SetAzureVMDscExtensionCommand : VirtualMachineExtensionBaseCmdlet | |
[ValidateSetAttribute(new[] { "4.0", "latest", "5.0PP" })] | ||
public string WmfVersion { get; set; } | ||
|
||
/// <summary> | ||
/// The Extension Data Collection state | ||
/// </summary> | ||
[Parameter(ValueFromPipelineByPropertyName = true, | ||
HelpMessage = "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.") | ||
] | ||
[ValidateSet("Enable", "Disable")] | ||
[AllowNull] | ||
public string DataCollection { get; set; } | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Usually it should be using There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We need three states enable, disable and not specified. a switch parameter does not allow all three states, or possible future states. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OK. Thanks. |
||
|
||
//Private Variables | ||
private const string VersionRegexExpr = @"^(([0-9])\.)\d+$"; | ||
|
||
|
@@ -309,6 +321,11 @@ private void CreateConfiguration() | |
|
||
publicSettings.SasToken = configurationUris.SasToken; | ||
publicSettings.ModulesUrl = configurationUris.ModulesUrl; | ||
|
||
Hashtable privacySetting = new Hashtable(); | ||
privacySetting.Add("DataCollection", DataCollection); | ||
publicSettings.Privacy = privacySetting; | ||
|
||
publicSettings.ConfigurationFunction = string.Format( | ||
CultureInfo.InvariantCulture, | ||
"{0}\\{1}", | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,6 +23,7 @@ | |
using Microsoft.WindowsAzure.Storage.Blob; | ||
using System; | ||
using System.Collections; | ||
using System.Collections.Generic; | ||
using System.Globalization; | ||
using System.IO; | ||
using System.Management.Automation; | ||
|
@@ -156,6 +157,17 @@ public class SetAzureVMDscExtension : VirtualMachineExtensionCmdletBase | |
[ValidateSetAttribute(new[] { "4.0", "latest", "5.0PP" })] | ||
public string WmfVersion { get; set; } | ||
|
||
/// <summary> | ||
/// The Extension Data Collection state | ||
/// </summary> | ||
[Parameter(ValueFromPipelineByPropertyName = true, | ||
HelpMessage = "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.") | ||
] | ||
[ValidateSet("Enable", "Disable")] | ||
[AllowNull] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as my above comment. |
||
public string DataCollection { get; set; } | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Usually it should be using |
||
|
||
/// <summary> | ||
/// Credentials used to access Azure Storage | ||
/// </summary> | ||
|
@@ -389,6 +401,11 @@ private void CreateConfiguration() | |
|
||
publicSettings.SasToken = configurationUris.SasToken; | ||
publicSettings.ModulesUrl = configurationUris.ModulesUrl; | ||
|
||
Hashtable privacySetting = new Hashtable(); | ||
privacySetting.Add("DataCollection",DataCollection); | ||
publicSettings.Privacy = privacySetting; | ||
|
||
publicSettings.ConfigurationFunction = string.Format( | ||
CultureInfo.InvariantCulture, | ||
"{0}\\{1}", | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the difference between giving 'null' value for this parameter and not giving this parameter at all?
Since this parameter is optional, I think it is better not to allow 'null'.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Null would leave the VM extension in the current state. Not giving this parameter and null are equivalent.