{Compute} az vmss update: Add new param --zone-placement-policy, --include-zones and --exclude-zones#33639
Merged
Merged
Conversation
️✔️AzureCLI-FullTest
|
|
Hi @william051200, |
|
| rule | cmd_name | rule_message | suggest_message |
|---|---|---|---|
| vmss update | cmd vmss update added parameter exclude_zones |
||
| vmss update | cmd vmss update added parameter include_zones |
||
| vmss update | cmd vmss update added parameter zone_placement_policy |
Contributor
There was a problem hiding this comment.
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-zonestoaz vmss updateand wire them into the VMSS update payload (placement.*). - Add a validator to reject
--include-zonesused together with--exclude-zonesfor bothvmss createandvmss 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.' | ||
| ) |
Collaborator
|
Compute |
yanzhudd
approved these changes
Jun 23, 2026
az vmss update: Add new param --zone-placement-policy, --include-zones and --exclude-zonesaz vmss update: Add new param --zone-placement-policy, --include-zones and --exclude-zones
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related command
az vmss updateaz vmss createDescription
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 createtogether in this PRTesting Guide
Refer to
azure-cli\src\azure-cli\azure\cli\command_modules\vm\tests\latest\test_vm_commands.py-test_vmss_update_zone_placement_policytest caseHistory Notes
[Compute]
az vmss update: Add new parameters--zone-placement-policy,--include-zonesand--exclude-zonesThis checklist is used to make sure that common guidelines for a pull request are followed.
The PR title and description has followed the guideline in Submitting Pull Requests.
I adhere to the Command Guidelines.
I adhere to the Error Handling Guidelines.