I have a virtual machine scale set (VMSS) where I am trying to set the values on the RollingUpgradePolicy. I found documentation here on PowerShell commands for modifying it, but I can't quite get it to work. I'm attempting to use code like this:
$vmss = Get-AzVmss -ResourceGroupName "my-RG" -VMScaleSetName "my-scale-set";
Set-AzVmssRollingUpgradePolicy -VirtualMachineScaleSet $vmss -MaxBatchInstancePercent 50 -MaxUnhealthyInstancePercent 50 -MaxUnhealthyUpgradedInstancePercent 50
After running this it seems like it's successful because it returns a JSON object and shows all the values set like I want, but when I go to confirm it by looking at the settings in the portal I can see that my VMSS hasn't changed. Why is it not taking effect? My hunch is that the $vmss
variable I'm using is something like a copy of the VMSS and not a reference to my actual existing VMSS, but the documentation doesn't explain the $vmss variable or how to apply changes like I need. I'm also open to using CLI.
After running this it seems like it's successful because it returns a JSON object and shows all the values set like I want, but when I go to confirm it by looking at the settings in the portal I can see that my VMSS hasn't changed
The Set-AzVmssRollingUpgradePolicy
to modify the RollingUpgradePolicy
settings in VMSS . The commands will return the JSON
format with the updated settings, but it does not immediately affect in azure portal.
In order to update the upgrade policy values, update the VMSS settings using the Update-AzVmss
cmdlet after modifying the RollingUpgradePolicy
settings. follow the the MS Doc on updating the VMSS settings.
$VMS = Get-AzVmss -ResourceGroupName "v-venkat-mindtree" -VMScaleSetName "Venkatvmss"
Set-AzVmssRollingUpgradePolicy -VirtualMachineScaleSet $vmss -MaxBatchInstancePercent 50 -MaxUnhealthyInstancePercent 50 -MaxUnhealthyUpgradedInstancePercent 50
Update-AzVmss -ResourceGroupName "v-venkat-mindtree" -Name "Venkatvmss" -VirtualMachineScaleSet $vmss
Output:
Once ran the above commands VMSS upgrade policy was upgraded successfully.
Reference: Set-AzVmssRollingUpgradePolicy