Skip to content

{Compute} az vmss diagnostics: Migrate command group to aaz-based implementation#32921

Merged
yanzhudd merged 3 commits intoAzure:devfrom
william051200:vmss-diagnostics-migration
Apr 10, 2026
Merged

{Compute} az vmss diagnostics: Migrate command group to aaz-based implementation#32921
yanzhudd merged 3 commits intoAzure:devfrom
william051200:vmss-diagnostics-migration

Conversation

@william051200
Copy link
Copy Markdown
Member

Related command

az vmss diagnostics set
az vmss diagnostics get-default-config

Description

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.

Copilot AI review requested due to automatic review settings March 6, 2026 00:23
@azure-client-tools-bot-prd
Copy link
Copy Markdown

azure-client-tools-bot-prd bot commented Mar 6, 2026

️✔️AzureCLI-FullTest
️✔️acr
️✔️latest
️✔️3.12
️✔️3.13
️✔️acs
️✔️latest
️✔️3.12
️✔️3.13
️✔️advisor
️✔️latest
️✔️3.12
️✔️3.13
️✔️ams
️✔️latest
️✔️3.12
️✔️3.13
️✔️apim
️✔️latest
️✔️3.12
️✔️3.13
️✔️appconfig
️✔️latest
️✔️3.12
️✔️3.13
️✔️appservice
️✔️latest
️✔️3.12
️✔️3.13
️✔️aro
️✔️latest
️✔️3.12
️✔️3.13
️✔️backup
️✔️latest
️✔️3.12
️✔️3.13
️✔️batch
️✔️latest
️✔️3.12
️✔️3.13
️✔️batchai
️✔️latest
️✔️3.12
️✔️3.13
️✔️billing
️✔️latest
️✔️3.12
️✔️3.13
️✔️botservice
️✔️latest
️✔️3.12
️✔️3.13
️✔️cdn
️✔️latest
️✔️3.12
️✔️3.13
️✔️cloud
️✔️latest
️✔️3.12
️✔️3.13
️✔️cognitiveservices
️✔️latest
️✔️3.12
️✔️3.13
️✔️compute_recommender
️✔️latest
️✔️3.12
️✔️3.13
️✔️computefleet
️✔️latest
️✔️3.12
️✔️3.13
️✔️config
️✔️latest
️✔️3.12
️✔️3.13
️✔️configure
️✔️latest
️✔️3.12
️✔️3.13
️✔️consumption
️✔️latest
️✔️3.12
️✔️3.13
️✔️container
️✔️latest
️✔️3.12
️✔️3.13
️✔️containerapp
️✔️latest
️✔️3.12
️✔️3.13
️✔️core
️✔️latest
️✔️3.12
️✔️3.13
️✔️cosmosdb
️✔️latest
️✔️3.12
️✔️3.13
️✔️databoxedge
️✔️latest
️✔️3.12
️✔️3.13
️✔️dls
️✔️latest
️✔️3.12
️✔️3.13
️✔️dms
️✔️latest
️✔️3.12
️✔️3.13
️✔️eventgrid
️✔️latest
️✔️3.12
️✔️3.13
️✔️eventhubs
️✔️latest
️✔️3.12
️✔️3.13
️✔️feedback
️✔️latest
️✔️3.12
️✔️3.13
️✔️find
️✔️latest
️✔️3.12
️✔️3.13
️✔️hdinsight
️✔️latest
️✔️3.12
️✔️3.13
️✔️identity
️✔️latest
️✔️3.12
️✔️3.13
️✔️iot
️✔️latest
️✔️3.12
️✔️3.13
️✔️keyvault
️✔️latest
️✔️3.12
️✔️3.13
️✔️lab
️✔️latest
️✔️3.12
️✔️3.13
️✔️managedservices
️✔️latest
️✔️3.12
️✔️3.13
️✔️maps
️✔️latest
️✔️3.12
️✔️3.13
️✔️marketplaceordering
️✔️latest
️✔️3.12
️✔️3.13
️✔️monitor
️✔️latest
️✔️3.12
️✔️3.13
️✔️mysql
️✔️latest
️✔️3.12
️✔️3.13
️✔️netappfiles
️✔️latest
️✔️3.12
️✔️3.13
️✔️network
️✔️latest
️✔️3.12
️✔️3.13
️✔️policyinsights
️✔️latest
️✔️3.12
️✔️3.13
️✔️postgresql
️✔️latest
️✔️3.12
️✔️3.13
️✔️privatedns
️✔️latest
️✔️3.12
️✔️3.13
️✔️profile
️✔️latest
️✔️3.12
️✔️3.13
️✔️rdbms
️✔️latest
️✔️3.12
️✔️3.13
️✔️redis
️✔️latest
️✔️3.12
️✔️3.13
️✔️relay
️✔️latest
️✔️3.12
️✔️3.13
️✔️resource
️✔️latest
️✔️3.12
️✔️3.13
️✔️role
️✔️latest
️✔️3.12
️✔️3.13
️✔️search
️✔️latest
️✔️3.12
️✔️3.13
️✔️security
️✔️latest
️✔️3.12
️✔️3.13
️✔️servicebus
️✔️latest
️✔️3.12
️✔️3.13
️✔️serviceconnector
️✔️latest
️✔️3.12
️✔️3.13
️✔️servicefabric
️✔️latest
️✔️3.12
️✔️3.13
️✔️signalr
️✔️latest
️✔️3.12
️✔️3.13
️✔️sql
️✔️latest
️✔️3.12
️✔️3.13
️✔️sqlvm
️✔️latest
️✔️3.12
️✔️3.13
️✔️storage
️✔️latest
️✔️3.12
️✔️3.13
️✔️synapse
️✔️latest
️✔️3.12
️✔️3.13
️✔️telemetry
️✔️latest
️✔️3.12
️✔️3.13
️✔️util
️✔️latest
️✔️3.12
️✔️3.13
️✔️vm
️✔️latest
️✔️3.12
️✔️3.13

