Skip to content

{Compute} az vmss update: Add new param --zone-placement-policy, --include-zones and --exclude-zones#33639

Merged
yanzhudd merged 3 commits into
Azure:devfrom
william051200:33474-zone-placement
Jun 24, 2026
Merged

{Compute} az vmss update: Add new param --zone-placement-policy, --include-zones and --exclude-zones#33639
yanzhudd merged 3 commits into
Azure:devfrom
william051200:33474-zone-placement

Conversation

@william051200

@william051200 william051200 commented Jun 23, 2026

Copy link
Copy Markdown
Member

Related command

az vmss update
az vmss create

Description

resolve #33474 (az vmss update: new params)
resolve #33473 (az vmss create: new validation)

They are both using the same validation, so I am including vmss create together in this PR

Testing Guide

Refer to azure-cli\src\azure-cli\azure\cli\command_modules\vm\tests\latest\test_vm_commands.py - test_vmss_update_zone_placement_policy test case

History Notes

[Compute] az vmss update: Add new parameters --zone-placement-policy, --include-zones and --exclude-zones


This checklist is used to make sure that common guidelines for a pull request are followed.

Copilot AI review requested due to automatic review settings June 23, 2026 02:50
@azure-client-tools-bot-prd

azure-client-tools-bot-prd Bot commented Jun 23, 2026

Copy link
Copy Markdown
️✔️AzureCLI-FullTest
️✔️acr
️✔️latest
️✔️3.12
️✔️3.14
️✔️acs
️✔️latest
️✔️3.12
️✔️3.14
️✔️advisor
️✔️latest
️✔️3.12
️✔️3.14
️✔️ams
️✔️latest
️✔️3.12
️✔️3.14
️✔️apim
️✔️latest
️✔️3.12
️✔️3.14
️✔️appconfig
️✔️latest
️✔️3.12
️✔️3.14
️✔️appservice
️✔️latest
️✔️3.12
️✔️3.14
️✔️aro
️✔️latest
️✔️3.12
️✔️3.14
️✔️backup
️✔️latest
️✔️3.12
️✔️3.14
️✔️batch
️✔️latest
️✔️3.12
️✔️3.14
️✔️batchai
️✔️latest
️✔️3.12
️✔️3.14
️✔️billing
️✔️latest
️✔️3.12
️✔️3.14
️✔️botservice
️✔️latest
️✔️3.12
️✔️3.14
️✔️cloud
️✔️latest
️✔️3.12
️✔️3.14
️✔️cognitiveservices
️✔️latest
️✔️3.12
️✔️3.14
️✔️compute_recommender
️✔️latest
️✔️3.12
️✔️3.14
️✔️computefleet
️✔️latest
️✔️3.12
️✔️3.14
️✔️config
️✔️latest
️✔️3.12
️✔️3.14
️✔️configure
️✔️latest
️✔️3.12
️✔️3.14
️✔️consumption
️✔️latest
️✔️3.12
️✔️3.14
️✔️container
️✔️latest
️✔️3.12
️✔️3.14
️✔️containerapp
️✔️latest
️✔️3.12
️✔️3.14
️✔️core
️✔️latest
️✔️3.12
️✔️3.14
️✔️cosmosdb
️✔️latest
️✔️3.12
️✔️3.14
️✔️databoxedge
️✔️latest
️✔️3.12
️✔️3.14
️✔️dls
️✔️latest
️✔️3.12
️✔️3.14
️✔️dms
️✔️latest
️✔️3.12
️✔️3.14
️✔️eventgrid
️✔️latest
️✔️3.12
️✔️3.14
️✔️eventhubs
️✔️latest
️✔️3.12
️✔️3.14
️✔️feedback
️✔️latest
️✔️3.12
️✔️3.14
️✔️find
️✔️latest
️✔️3.12
️✔️3.14
️✔️hdinsight
️✔️latest
️✔️3.12
️✔️3.14
️✔️identity
️✔️latest
️✔️3.12
️✔️3.14
️✔️iot
️✔️latest
️✔️3.12
️✔️3.14
️✔️keyvault
️✔️latest
️✔️3.12
️✔️3.14
️✔️lab
️✔️latest
️✔️3.12
️✔️3.14
️✔️managedservices
️✔️latest
️✔️3.12
️✔️3.14
️✔️maps
️✔️latest
️✔️3.12
️✔️3.14
️✔️marketplaceordering
️✔️latest
️✔️3.12
️✔️3.14
️✔️monitor
️✔️latest
️✔️3.12
️✔️3.14
️✔️mysql
️✔️latest
️✔️3.12
️✔️3.14
️✔️netappfiles
️✔️latest
️✔️3.12
️✔️3.14
️✔️network
️✔️latest
️✔️3.12
️✔️3.14
️✔️policyinsights
️✔️latest
️✔️3.12
️✔️3.14
️✔️postgresql
️✔️latest
️✔️3.12
️✔️3.14
️✔️privatedns
️✔️latest
️✔️3.12
️✔️3.14
️✔️profile
️✔️latest
️✔️3.12
️✔️3.14
️✔️rdbms
️✔️latest
️✔️3.12
️✔️3.14
️✔️redis
️✔️latest
️✔️3.12
️✔️3.14
️✔️relay
️✔️latest
️✔️3.12
️✔️3.14
️✔️resource
️✔️latest
️✔️3.12
️✔️3.14
️✔️role
️✔️latest
️✔️3.12
️✔️3.14
️✔️search
️✔️latest
️✔️3.12
️✔️3.14
️✔️security
️✔️latest
️✔️3.12
️✔️3.14
️✔️servicebus
️✔️latest
️✔️3.12
️✔️3.14
️✔️serviceconnector
️✔️latest
️✔️3.12
️✔️3.14
️✔️servicefabric
️✔️latest
️✔️3.12
️✔️3.14
️✔️signalr
️✔️latest
️✔️3.12
️✔️3.14
️✔️sql
️✔️latest
️✔️3.12
️✔️3.14
️✔️sqlvm
️✔️latest
️✔️3.12
️✔️3.14
️✔️storage
️✔️latest
️✔️3.12
️✔️3.14
️✔️synapse
️✔️latest
️✔️3.12
️✔️3.14
️✔️telemetry
️✔️latest
️✔️3.12
️✔️3.14
️✔️util
️✔️latest
️✔️3.12
️✔️3.14
️✔️vm
️✔️latest
️✔️3.12
️✔️3.14

