-
Notifications
You must be signed in to change notification settings - Fork 3.3k
{Compute} az vm diagnostics: Migrate command group to aaz-based implementation
#32765
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Conversation
❌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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Migrates az vm diagnostics set from the mgmt.compute SDK-based implementation to an AAZ-based implementation, aligning this command group with ongoing AAZ migration work in the vm module.
Changes:
- Update
set_diagnostics_extensionto use AAZVMShowoutput (get_instance_view) and AAZvm extension deletewhen removing incompatible diagnostics extensions. - Switch extension instance-view parsing to dict/key-based access patterns.
- Remove the
compute_vm_sdkbinding from thevm diagnosticscommand group registration.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
src/azure-cli/azure/cli/command_modules/vm/custom.py |
Reworks set_diagnostics_extension to use AAZ VM show output + AAZ extension delete for incompatible versions. |
src/azure-cli/azure/cli/command_modules/vm/commands.py |
Registers vm diagnostics command group without the mgmt.compute SDK command type. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| poller = VmExtentionDelete(cmd.cli_ctx)(command_args={ | ||
| 'resource_group': resource_group_name, |
Copilot
AI
Feb 10, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AAZ command classes in this file are instantiated with the cli_ctx= keyword (e.g., EnableBootDiagnostics(cli_ctx=cmd.cli_ctx)). Here VmExtentionDelete(cmd.cli_ctx) passes cli_ctx positionally; please align with the established pattern to avoid breakage if the constructor signature changes and to keep the style consistent.
| no_auto_upgrade=False): | ||
| from .aaz.latest.vm.extension import Delete as VmExtentionDelete | ||
| vm = get_instance_view(cmd, resource_group_name, vm_name) | ||
| is_linux_os = _is_linux_os_by_aaz(vm) |
Copilot
AI
Feb 10, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
get_instance_view returns an AAZ/VMShow result that uses camelCase keys (e.g., storageProfile, osProfile). _is_linux_os_by_aaz checks snake_case keys (storage_profile, os_profile), so this will mis-detect Linux VMs as Windows and select the wrong diagnostics extension. Use _is_linux_os_aaz(vm) here or convert the VM show result to snake_case before calling the helper.
| is_linux_os = _is_linux_os_by_aaz(vm) | |
| is_linux_os = _is_linux_os_aaz(vm) |
| from .aaz.latest.vm.extension import Delete as VmExtentionDelete | ||
| vm = get_instance_view(cmd, resource_group_name, vm_name) |
Copilot
AI
Feb 10, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo in the imported alias name VmExtentionDelete ("Extention" -> "Extension"). This makes the code harder to read/search and is inconsistent with the rest of the module naming.
Related command
az vm diagnostics setDescription
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.