Skip to content

[Compute] az vm availability-set: Add new commands to support migration from availability sets to VMSS#32180

Merged
zhoxing-ms merged 2 commits intoAzure:devfrom
Jing-song:jins-avsetmigration
Sep 28, 2025
Merged

[Compute] az vm availability-set: Add new commands to support migration from availability sets to VMSS#32180
zhoxing-ms merged 2 commits intoAzure:devfrom
Jing-song:jins-avsetmigration

Conversation

@Jing-song
Copy link
Copy Markdown
Contributor

@Jing-song Jing-song commented Sep 26, 2025

Related command

az vm availability-set

Description

Add new commands to support migration from availability sets to VMSS
close #31867
aaz model: Azure/aaz#865

Testing Guide

History Notes

[Compute] az vm availability-set: Add new command validate-migration-to-vmss to support validating migration from availability sets to VMSS
[Compute] az vm availability-set: Add new command start-migration-to-vmss to support starting migration from availability sets to VMSS
[Compute] az vm availability-set: Add new command cancel-migration-to-vmss to support canceling migration from availability sets to VMSS
[Compute] az vm availability-set: Add new command convert-to-vmss to support converting availability sets to VMSS
[Compute] az vm: Add new command migrate-to-vmss to support migratiing VM to VMSS


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 September 26, 2025 08:07
@azure-client-tools-bot-prd
Copy link
Copy Markdown

azure-client-tools-bot-prd bot commented Sep 26, 2025

️✔️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
️✔️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

Hi @Jing-song,
Since the current milestone time is less than 7 days, this pr will be reviewed in the next milestone.

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

azure-client-tools-bot-prd bot commented Sep 26, 2025

⚠️AzureCLI-BreakingChangeTest
⚠️vm
rule cmd_name rule_message suggest_message
⚠️ 1001 - CmdAdd vm availability-set cancel-migration-to-vmss cmd vm availability-set cancel-migration-to-vmss added
⚠️ 1001 - CmdAdd vm availability-set convert-to-vmss cmd vm availability-set convert-to-vmss added
⚠️ 1001 - CmdAdd vm availability-set start-migration-to-vmss cmd vm availability-set start-migration-to-vmss added
⚠️ 1001 - CmdAdd vm availability-set validate-migration-to-vmss cmd vm availability-set validate-migration-to-vmss added
⚠️ 1001 - CmdAdd vm migrate-to-vmss cmd vm migrate-to-vmss added

@yonzhan
Copy link
Copy Markdown
Collaborator

yonzhan commented Sep 26, 2025

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

@github-actions
Copy link
Copy Markdown

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

This PR adds new commands to the Azure CLI vm availability-set module to support migration from availability sets to Virtual Machine Scale Sets (VMSS). The implementation includes validation, start, cancel, and convert operations for migrating VMs from availability sets to flexible VMSS.

Key changes:

  • Added four new availability-set commands for VMSS migration operations
  • Added one new VM command for individual VM migration to VMSS
  • Added comprehensive test coverage for the migration workflows

Reviewed Changes

Copilot reviewed 8 out of 9 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
test_vm_commands.py Added test case covering all new migration commands and workflows
_validate_migration_to_vmss.py Command to validate migration feasibility from availability set to VMSS
_start_migration_to_vmss.py Command to start migration operation from availability set to VMSS
_convert_to_vmss.py Command to create new VMSS and migrate all VMs without downtime
_cancel_migration_to_vmss.py Command to cancel an ongoing migration operation
_migrate_to_vmss.py Command for individual VM migration from availability set to VMSS
availability_set/init.py Updated to export the new migration command modules
vm/init.py Updated to export the new VM migration command module

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment on lines +14 to +19
@register_command(
"vm availability-set start-migration-to-vmss",
)
class StartMigrationToVmss(AAZCommand):
"""Start migration operation on an Availability Set to move its Virtual Machines to a Virtual Machine Scale Set. This should be followed by a migrate operation on each Virtual Machine that triggers a downtime on the Virtual Machine.
"""
Copy link

Copilot AI Sep 26, 2025

Choose a reason for hiding this comment

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

This command performs a dangerous operation (migration) that could break or affect resources. According to coding guidelines, dangerous operations should include the confirmation=True flag to require user confirmation before execution.

Copilot uses AI. Check for mistakes.
Comment on lines +14 to +19
@register_command(
"vm availability-set cancel-migration-to-vmss",
)
class CancelMigrationToVmss(AAZCommand):
"""Cancel the migration operation on an Availability Set.
"""
Copy link

Copilot AI Sep 26, 2025

Choose a reason for hiding this comment

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

This command performs a dangerous operation (cancel migration) that could affect ongoing migration processes. According to coding guidelines, dangerous operations should include the confirmation=True flag to require user confirmation before execution.

Copilot uses AI. Check for mistakes.
Comment on lines +14 to +19
@register_command(
"vm availability-set convert-to-vmss",
)
class ConvertToVmss(AAZCommand):
"""Create a new Flexible Virtual Machine Scale Set and migrate all the Virtual Machines in the Availability Set. This does not trigger a downtime on the Virtual Machines.
"""
Copy link

Copilot AI Sep 26, 2025

Choose a reason for hiding this comment

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

This command performs a dangerous operation (convert/migrate) that will permanently change the infrastructure setup. According to coding guidelines, dangerous operations should include the confirmation=True flag to require user confirmation before execution.

Copilot uses AI. Check for mistakes.
Comment on lines +14 to +19
@register_command(
"vm migrate-to-vmss",
)
class MigrateToVmss(AAZCommand):
"""Migrate a virtual machine from availability set to Flexible Virtual Machine Scale Set.
"""
Copy link

Copilot AI Sep 26, 2025

Choose a reason for hiding this comment

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

This command performs a dangerous operation (migrate VM) that will permanently change the VM's infrastructure setup and could potentially cause downtime. According to coding guidelines, dangerous operations should include the confirmation=True flag to require user confirmation before execution.

Copilot uses AI. Check for mistakes.
@zhoxing-ms zhoxing-ms merged commit b804a0e into Azure:dev Sep 28, 2025
48 checks passed
@Jing-song Jing-song deleted the jins-avsetmigration branch October 10, 2025 06:21
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support for new CRP API in CLI

5 participants