@azure-client-tools-bot-prd

Copy link
Copy Markdown

Hi @william051200,
Since the current milestone time is less than 7 days, this pr will be reviewed in the next milestone.

@azure-client-tools-bot-prd

azure-client-tools-bot-prd Bot commented Jun 23, 2026

Copy link
Copy Markdown
⚠️AzureCLI-BreakingChangeTest
⚠️vm
rule cmd_name rule_message suggest_message
⚠️ 1006 - ParaAdd vmss update cmd vmss update added parameter exclude_zones
⚠️ 1006 - ParaAdd vmss update cmd vmss update added parameter include_zones
⚠️ 1006 - ParaAdd vmss update cmd vmss update added parameter zone_placement_policy

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds support for configuring VMSS Automatic Zone Placement settings via az vmss update and introduces client-side validation to prevent invalid combinations of zone filter arguments, aligning vmss update behavior with vmss create.

Changes:

  • Add --zone-placement-policy, --include-zones, and --exclude-zones to az vmss update and wire them into the VMSS update payload (placement.*).
  • Add a validator to reject --include-zones used together with --exclude-zones for both vmss create and vmss update.
  • Add a new scenario test + recording validating update behavior and the mutual-exclusivity error path.

Reviewed changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/azure-cli/azure/cli/command_modules/vm/custom.py Extends update_vmss to set placement.zone_placement_policy/include_zones/exclude_zones on the outgoing update model.
src/azure-cli/azure/cli/command_modules/vm/_validators.py Adds mutual exclusivity validation for --include-zones vs --exclude-zones and hooks it into vmss create/update validation flow.
src/azure-cli/azure/cli/command_modules/vm/_params.py Adds new CLI arguments for az vmss update to expose placement policy and zone filters.
src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_vm_commands.py Adds test_vmss_update_zone_placement_policy scenario coverage (include, exclude, and mutual-exclusivity error).
src/azure-cli/azure/cli/command_modules/vm/tests/latest/recordings/test_vmss_update_zone_placement_policy.yaml Recorded HTTP interactions for the new scenario test.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 1935 to 1939
_validate_vmss_create_automatic_repairs(cmd, namespace)
_validate_vmss_create_host_group(cmd, namespace)
_validate_vmss_create_auto_zone_placement(namespace)
_validate_vmss_auto_zone_placement(namespace)

Comment on lines +875 to +894
c.argument(
'zone_placement_policy',
arg_type=get_enum_type(['Auto']),
help='Specify the policy for availability zone placement of the virtual machine scale set. '
'When set to Auto, the platform automatically selects the availability zones.'
)
c.argument(
'include_zones',
nargs='+',
help='Specify a list of availability zones that must be considered for placement when '
'--zone-placement-policy is set to Auto. '
'If not specified, all availability zones in the region are considered.'
)
c.argument(
'exclude_zones',
nargs='+',
help='Specify a list of availability zones that must be excluded from placement when '
'--zone-placement-policy is set to Auto. '
'If not specified, no availability zones are excluded.'
)
@yonzhan

yonzhan commented Jun 23, 2026

Copy link
Copy Markdown
Collaborator

Compute

@yanzhudd yanzhudd merged commit a3ac9ab into Azure:dev Jun 24, 2026
61 checks passed
@yanzhudd yanzhudd changed the title [Compute] az vmss update: Add new param --zone-placement-policy, --include-zones and --exclude-zones {Compute} az vmss update: Add new param --zone-placement-policy, --include-zones and --exclude-zones Jun 24, 2026
@william051200 william051200 deleted the 33474-zone-placement branch June 24, 2026 00:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

act-observability-squad Auto-Assign Auto assign by bot Compute az vm/vmss/image/disk/snapshot

Projects

None yet

4 participants