-
Notifications
You must be signed in to change notification settings - Fork 4k
Add parameters for alternate extensions and encrypt-format #4848
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
Conversation
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.
@vermashi a few comments that need to be addressed. Also,
-
Please update the Compute change log to reflect the changes made in this PR
-
Please add test coverage to verify the changes you are making in this PR are working as intended
ValueFromPipelineByPropertyName = true, | ||
HelpMessage = "The extension type. Specify this parameter to override its default value of \"AzureDiskEncryption\" for Windows VMs and \"AzureDiskEncryptionForLinux\" for Linux VMs.")] | ||
[ValidateNotNullOrEmpty] | ||
public string ExtensionType { get; set; } |
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.
@vermashi is there a closed set of values that can be provided to this parameter? If so, please use a ValidateSet
to define the possible set of values to allow a user to tab through them
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.
No, users are not limited to a closed set of values for this parameter.
ValueFromPipelineByPropertyName = true, | ||
HelpMessage = "The extension publisher name. Specify this parameter only to override the default value of \"Microsoft.Azure.Security\".")] | ||
[ValidateNotNullOrEmpty] | ||
public string ExtensionPublisherName { get; set; } |
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.
@vermashi same comment about possibly using a ValidateSet
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.
For background, the defaults won't change, and the user can get those if they don't specify this optional parameter.
Position = 18, | ||
ValueFromPipelineByPropertyName = true, | ||
HelpMessage = "Encrypt-Format all data drives that are not already encrypted")] | ||
public SwitchParameter EncryptFormatAll { get; set; } |
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.
@vermashi a SwitchParameter
should not have a position nor should it accept a value from the pipeline
@@ -76,6 +78,32 @@ Accept pipeline input: True (ByPropertyName) | |||
Accept wildcard characters: False | |||
``` | |||
|
|||
### -ExtensionPublisherName | |||
The extension publisher name. Specify this parameter only to override the default value of "Microsoft.Azure.Security".```yaml |
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.
@vermashi this is a bug in platyPS
- please make sure the ```yaml
string is on a line by itself. See the other parameters in this file for guidance.
``` | ||
|
||
### -ExtensionType | ||
The extension type. Specify this parameter to override its default value of "AzureDiskEncryption" for Windows VMs and "AzureDiskEncryptionForLinux" for Linux VMs.```yaml |
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.
@vermashi same comment
@@ -48,6 +50,32 @@ Accept pipeline input: False | |||
Accept wildcard characters: False | |||
``` | |||
|
|||
### -ExtensionPublisherName | |||
The extension publisher name. Specify this parameter only to override the default value of "Microsoft.Azure.Security".```yaml |
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.
@vermashi same comment in this file for the added parameters
@@ -293,6 +296,45 @@ Accept pipeline input: True (ByPropertyName) | |||
Accept wildcard characters: False | |||
``` | |||
|
|||
### -EncryptFormatAll | |||
Encrypt-Format all data drives that are not already encrypted```yaml |
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.
@vermashi same comment in this file for the added parameters
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.
It looks like the platyPS yaml strings need to be changed as per feedback from @cormacpayne but after that, it looks good to me.
public const string LinuxExtensionDefaultVersion = "0.1"; | ||
|
||
public const string ExtensionDefaultPublisher = "Microsoft.Azure.Security"; | ||
public const string ExtensionDefaultName = "AzureDiskEncryption"; | ||
public const string ExtensionDefaultType = "AzureDiskEncryption"; |
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.
👍 ... nice to see this getting disambiguated :)
ValueFromPipelineByPropertyName = true, | ||
HelpMessage = "The extension publisher name. Specify this parameter only to override the default value of \"Microsoft.Azure.Security\".")] | ||
[ValidateNotNullOrEmpty] | ||
public string ExtensionPublisherName { get; set; } |
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.
For background, the defaults won't change, and the user can get those if they don't specify this optional parameter.
Have addressed most of the comments. Working on the tests. |
TL;DR: 1- The tests might not get fixed by snap date, possible to ship without? Is it ok if we replace some of the newly added parameters in this PR with env-variables? |
@vermashi Please fix the merge conflicts and push. |
c2e57ec
to
200edf5
Compare
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.
@vermashi a few minor comments, otherwise LGTM
@@ -89,6 +89,22 @@ public class DisableAzureDiskEncryptionCommand : VirtualMachineExtensionBaseCmdl | |||
HelpMessage = "Disable auto-upgrade of minor version")] | |||
public SwitchParameter DisableAutoUpgradeMinorVersion { get; set; } | |||
|
|||
[Parameter( | |||
Mandatory = false, | |||
Position = 6, |
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.
@vermashi nit: the number of positional parameters in a single set should be capped at four or five. After this, it can be difficult for the user to remember the order in which they should provide the values, so our recommendation would be to remove the positions from the parameters you added (I would also include the DisableAutoUpgradeMinorVersion
parameter above since switch parameters are only named
@@ -58,6 +58,22 @@ public class GetAzureDiskEncryptionStatusCommand : VirtualMachineExtensionBaseCm | |||
[ValidateNotNullOrEmpty] | |||
public string Name { get; set; } | |||
|
|||
[Parameter( | |||
Mandatory = false, | |||
Position = 3, |
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.
@vermashi nit: you can decide whether or not the positions are needed for the new parameters
publicSettings.Add(AzureDiskEncryptionExtensionConstants.sequenceVersionKey, SequenceVersion ?? String.Empty); | ||
|
||
if (EncryptFormatAll) |
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.
@vermashi nit: EncryptFormatAll.IsPresent
for consistency with other cmdlets
Required: False | ||
Position: Named | ||
Default value: None | ||
Accept pipeline input: True (ByPropertyName) |
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.
@vermashi it looks like the help for these cmdlets needs to be regenerated
Description
This checklist is used to make sure that common guidelines for a pull request are followed. You can find a more complete discussion of PowerShell cmdlet best practices here.
General Guidelines
Testing Guidelines
Cmdlet Signature Guidelines
ShouldProcess
and haveSupportShouldProcess=true
specified in the cmdlet attribute. You can find more information onShouldProcess
here.OutputType
attribute if any output is produced - if the cmdlet produces no output, it should implement aPassThru
parameter.Cmdlet Parameter Guidelines