@azure-client-tools-bot-prd
Copy link
Copy Markdown

azure-client-tools-bot-prd bot commented Mar 6, 2026

❌AzureCLI-BreakingChangeTest
❌acs
rule cmd_name rule_message suggest_message
1010 - ParaPropUpdate aks nodepool add cmd aks nodepool add update parameter spot_max_price: updated property default from nan to nan please change property default from nan to nan for parameter spot_max_price of cmd aks nodepool add
⚠️ 1010 - ParaPropUpdate aks create cmd aks create update parameter os_sku: updated property choices from ['AzureContainerLinux', 'AzureLinux', 'AzureLinux3', 'CBLMariner', 'Mariner', 'Ubuntu', 'Ubuntu2204', 'Ubuntu2404'] to ['AzureLinux', 'AzureLinux3', 'CBLMariner', 'Mariner', 'Ubuntu', 'Ubuntu2204', 'Ubuntu2404']
⚠️ 1010 - ParaPropUpdate aks nodepool add cmd aks nodepool add update parameter os_sku: updated property choices from ['AzureContainerLinux', 'AzureLinux', 'AzureLinux3', 'CBLMariner', 'Mariner', 'Ubuntu', 'Ubuntu2204', 'Ubuntu2404', 'Windows2019', 'Windows2022'] to ['AzureLinux', 'AzureLinux3', 'CBLMariner', 'Mariner', 'Ubuntu', 'Ubuntu2204', 'Ubuntu2404', 'Windows2019', 'Windows2022']
⚠️ 1010 - ParaPropUpdate aks nodepool update cmd aks nodepool update update parameter os_sku: updated property choices from ['AzureContainerLinux', 'AzureLinux', 'AzureLinux3', 'Ubuntu', 'Ubuntu2204', 'Ubuntu2404'] to ['AzureLinux', 'AzureLinux3', 'Ubuntu', 'Ubuntu2204', 'Ubuntu2404']
❌network
rule cmd_name rule_message suggest_message
1002 - CmdRemove network express-route get-link-failover-all-tests-detail cmd network express-route get-link-failover-all-tests-detail removed please confirm cmd network express-route get-link-failover-all-tests-detail removed
1002 - CmdRemove network express-route get-link-failover-single-test-detail cmd network express-route get-link-failover-single-test-detail removed please confirm cmd network express-route get-link-failover-single-test-detail removed
1002 - CmdRemove network express-route start-link-failover-test cmd network express-route start-link-failover-test removed please confirm cmd network express-route start-link-failover-test removed
1002 - CmdRemove network express-route stop-link-failover-test cmd network express-route stop-link-failover-test removed please confirm cmd network express-route stop-link-failover-test removed

