{Compute} az vmss scale: Migrate command to aaz-based implementation#32795
{Compute} az vmss scale: Migrate command to aaz-based implementation#32795william051200 wants to merge 1 commit intoAzure:devfrom
az vmss scale: Migrate command to aaz-based implementation#32795Conversation
❌AzureCLI-FullTest
|
️✔️AzureCLI-BreakingChangeTest
|
|
Thank you for your contribution! We will review the pull request and get back to you soon. |
|
The git hooks are available for azure-cli and azure-cli-extensions repos. They could help you run required checks before creating the PR. Please sync the latest code with latest dev branch (for azure-cli) or main branch (for azure-cli-extensions). pip install azdev --upgrade
azdev setup -c <your azure-cli repo path> -r <your azure-cli-extensions repo path>
|
There was a problem hiding this comment.
Pull request overview
Migrates the az vmss scale command from the legacy azure.mgmt.compute SDK implementation to an AAZ-based implementation, and adjusts command registration to point to the new custom handler.
Changes:
- Reimplemented
scale_vmssto useoperations.vmss.VMSSShow+VMSSCreate(AAZ) instead ofvirtual_machine_scale_sets.get+begin_create_or_update(SDK). - Moved
vmss scalecommand registration to thewith self.command_group('vmss')block (and removed it from the SDK-basedvmsscommand group).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
src/azure-cli/azure/cli/command_modules/vm/custom.py |
Replaces SDK-based VMSS scale logic with AAZ Show + Create flow and capacity update. |
src/azure-cli/azure/cli/command_modules/vm/commands.py |
Re-registers vmss scale to use the custom command entry aligned with the migration. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| vmss['sku']['capacity'] = new_capacity | ||
| vmss['no_wait'] = no_wait | ||
|
|
||
| VMSSCreate(cli_ctx=cmd.cli_ctx)(command_args=vmss) |
There was a problem hiding this comment.
scale_vmss doesn’t return the result/poller from VMSSCreate(...). This changes the command behavior (no output) and will break existing tests that assert on vmss scale output (e.g., extendedLocation). Return the result of VMSSCreate(...) (and/or the LRO poller when --no-wait is used), consistent with update_vmss which returns VMSSCreate(...).
| VMSSCreate(cli_ctx=cmd.cli_ctx)(command_args=vmss) | |
| return VMSSCreate(cli_ctx=cmd.cli_ctx)(command_args=vmss) |
| from .operations.vmss import VMSSCreate, VMSSShow, convert_show_result_to_snake_case | ||
| vmss = VMSSShow(cli_ctx=cmd.cli_ctx)(command_args={ | ||
| 'resource_group': resource_group_name, | ||
| 'vm_scale_set_name': vm_scale_set_name | ||
| }) | ||
| vmss = convert_show_result_to_snake_case(vmss) | ||
|
|
There was a problem hiding this comment.
VMSSCreate requires resource_group and vm_scale_set_name arguments (see aaz latest vmss Create args schema). The dict produced by convert_show_result_to_snake_case(vmss) doesn’t include these keys, so this call will fail with missing required arguments. Please add resource_group=resource_group_name and vm_scale_set_name=vm_scale_set_name to the command_args passed to VMSSCreate (either by setting them on vmss or by constructing a new args dict).
Related command
az vmss scaleDescription
Migration from mgmt.compute to aaz-based
Testing Guide
History Notes
This 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.