-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Adding Automatic Zone Placement #28882
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
base: main
Are you sure you want to change the base?
Changes from all commits
a8427c8
cd16ab3
fa5fac2
dee4887
7893add
d3a2dce
4027c18
4439dd0
e7364fd
94e5b2b
79338fa
7e4c455
3fa0bb7
3ef7128
7478986
2fef2ce
22a973e
bd880d4
23d89c3
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 | ||
|---|---|---|---|---|
|
|
@@ -6185,4 +6185,90 @@ function Test-VirtualMachineScaleSetResiliencyView | |||
| # Cleanup | ||||
| Clean-ResourceGroup $rgname; | ||||
| } | ||||
| } | ||||
|
|
||||
| <# | ||||
| .SYNOPSIS | ||||
| Test Virtual Machine Scale Set Automatic Zone Placement feature | ||||
| #> | ||||
| function Test-VirtualMachineScaleSetAutomaticZonePlacement | ||||
| { | ||||
| # Setup | ||||
| $rgname = Get-ComputeTestResourceName | ||||
|
|
||||
| try | ||||
| { | ||||
| # Common | ||||
| $loc = "eastus2euap"; | ||||
| $vmssName = "vmssAutoZonePlacement" + $rgname; | ||||
| $vmssName2 = "vmssAutoZonePlacement2" + $rgname; | ||||
| $vnetName = "vnetAutoZonePlacement" + $rgname; | ||||
| $subnetName = "subnetAutoZonePlacement" + $rgname; | ||||
| $adminUsername = Get-ComputeTestResourceName; | ||||
| $password = Get-PasswordForVM | ConvertTo-SecureString -AsPlainText -Force; | ||||
| $cred = New-Object System.Management.Automation.PSCredential ($adminUsername, $password); | ||||
| $linuxImage = "Canonical:0001-com-ubuntu-server-jammy:22_04-lts:latest" | ||||
| $domainNameLabel1 = "d1" + $rgname; | ||||
|
|
||||
| # Create resource group | ||||
| New-AzResourceGroup -Name $rgname -Location $loc -Force | ||||
|
|
||||
|
|
||||
| # Create using simple parameter and New-AzVmss | ||||
| New-AzVmss -ResourceGroupName $rgname -Location $loc -Credential $cred -VMScaleSetName $vmssName -DomainNameLabel $domainNameLabel1 -Image $linuxImage -ZonePlacementPolicy 'Auto' -IncludeZone "1","2" | ||||
|
|
||||
| # Verify ZonePlacementPolicy successfully set | ||||
| $vmss = Get-AzVmss -ResourceGroupName $rgname -VMScaleSetName $vmssName | ||||
| Assert-AreEqual $vmss.Placement.ZonePlacementPolicy 'Auto' | ||||
| Assert-AreEqual $vmss.Placement.IncludeZones.Count 2 | ||||
|
|
||||
| # Create VNet and Subnet | ||||
| $vnetAddressPrefix = "10.0.0.0/16"; | ||||
| $subnetAddressPrefix = "10.0.0.0/24"; | ||||
| $subnetConfig = New-AzVirtualNetworkSubnetConfig -Name $subnetName -AddressPrefix $subnetAddressPrefix; | ||||
| $vnet = New-AzVirtualNetwork -Name $vnetName -ResourceGroupName $rgname -Location $loc -AddressPrefix $vnetAddressPrefix -Subnet $subnetConfig; | ||||
|
|
||||
| # Get subnet object | ||||
| $subnet = Get-AzVirtualNetwork -Name $vnetName -ResourceGroupName $rgname | Get-AzVirtualNetworkSubnetConfig -Name $subnetName | ||||
|
|
||||
| # VMSS Config | ||||
| $vmssConfig = New-AzVmssConfig -Location $loc -SkuCapacity 2 -SkuName "Standard_D2s_v3" -ZonePlacementPolicy 'Auto' -MaxZoneCount 2 -EnableMaxInstancePercentPerZone -MaxInstancePercentPerZoneValue 50 -IncludeZone "1","2"; | ||||
|
|
||||
| # Configure IP and NIC | ||||
| $ipCfg = New-AzVmssIpConfig -Name "ipconfig1" -SubnetId $subnet.Id | ||||
| $vmssConfig = Add-AzVmssNetworkInterfaceConfiguration -VirtualMachineScaleSet $vmssConfig ` | ||||
| -Name "nicConfig" -Primary $true -IPConfiguration $ipCfg; | ||||
|
|
||||
| # Configure OS profile | ||||
| $vmssConfig = Set-AzVmssOSProfile -VirtualMachineScaleSet $vmssConfig ` | ||||
| -ComputerNamePrefix "test" ` | ||||
| -AdminUsername $adminUsername ` | ||||
| -AdminPassword $password | ||||
|
|
||||
| # Assert the Automatic Zone Placement from the vmssConfig | ||||
| Assert-AreEqual $vmssConfig.Placement.ZonePlacementPolicy 'Auto'; | ||||
| Assert-AreEqual $vmssConfig.ResiliencyPolicy.ZoneAllocationPolicy.MaxZoneCount 2; | ||||
| Assert-True { $vmssConfig.ResiliencyPolicy.ZoneAllocationPolicy.MaxInstancePercentPerZonePolicy.Enabled } | ||||
| Assert-AreEqual $vmssConfig.ResiliencyPolicy.ZoneAllocationPolicy.MaxInstancePercentPerZonePolicy.Value 50 | ||||
|
|
||||
| # Create the vmss using the config | ||||
| $vmssResult = New-AzVmss -ResourceGroupName $rgname -VMScaleSetName $vmssName2 -VirtualMachineScaleSet $vmssConfig; | ||||
|
|
||||
| # Assert the Automatic Zone Placement from the vmssResult | ||||
| Assert-AreEqual $vmssResult.Placement.ZonePlacementPolicy 'Auto'; | ||||
| Assert-AreEqual $vmssResult.ResiliencyPolicy.ZoneAllocationPolicy.MaxZoneCount 2; | ||||
| Assert-True { $vmssResult.ResiliencyPolicy.ZoneAllocationPolicy.MaxInstancePercentPerZonePolicy.Enabled } | ||||
| Assert-AreEqual $vmssResult.ResiliencyPolicy.ZoneAllocationPolicy.MaxInstancePercentPerZonePolicy.Value 50 | ||||
|
|
||||
| # Update vmss | ||||
| $vmssUpdate = Update-AzVmss -ResourceGroupName $rgname -Name $vmssName2 -MaxInstancePercentPerZoneValue 60; | ||||
|
|
||||
| Assert-AreEqual $vmssUpdate.ResiliencyPolicy.ZoneAllocationPolicy.MaxInstancePercentPerZonePolicy.Value 60; | ||||
| #> | ||||
|
||||
| #> |
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -20,6 +20,9 @@ | |||||
| --> | ||||||
| ## Upcoming Release | ||||||
| * Added new parameters `ZonePlacementPolicy`, `IncludeZone`, `ExcludeZone`, `MaxZoneCount`, `EnableMaxInstancePercentPerZone` and `MaxInstancePercentPerZoneValue` to `New-AzVmssConfig` cmdlet. | ||||||
| * Added new parameters `ZonePlacementPolicy`, `IncludeZone` and `ExcludeZone` to `New-AzVmss` cmdlet. | ||||||
| * Added new parameters `MaxZoneCount`, `EnableMaxInstancePercentPerZone` and `MaxInstancePercentPerZoneValue` to `Update-AzVmss` cmdlet. | ||||||
|
|
||||||
| ## Version 11.1.0 | ||||||
| * Added `-ResiliencyView` parameter to `Get-AzVmssVM` cmdlet | ||||||
|
|
@@ -44,6 +47,7 @@ | |||||
| * Added `-InstantAccessDurationMinutes` parameter to New-AzSnapshotConfig. | ||||||
| * Added `SecureVMGuestStateSAS` parameter to `Grant-AzSnapshotAccess`. | ||||||
| * Updated SDK to use 2025-04-01 version of the ComputeRP API for Compute related cmdlets. | ||||||
| * Added new parameters `ZonePlacementPolicy`, `maxZoneCount`, `enableMaxInstancePercentPerZone`, and `maxInstancePercentPerZoneValue` to `New-AzVmssConfig` and `Update-AzVmss` cmdlets for VMSS Automatic Zone Placement. | ||||||
|
||||||
| * Added new parameters `ZonePlacementPolicy`, `maxZoneCount`, `enableMaxInstancePercentPerZone`, and `maxInstancePercentPerZoneValue` to `New-AzVmssConfig` and `Update-AzVmss` cmdlets for VMSS Automatic Zone Placement. | |
| * Added new parameters `ZonePlacementPolicy`, `MaxZoneCount`, `EnableMaxInstancePercentPerZone`, and `MaxInstancePercentPerZoneValue` to `New-AzVmssConfig` and `Update-AzVmss` cmdlets for VMSS (Virtual Machine Scale Set) Automatic Zone Placement. |
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.
The comment on lines 247-249 states "This property cannot be changed once VMSS is provisioned" but the Placement property is being added to VirtualMachineScaleSetUpdate, which is used for updating existing VMSS. If the property truly cannot be changed after provisioning, it should not be in the Update model. If it can be changed, the comment is misleading. Please verify the Azure API behavior and either remove the property from the Update model or update the comment to accurately reflect whether this property is mutable.