Please submit your Breaking Change Pre-announcement ASAP if you haven't already. Please note:

  • Breaking changes can only be merged during the designated breaking change window
  • A pre-announcement must be released at least one month in advance

For more details on how to introduce breaking changes, refer to the documentation: azure-cli/doc/how_to_introduce_breaking_changes.md

@yonzhan
Copy link
Copy Markdown
Collaborator

yonzhan commented Mar 6, 2026

Thank you for your contribution! We will review the pull request and get back to you soon.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 6, 2026

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).
After that please run the following commands to enable git hooks:

pip install azdev --upgrade
azdev setup -c <your azure-cli repo path> -r <your azure-cli-extensions repo path>

Copy link
Copy Markdown
Contributor

Copilot AI left a 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 the az vmss diagnostics command group (set / get-default-config) from the mgmt.compute SDK-backed command group registration to an AAZ-based registration, and updates the VMSS diagnostics extension setter to fetch VMSS via AAZ.

Changes:

  • Register vmss diagnostics without the compute_vmss_sdk command type (AAZ migration pattern).
  • Update set_vmss_diagnostics_extension to retrieve VMSS via get_vmss_by_aaz and use _is_linux_os_aaz for OS detection.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/azure-cli/azure/cli/command_modules/vm/custom.py Switch VMSS retrieval to AAZ and adjust VMSS dict access paths for diagnostics extension logic.
src/azure-cli/azure/cli/command_modules/vm/commands.py Move vmss diagnostics command group registration off the SDK command type to support AAZ-based implementation.
Comments suppressed due to low confidence (1)

src/azure-cli/azure/cli/command_modules/vm/custom.py:5120

  • exts comes from VMSSShow (AAZ) and is a list of dicts, but the incompatibility check uses attribute access (e.name, e.type_handler_version). This will raise AttributeError at runtime and the check will never work. Update the predicate to use dict keys (e.g. e.get('name') and e.get('typeHandlerVersion') for the camelCase VMSSShow output, or convert to snake_case first and then use type_handler_version).
        major_ver = extension_mappings[_LINUX_DIAG_EXT]['version'].split('.', maxsplit=1)[0]
        # For VMSS, we don't do auto-removal like VM because there is no reliable API to wait for
        # the removal done before we can install the newer one
        if next((e for e in exts if e.name == _LINUX_DIAG_EXT and
                 not e.type_handler_version.startswith(major_ver + '.')), None):

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

result = LongRunningOperation(cmd.cli_ctx)(poller)
UpgradeMode = cmd.get_models('UpgradeMode')
if vmss.upgrade_policy.mode == UpgradeMode.manual:
if vmss.get('upgradePolicy', {}).get('upgradePolicy') == UpgradeMode.MANUAL.value:
Copy link

Copilot AI Mar 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The manual upgrade policy check is using vmss.get('upgradePolicy', {}).get('upgradePolicy'), but the VMSS model has upgradePolicy.mode (and this file already uses .get('mode') elsewhere). As written, this condition will never be true, so instances won’t be updated for manual upgrade mode. Use vmss.get('upgradePolicy', {}).get('mode') == UpgradeMode.MANUAL.value (camelCase output) instead.

Suggested change
if vmss.get('upgradePolicy', {}).get('upgradePolicy') == UpgradeMode.MANUAL.value:
if vmss.get('upgradePolicy', {}).get('mode') == UpgradeMode.MANUAL.value:

Copilot uses AI. Check for mistakes.
@william051200
Copy link
Copy Markdown
Member Author

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 3 pipeline(s).

@william051200
Copy link
Copy Markdown
Member Author

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 3 pipeline(s).

Copy link
Copy Markdown

@JaysonTaiMicrosoft JaysonTaiMicrosoft left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me 👍 Would be a good idea for one of the other code owners to also take a look.

@yanzhudd
Copy link
Copy Markdown
Contributor

yanzhudd commented Apr 8, 2026

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 3 pipeline(s).

@yanzhudd yanzhudd merged commit b7ac2f9 into Azure:dev Apr 10, 2026
52 checks passed
@william051200 william051200 deleted the vmss-diagnostics-migration branch April 10, 2026 06:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

act-observability-squad Auto-Assign Auto assign by bot Compute az vm/vmss/image/disk/snapshot

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants