Skip to content

[Compute] az vm disk attach: Add support for setting disk size and sku of implicit disk creation from snapshot and disk restore points#31862

Merged
zhoxing-ms merged 4 commits intoAzure:devfrom
Jing-song:jins-disksizesku
Jul 25, 2025
Merged

[Compute] az vm disk attach: Add support for setting disk size and sku of implicit disk creation from snapshot and disk restore points#31862
zhoxing-ms merged 4 commits intoAzure:devfrom
Jing-song:jins-disksizesku

Conversation

@Jing-song
Copy link
Copy Markdown
Contributor

Related command

az vm disk attach

Description

Add support for setting disk size and sku of implicit disk creation from snapshot and disk restore points

Testing Guide

History Notes

[Component Name 1] BREAKING CHANGE: az command a: Make some customer-facing breaking change
[Component Name 2] az command b: Add some customer-facing feature


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 July 23, 2025 10:03
@azure-client-tools-bot-prd
Copy link
Copy Markdown

azure-client-tools-bot-prd bot commented Jul 23, 2025

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

@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 Jul 23, 2025

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

@yonzhan
Copy link
Copy Markdown
Collaborator

yonzhan commented Jul 23, 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 enhances the az vm disk attach command to support setting disk size and SKU parameters when implicitly creating disks from snapshots and disk restore points. Previously, these parameters were only supported for creating new empty disks, but this change extends the functionality to handle copy and restore operations.

  • Adds size_gb and sku parameter support for disk creation from snapshots and restore points
  • Updates test cases to validate the new functionality with size and SKU verification
  • Modifies the disk attachment logic to handle size and SKU specification for copy and restore operations

Reviewed Changes

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

File Description
src/azure-cli/azure/cli/command_modules/vm/custom.py Enhanced attach_managed_data_disk function to support size and SKU parameters for copy and restore operations
src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_vm_commands.py Updated test case to verify size and SKU functionality for disk attachment from snapshots and restore points

"managedDisk": {
"storageAccountType": sku,
}
})
Copy link

Copilot AI Jul 23, 2025

Choose a reason for hiding this comment

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

Inconsistent indentation detected. This line uses 9 spaces for indentation instead of multiples of 4 spaces.

Copilot uses AI. Check for mistakes.
disk.update({
'sizeGb': size_gb
})
if sku is not None:
Copy link

Copilot AI Jul 23, 2025

Choose a reason for hiding this comment

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

Inconsistent indentation detected. This line uses 5 spaces for indentation instead of the required 4 spaces.

Copilot uses AI. Check for mistakes.
'sizeGb': size_gb
})
if sku is not None:
disk.update({
Copy link

Copilot AI Jul 23, 2025

Choose a reason for hiding this comment

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

Inconsistent indentation detected. This line uses 9 spaces for indentation instead of multiples of 4 spaces.

Copilot uses AI. Check for mistakes.
if sku is not None:
disk.update({
"managedDisk": {
"storageAccountType": sku,
Copy link

Copilot AI Jul 23, 2025

Choose a reason for hiding this comment

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

Inconsistent indentation detected. This line uses 17 spaces for indentation instead of multiples of 4 spaces.

Copilot uses AI. Check for mistakes.
@Jing-song Jing-song changed the title [Compute] az vm disk attach: Add support for setting disk size and sku of implicit disk creation from snapshot and disk restore points [Compute] az vm disk attach: Add support for setting disk size and sku of implicit disk creation from snapshot and disk restore points Jul 23, 2025
@Jing-song Jing-song changed the title [Compute] az vm disk attach: Add support for setting disk size and sku of implicit disk creation from snapshot and disk restore points [Compute] az vm disk attach: Add support for setting disk size and sku of implicit disk creation from snapshot and disk restore points Jul 23, 2025
@Azure Azure deleted a comment from Copilot AI Jul 23, 2025
@Azure Azure deleted a comment from Copilot AI Jul 23, 2025
@Azure Azure deleted a comment from Copilot AI Jul 23, 2025
@Azure Azure deleted a comment from Copilot AI Jul 23, 2025
@Azure Azure deleted a comment from Copilot AI Jul 23, 2025
@Azure Azure deleted a comment from Copilot AI Jul 23, 2025
@Azure Azure deleted a comment from Copilot AI Jul 23, 2025
@Azure Azure deleted a comment from Copilot AI Jul 23, 2025
@Azure Azure deleted a comment from Copilot AI Jul 23, 2025
@Azure Azure deleted a comment from Copilot AI Jul 23, 2025
@zhoxing-ms zhoxing-ms merged commit 13a94a6 into Azure:dev Jul 25, 2025
48 checks passed
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.

5 participants