-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
PowerShell Support for ResiliencyPolicy (including ResilientVMCreationPolicy, ResilientVMDeletionPolicy) on VMSS #25928
PowerShell Support for ResiliencyPolicy (including ResilientVMCreationPolicy, ResilientVMDeletionPolicy) on VMSS #25928
Conversation
️✔️Az.Accounts
|
Type | Cmdlet | Example | Line | RuleName | Description | Extent | Remediation |
---|---|---|---|---|---|---|---|
New-AzVmssConfig | 1 | 1 | Unassigned_Variable | New-AzVmssConfig -Location $Loc is a null-valued parameter value. | -Location | Assign value for $Loc. | |
New-AzVmssConfig | 1 | 1 | Unassigned_Variable | New-AzVmssConfig -NetworkInterfaceConfiguration $NetCfg is a null-valued parameter value. | -NetworkInterfaceConfiguration | Assign value for $NetCfg. | |
New-AzVmssConfig | 1 | 2 | Unassigned_Variable | Add-AzVmssNetworkInterfaceConfiguration -IPConfiguration $IPCfg is a null-valued parameter value. | -IPConfiguration | Assign value for $IPCfg. | |
New-AzVmssConfig | 1 | 3 | Unassigned_Variable | Set-AzVmssOsProfile -AdminUsername $adminUsername is a null-valued parameter value. | -AdminUsername | Assign value for $adminUsername. | |
New-AzVmssConfig | 1 | 3 | Unassigned_Variable | Set-AzVmssOsProfile -AdminPassword $AdminPassword is a null-valued parameter value. | -AdminPassword | Assign value for $AdminPassword. | |
New-AzVmssConfig | 1 | 5 | Unassigned_Variable | Set-AzVmssStorageProfile -ImageReferenceOffer $ImgRef.Offer is a null-valued parameter value. | -ImageReferenceOffer | Assign value for $ImgRef.Offer. | |
New-AzVmssConfig | 1 | 5 | Unassigned_Variable | Set-AzVmssStorageProfile -ImageReferenceSku $ImgRef.Skus is a null-valued parameter value. | -ImageReferenceSku | Assign value for $ImgRef.Skus. | |
New-AzVmssConfig | 1 | 5 | Unassigned_Variable | Set-AzVmssStorageProfile -ImageReferenceVersion $ImgRef.Version is a null-valued parameter value. | -ImageReferenceVersion | Assign value for $ImgRef.Version. | |
New-AzVmssConfig | 1 | 6 | Unassigned_Variable | Set-AzVmssStorageProfile -ImageReferencePublisher $ImgRef.PublisherName is a null-valued parameter value. | -ImageReferencePublisher | Assign value for $ImgRef.PublisherName. | |
New-AzVmssConfig | 1 | 6 | Unassigned_Variable | Set-AzVmssStorageProfile -VhdContainer $VHDContainer is a null-valued parameter value. | -VhdContainer | Assign value for $VHDContainer. | |
New-AzVmssConfig | 1 | 7 | Unassigned_Variable | Add-AzVmssAdditionalUnattendContent -ComponentName $AUCComponentName is a null-valued parameter value. | -ComponentName | Assign value for $AUCComponentName. | |
New-AzVmssConfig | 1 | 7 | Unassigned_Variable | Add-AzVmssAdditionalUnattendContent -Content $AUCContent is a null-valued parameter value. | -Content | Assign value for $AUCContent. | |
New-AzVmssConfig | 1 | 7 | Unassigned_Variable | Add-AzVmssAdditionalUnattendContent -PassName $AUCPassName is a null-valued parameter value. | -PassName | Assign value for $AUCPassName. | |
New-AzVmssConfig | 1 | 7 | Unassigned_Variable | Add-AzVmssAdditionalUnattendContent -SettingName $AUCSetting is a null-valued parameter value. | -SettingName | Assign value for $AUCSetting. | |
New-AzVmssConfig | 1 | 9 | Unassigned_Variable | New-AzVmss -ResourceGroupName $RGName is a null-valued parameter value. | -ResourceGroupName | Assign value for $RGName. | |
New-AzVmssConfig | 1 | 9 | Unassigned_Variable | New-AzVmss -Name $VMSSName is a null-valued parameter value. | -Name | Assign value for $VMSSName. | |
New-AzVmssConfig | 4 | 18 | Unassigned_Variable | New-AzStorageAccount -ResourceGroupName $rgname is a null-valued parameter value. | -ResourceGroupName | Assign value for $rgname. | |
New-AzVmssConfig | 4 | 18 | Unassigned_Variable | New-AzStorageAccount -Location $loc is a null-valued parameter value. | -Location | Assign value for $loc. | |
New-AzVmssConfig | 4 | 19 | Unassigned_Variable | Get-AzStorageAccount -ResourceGroupName $rgname is a null-valued parameter value. | -ResourceGroupName | Assign value for $rgname. | |
New-AzVmssConfig | 4 | 23 | Unassigned_Variable | New-AzVirtualNetwork -ResourceGroupName $rgname is a null-valued parameter value. | -ResourceGroupName | Assign value for $rgname. | |
New-AzVmssConfig | 4 | 23 | Unassigned_Variable | New-AzVirtualNetwork -Location $loc is a null-valued parameter value. | -Location | Assign value for $loc. | |
New-AzVmssConfig | 4 | 24 | Unassigned_Variable | Get-AzVirtualNetwork -ResourceGroupName $rgname is a null-valued parameter value. | -ResourceGroupName | Assign value for $rgname. | |
New-AzVmssConfig | 4 | 30 | Unassigned_Variable | New-AzVmssConfig -Location $loc is a null-valued parameter value. | -Location | Assign value for $loc. | |
New-AzVmssConfig | 4 | 32 | Unassigned_Variable | Set-AzVmssOsProfile -AdminPassword $password is a null-valued parameter value. | -AdminPassword | Assign value for $password. | |
New-AzVmssConfig | 4 | 37 | Unassigned_Variable | New-AzVmss -ResourceGroupName $rgname is a null-valued parameter value. | -ResourceGroupName | Assign value for $rgname. | |
New-AzVmssConfig | 4 | 39 | Unassigned_Variable | Get-AzVmss -ResourceGroupName $rgname is a null-valued parameter value. | -ResourceGroupName | Assign value for $rgname. | |
New-AzVmssConfig | 5 | 36 | Mismatched_Parameter_Value_Type | Set-AzVmssOsProfile -AdminPassword $adminPassword is not an expected parameter value type. | -AdminPassword | Use correct parameter value type. Expected Type is string. Now the type is securestring.(Command). | |
Update-AzVmss | 1 | 1 | Unassigned_Variable | Update-AzVmss -VirtualMachineScaleSet $LocalVMSS is a null-valued parameter value. | -VirtualMachineScaleSet | Assign value for $LocalVMSS. |
⚠️ Windows PowerShell - Windows
Type | Cmdlet | Example | Line | RuleName | Description | Extent | Remediation |
---|---|---|---|---|---|---|---|
New-AzVmssConfig | 1 | 1 | Unassigned_Variable | New-AzVmssConfig -Location $Loc is a null-valued parameter value. | -Location | Assign value for $Loc. | |
New-AzVmssConfig | 1 | 1 | Unassigned_Variable | New-AzVmssConfig -NetworkInterfaceConfiguration $NetCfg is a null-valued parameter value. | -NetworkInterfaceConfiguration | Assign value for $NetCfg. | |
New-AzVmssConfig | 1 | 2 | Unassigned_Variable | Add-AzVmssNetworkInterfaceConfiguration -IPConfiguration $IPCfg is a null-valued parameter value. | -IPConfiguration | Assign value for $IPCfg. | |
New-AzVmssConfig | 1 | 3 | Unassigned_Variable | Set-AzVmssOsProfile -AdminUsername $adminUsername is a null-valued parameter value. | -AdminUsername | Assign value for $adminUsername. | |
New-AzVmssConfig | 1 | 3 | Unassigned_Variable | Set-AzVmssOsProfile -AdminPassword $AdminPassword is a null-valued parameter value. | -AdminPassword | Assign value for $AdminPassword. | |
New-AzVmssConfig | 1 | 5 | Unassigned_Variable | Set-AzVmssStorageProfile -ImageReferenceOffer $ImgRef.Offer is a null-valued parameter value. | -ImageReferenceOffer | Assign value for $ImgRef.Offer. | |
New-AzVmssConfig | 1 | 5 | Unassigned_Variable | Set-AzVmssStorageProfile -ImageReferenceSku $ImgRef.Skus is a null-valued parameter value. | -ImageReferenceSku | Assign value for $ImgRef.Skus. | |
New-AzVmssConfig | 1 | 5 | Unassigned_Variable | Set-AzVmssStorageProfile -ImageReferenceVersion $ImgRef.Version is a null-valued parameter value. | -ImageReferenceVersion | Assign value for $ImgRef.Version. | |
New-AzVmssConfig | 1 | 6 | Unassigned_Variable | Set-AzVmssStorageProfile -ImageReferencePublisher $ImgRef.PublisherName is a null-valued parameter value. | -ImageReferencePublisher | Assign value for $ImgRef.PublisherName. | |
New-AzVmssConfig | 1 | 6 | Unassigned_Variable | Set-AzVmssStorageProfile -VhdContainer $VHDContainer is a null-valued parameter value. | -VhdContainer | Assign value for $VHDContainer. | |
New-AzVmssConfig | 1 | 7 | Unassigned_Variable | Add-AzVmssAdditionalUnattendContent -ComponentName $AUCComponentName is a null-valued parameter value. | -ComponentName | Assign value for $AUCComponentName. | |
New-AzVmssConfig | 1 | 7 | Unassigned_Variable | Add-AzVmssAdditionalUnattendContent -Content $AUCContent is a null-valued parameter value. | -Content | Assign value for $AUCContent. | |
New-AzVmssConfig | 1 | 7 | Unassigned_Variable | Add-AzVmssAdditionalUnattendContent -PassName $AUCPassName is a null-valued parameter value. | -PassName | Assign value for $AUCPassName. | |
New-AzVmssConfig | 1 | 7 | Unassigned_Variable | Add-AzVmssAdditionalUnattendContent -SettingName $AUCSetting is a null-valued parameter value. | -SettingName | Assign value for $AUCSetting. | |
New-AzVmssConfig | 1 | 9 | Unassigned_Variable | New-AzVmss -ResourceGroupName $RGName is a null-valued parameter value. | -ResourceGroupName | Assign value for $RGName. | |
New-AzVmssConfig | 1 | 9 | Unassigned_Variable | New-AzVmss -Name $VMSSName is a null-valued parameter value. | -Name | Assign value for $VMSSName. | |
New-AzVmssConfig | 4 | 18 | Unassigned_Variable | New-AzStorageAccount -ResourceGroupName $rgname is a null-valued parameter value. | -ResourceGroupName | Assign value for $rgname. | |
New-AzVmssConfig | 4 | 18 | Unassigned_Variable | New-AzStorageAccount -Location $loc is a null-valued parameter value. | -Location | Assign value for $loc. | |
New-AzVmssConfig | 4 | 19 | Unassigned_Variable | Get-AzStorageAccount -ResourceGroupName $rgname is a null-valued parameter value. | -ResourceGroupName | Assign value for $rgname. | |
New-AzVmssConfig | 4 | 23 | Unassigned_Variable | New-AzVirtualNetwork -ResourceGroupName $rgname is a null-valued parameter value. | -ResourceGroupName | Assign value for $rgname. | |
New-AzVmssConfig | 4 | 23 | Unassigned_Variable | New-AzVirtualNetwork -Location $loc is a null-valued parameter value. | -Location | Assign value for $loc. | |
New-AzVmssConfig | 4 | 24 | Unassigned_Variable | Get-AzVirtualNetwork -ResourceGroupName $rgname is a null-valued parameter value. | -ResourceGroupName | Assign value for $rgname. | |
New-AzVmssConfig | 4 | 30 | Unassigned_Variable | New-AzVmssConfig -Location $loc is a null-valued parameter value. | -Location | Assign value for $loc. | |
New-AzVmssConfig | 4 | 32 | Unassigned_Variable | Set-AzVmssOsProfile -AdminPassword $password is a null-valued parameter value. | -AdminPassword | Assign value for $password. | |
New-AzVmssConfig | 4 | 37 | Unassigned_Variable | New-AzVmss -ResourceGroupName $rgname is a null-valued parameter value. | -ResourceGroupName | Assign value for $rgname. | |
New-AzVmssConfig | 4 | 39 | Unassigned_Variable | Get-AzVmss -ResourceGroupName $rgname is a null-valued parameter value. | -ResourceGroupName | Assign value for $rgname. | |
New-AzVmssConfig | 5 | 36 | Mismatched_Parameter_Value_Type | Set-AzVmssOsProfile -AdminPassword $adminPassword is not an expected parameter value type. | -AdminPassword | Use correct parameter value type. Expected Type is string. Now the type is securestring.(Command). | |
Update-AzVmss | 1 | 1 | Unassigned_Variable | Update-AzVmss -VirtualMachineScaleSet $LocalVMSS is a null-valued parameter value. | -VirtualMachineScaleSet | Assign value for $LocalVMSS. |
️✔️Help File Existence Check
️✔️PowerShell Core - Windows
️✔️Windows PowerShell - Windows
️✔️File Change Check
️✔️PowerShell Core - Windows
️✔️Windows PowerShell - Windows
️✔️UX Metadata Check
️✔️PowerShell Core - Windows
️✔️Windows PowerShell - Windows
️✔️Test
️✔️PowerShell Core - Linux
️✔️PowerShell Core - MacOS
️✔️PowerShell Core - Windows
️✔️Windows PowerShell - Windows
️✔️Az.KeyVault
️✔️Build
️✔️PowerShell Core - Windows
️✔️Windows PowerShell - Windows
️✔️Az.ManagedServiceIdentity
️✔️Build
️✔️PowerShell Core - Windows
️✔️Windows PowerShell - Windows
️✔️Az.Monitor
️✔️Build
️✔️PowerShell Core - Windows
️✔️Windows PowerShell - Windows
️✔️Az.Network
️✔️Build
️✔️PowerShell Core - Windows
️✔️Windows PowerShell - Windows
️✔️Test
️✔️PowerShell Core - Linux
️✔️PowerShell Core - MacOS
️✔️PowerShell Core - Windows
️✔️Windows PowerShell - Windows
️✔️Az.OperationalInsights
️✔️Build
️✔️PowerShell Core - Windows
️✔️Windows PowerShell - Windows
️✔️Az.PrivateDns
️✔️Build
️✔️PowerShell Core - Windows
️✔️Windows PowerShell - Windows
️✔️Az.RecoveryServices
️✔️Build
️✔️PowerShell Core - Windows
️✔️Windows PowerShell - Windows
️✔️Test
️✔️PowerShell Core - Linux
️✔️PowerShell Core - MacOS
️✔️PowerShell Core - Windows
️✔️Windows PowerShell - Windows
️✔️Az.Security
️✔️Build
️✔️PowerShell Core - Windows
️✔️Windows PowerShell - Windows
️✔️Test
️✔️PowerShell Core - Linux
️✔️PowerShell Core - MacOS
️✔️PowerShell Core - Windows
️✔️Windows PowerShell - Windows
️✔️Az.Sql
️✔️Build
️✔️PowerShell Core - Windows
️✔️Windows PowerShell - Windows
️✔️Az.Ssh
️✔️Build
️✔️PowerShell Core - Windows
️✔️Windows PowerShell - Windows
️✔️Test
️✔️PowerShell Core - Linux
️✔️PowerShell Core - MacOS
️✔️PowerShell Core - Windows
️✔️Windows PowerShell - Windows
️✔️Az.Storage
️✔️Build
️✔️PowerShell Core - Windows
️✔️Windows PowerShell - Windows
src/Compute/Compute/ChangeLog.md
Outdated
@@ -20,6 +20,7 @@ | |||
|
|||
--> | |||
## Upcoming Release | |||
* Introduced `EnableResilientVMCreate` and `EnableResilientVMDelete` parameters to `Update-AzVmss` and `New-AzVmssConfig` cmdlets for enhanced VM resilience options. |
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.
let's keep this consistent with other lines.
Ex: * Added parameter -ResourceIdsOnly
to Get-AzCapacityReservationGroup
cmdlet.
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.
This is AI generated, so I've marked it as improvements to make on ps cmd assistant. and also fixed this
@@ -776,6 +806,21 @@ Accept pipeline input: False | |||
Accept wildcard characters: False | |||
``` | |||
|
|||
### -ProgressAction |
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.
to be removed
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.
Done
[Parameter( | ||
Mandatory = false, | ||
HelpMessage = "Enable or disable resilient VM creation.")] | ||
public SwitchParameter EnableResilientVMCreate { 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.
should this be a bool as well?
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.
Addressed with design author and changed, Switch is for New-Azvmssconfig and Update is for Update-Azvmss
[Parameter( | ||
Mandatory = false, | ||
HelpMessage = "Enable or disable resilient VM deletion.")] | ||
public bool EnableResilientVMDelete { 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.
why is the other one Switch and this one bool ?
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.
Addressed with design author and changed, Switch is for New-Azvmssconfig and Update is for Update-Azvmss
.SYNOPSIS | ||
Create a VMSS | ||
Test ResilientVMCreationPolicy |
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.
Improve the test description.
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.
Added a few descriptors
$vmssName = 'vmssResiliencyPolicy' + $rgname; | ||
|
||
$adminUsername = 'Foo12'; |
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.
you could use Get-ComputeTestResourceName here instead. Might be better security wise.
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.
how is it better security wise? The resource will be deleted after the test is ran.
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.
then there's no established pattern or hardcoded string to learn our username from. The cleanup should happen, but this would further obfuscate the credentials and make them non-deterministic.
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.
Added
{ | ||
vResiliencyPolicy = new ResiliencyPolicy(); | ||
} | ||
vResiliencyPolicy.ResilientVMCreationPolicy = new ResilientVMCreationPolicy(this.EnableResilientVMCreate.IsPresent); |
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.
we shouldn't use IsPResent even on SwitchParameters because users can pass switchParameters as false as -Parameter:$false. It's rare but it does happen so you should check to see if it is $true.
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.
I see interesting, corrected.
{ | ||
this.VirtualMachineScaleSetUpdate.ResiliencyPolicy = new ResiliencyPolicy(); | ||
} | ||
this.VirtualMachineScaleSetUpdate.ResiliencyPolicy.ResilientVMCreationPolicy = new ResilientVMCreationPolicy(this.EnableResilientVMCreate.IsPresent); |
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.
same ispresent concern here as above.
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.
addressed
{ | ||
this.VirtualMachineScaleSet.ResiliencyPolicy = new ResiliencyPolicy(); | ||
} | ||
this.VirtualMachineScaleSet.ResiliencyPolicy.ResilientVMCreationPolicy = new ResilientVMCreationPolicy(this.EnableResilientVMCreate.IsPresent); |
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.
same ispresent concern
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.
addressed
src/Compute/Compute/Generated/VirtualMachineScaleSet/Config/NewAzureRmVmssConfigCommand.cs
Show resolved
Hide resolved
src/Compute/Compute/Generated/VirtualMachineScaleSet/Config/NewAzureRmVmssConfigCommand.cs
Show resolved
Hide resolved
$vmssName = 'vmssResiliencyPolicy' + $rgname; | ||
|
||
$adminUsername = 'Foo12'; |
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.
then there's no established pattern or hardcoded string to learn our username from. The cleanup should happen, but this would further obfuscate the credentials and make them non-deterministic.
src/Compute/Compute.Test/ScenarioTests/VirtualMachineScaleSetTests.ps1
Outdated
Show resolved
Hide resolved
src/Compute/Compute/Generated/VirtualMachineScaleSet/VirtualMachineScaleSetUpdateMethod.cs
Show resolved
Hide resolved
…nPolicy, ResilientVMDeletionPolicy) on VMSS (#25928) * Autogen code * Update ChangeLog.md * fixing autogenerated changes * adding test and help * More changes * changing help * changes with help * fixed test case * Adding static analysis suppression --------- Co-authored-by: PSCmdAssistant <pscmdassistant@microsoft.com> Co-authored-by: Xiaogang <xidi@microsoft.com>
…nPolicy, ResilientVMDeletionPolicy) on VMSS (#25928) (#25987) * Autogen code * Update ChangeLog.md * fixing autogenerated changes * adding test and help * More changes * changing help * changes with help * fixed test case * Adding static analysis suppression --------- Co-authored-by: Haider Agha <64601174+haagha@users.noreply.github.com> Co-authored-by: PSCmdAssistant <pscmdassistant@microsoft.com> Co-authored-by: Xiaogang <xidi@microsoft.com>
Description
Introduced
EnableResilientVMCreate
andEnableResilientVMDelete
parameters toUpdate-AzVmss
andNew-AzVmssConfig
cmdlets for enhanced VM resilience options.Mandatory Checklist
Please choose the target release of Azure PowerShell. (⚠️ Target release is a different concept from API readiness. Please click below links for details.)
Check this box to confirm: I have read the Submitting Changes section of
CONTRIBUTING.md
and reviewed the following information:ChangeLog.md
file(s) appropriatelysrc/{{SERVICE}}/{{SERVICE}}/ChangeLog.md
.## Upcoming Release
header in the past tense.ChangeLog.md
if no new release is required, such as fixing test case only.