Skip to content

{Compute} az vm install-patches: Migrate command to aaz-based implementation#32763

Open
william051200 wants to merge 5 commits intoAzure:devfrom
william051200:vm-install-patches-migration
Open

{Compute} az vm install-patches: Migrate command to aaz-based implementation#32763
william051200 wants to merge 5 commits intoAzure:devfrom
william051200:vm-install-patches-migration

Conversation

@william051200
Copy link
Member

Related command

az vm install-patches

Description

Migration from mgmt.compute to aaz-based

aaz Azure/aaz#941

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 February 10, 2026 01:46
@azure-client-tools-bot-prd
Copy link

azure-client-tools-bot-prd bot commented Feb 10, 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

azure-client-tools-bot-prd bot commented Feb 10, 2026

️✔️AzureCLI-BreakingChangeTest
️✔️Non Breaking Changes

@yonzhan
Copy link
Collaborator

yonzhan commented Feb 10, 2026

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

@github-actions
Copy link

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
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 az vm install-patches from the mgmt-plane azure-mgmt-compute implementation to an AAZ-based implementation within the VM command module.

Changes:

  • Replaced the existing client.begin_install_patches(...) path with a wrapper that invokes the generated AAZ InstallPatches command.
  • Updated command registration for vm install-patches to no longer require an SDK client factory.
  • Added VM guest patching enums to _vm_utils.py and switched argument enum sources in _params.py.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/azure-cli/azure/cli/command_modules/vm/custom.py Replaces the SDK-based implementation with an AAZ command invocation wrapper.
src/azure-cli/azure/cli/command_modules/vm/commands.py Re-registers vm install-patches under a command group that doesn’t inject an SDK client.
src/azure-cli/azure/cli/command_modules/vm/aaz/latest/vm/_install_patches.py Adds the generated AAZ command implementation for vm install-patches.
src/azure-cli/azure/cli/command_modules/vm/aaz/latest/vm/__init__.py Exposes the new generated AAZ InstallPatches command via package imports.
src/azure-cli/azure/cli/command_modules/vm/_vm_utils.py Adds local enums for reboot setting and patch classifications.
src/azure-cli/azure/cli/command_modules/vm/_params.py Switches argument enums for vm install-patches to the new local enums.

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

from .aaz.latest.vm import Update as UpdateVM

from .generated.custom import * # noqa: F403, pylint: disable=unused-wildcard-import,wildcard-import
from ..resource.commands import resource_privatelinksassociation_sdk
Copy link

Copilot AI Feb 10, 2026

Choose a reason for hiding this comment

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

resource_privatelinksassociation_sdk is imported but not used anywhere in this module. This will trigger unused-import linting and adds unnecessary coupling to the resource module; please remove the import (or use it if it was intended).

Suggested change
from ..resource.commands import resource_privatelinksassociation_sdk

Copilot uses AI. Check for mistakes.
Comment on lines 307 to 308
with self.command_group('vm') as g:
g.custom_command('install-patches', 'install_vm_patches', supports_no_wait=True)
Copy link

Copilot AI Feb 10, 2026

Choose a reason for hiding this comment

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

The command registration removed min_api (previously 2020-12-01). Since the new implementation calls the AAZ operation with a fixed Compute api-version (2024-11-01), the command can become available in profiles/clouds that don't support that API version and then fail at runtime. Please add an appropriate min_api gate here (ideally matching the AAZ operation version you are using) to preserve the previous availability behavior.

Copilot uses AI. Check for mistakes.
@william051200 william051200 changed the title {Compute} az vm install-patches: Migrate command to aaz-based implementation {Compute} az vm install-patches: Migrate command to aaz-based implementation Feb 10, 2026
@william051200
Copy link
Member Author

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@yanzhudd
Copy link
Contributor

please resolve the code conflict


@register_command(
"vm install-patches",
)
Copy link
Contributor

Choose a reason for hiding this comment

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

if the command would still be defined in commands.py file after migrating the implementation to aaz-based, it would be better to unregister the command in the generated aaz file

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Auto-Assign Auto assign by bot Compute az vm/vmss/image/disk/snapshot Installation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants