{Compute} az vmss disk: Migrate command group to aaz-based implementation#32858
{Compute} az vmss disk: Migrate command group to aaz-based implementation#32858william051200 wants to merge 4 commits intoAzure:devfrom
az vmss disk: Migrate command group to aaz-based implementation#32858Conversation
❌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
This pull request migrates the az vmss disk command group from SDK-based implementation to AAZ (Azure-CLI AutoRest) based implementation, specifically covering the attach and detach subcommands. This migration aligns with the broader effort to standardize Azure CLI commands using AAZ-generated code instead of manually maintained SDK clients.
Changes:
- Migrated
attach_managed_data_disk_to_vmssfunction to use AAZ commands (VMSSCreate, VMSSVMSShow, VMSSVMSCreate) instead of SDK clients - Migrated
detach_disk_from_vmssfunction to use AAZ commands with dictionary-based data structures - Removed SDK operation group and min_api constraint from command registration in commands.py
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/azure-cli/azure/cli/command_modules/vm/custom.py | Refactored attach_managed_data_disk_to_vmss and detach_disk_from_vmss functions to use AAZ commands with dictionary-based data structures instead of SDK objects, properly handling camelCase to snake_case conversion |
| src/azure-cli/azure/cli/command_modules/vm/commands.py | Removed SDK client reference and API version constraint from vmss disk command group registration |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| vmss_vm.storage_profile.image_reference = None | ||
| _init_data_disk(vmss_vm.storage_profile, lun, disk) | ||
| return client.virtual_machine_scale_set_vms.begin_update(resource_group_name, vmss_name, instance_id, vmss_vm) | ||
| vmss_vm['storageProfile']['imageReference'] = None |
There was a problem hiding this comment.
| vmss_vm['storageProfile']['imageReference'] = None | |
| if "storageProfile" not in vmss_vm: | |
| vmss_vm['storageProfile'] = {} | |
| vmss_vm['storageProfile']['imageReference'] = None |
| vmss = get_vmss_by_aaz(cmd, resource_group_name, vmss_name) | ||
| # Avoid unnecessary permission error | ||
| vmss.virtual_machine_profile.storage_profile.image_reference = None | ||
| vmss['virtualMachineProfile']['storageProfile']['imageReference'] = None |
There was a problem hiding this comment.
| vmss['virtualMachineProfile']['storageProfile']['imageReference'] = None | |
| if 'virtualMachineProfile' not in vmss: | |
| vmss['virtualMachineProfile'] = {} | |
| if 'storageProfile' not in vmss['virtualMachineProfile']: | |
| vmss['virtualMachineProfile']['storageProfile'] = {} | |
| vmss['virtualMachineProfile']['storageProfile']['imageReference'] = None |
There was a problem hiding this comment.
please ensure the parent layer exists in the dictionaries, otherwise, it may result in an exception.
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
Related command
az vmss disk attachaz vmss disk detachDescription
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.