{Compute} az vmss restart: Migrate command to aaz-based implementation#32794
{Compute} az vmss restart: Migrate command to aaz-based implementation#32794william051200 wants to merge 2 commits intoAzure:devfrom
az vmss restart: Migrate command to aaz-based implementation#32794Conversation
️✔️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 az vmss restart from the legacy azure-mgmt-compute SDK call path to an AAZ-based implementation in the VM command module.
Changes:
- Switch
restart_vmssimplementation to invoke the generated AAZvmss.Restartcommand. - Move
vmss restartcommand registration to the non-SDKvmsscommand group (still using the same custom entrypoint). - Add the generated AAZ implementation for VMSS restart and export it via the
vmssAAZ package init.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
src/azure-cli/azure/cli/command_modules/vm/custom.py |
Replaces SDK-based restart with AAZ command invocation. |
src/azure-cli/azure/cli/command_modules/vm/commands.py |
Re-registers vmss restart under the custom (non-SDK) vmss command group. |
src/azure-cli/azure/cli/command_modules/vm/aaz/latest/vmss/_restart.py |
Adds generated AAZ REST operation for VMSS restart. |
src/azure-cli/azure/cli/command_modules/vm/aaz/latest/vmss/__init__.py |
Exposes the new Restart AAZ command via package exports. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if instance_ids is None: | ||
| instance_ids = ['*'] | ||
| instance_ids = VirtualMachineScaleSetVMInstanceRequiredIDs(instance_ids=instance_ids) | ||
| return sdk_no_wait(no_wait, client.virtual_machine_scale_sets.begin_restart, resource_group_name, vm_scale_set_name, | ||
| vm_instance_i_ds=instance_ids) | ||
|
|
||
| command_args = { | ||
| 'resource_group': resource_group_name, | ||
| 'vm_scale_set_name': vm_scale_set_name, | ||
| 'instance_ids': instance_ids, |
There was a problem hiding this comment.
restart_vmss forces instance_ids to ['*'] when the user doesn't provide --instance-ids. In the new AAZ implementation, omitting instanceIds is already defined as “apply to all VMs”, so always sending ['*'] needlessly diverges from the AAZ contract and risks sending a value the service/API version doesn't accept. Consider leaving instance_ids as None when not specified (and optionally translating an explicit * to omission as well), so the request body can omit instanceIds for the all-instances case.
Related command
az vmss restartDescription
Migration from mgmt.compute to aaz-based
aaz Azure/aaz#947
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.