Skip to content

az cli disk update PATCH command #30829

@TDread

Description

@TDread

Preconditions

  • No need to upgrade Python SDK or the Python SDK is ready.

Related command

az disk update --size

Resource Provider

Micxrosoft.Compute/Disks

Description of Feature or Work Requested

Currently if you use the az disk update --size against a disk that was created by azure backup. Then that operation will fail with a permissions issue if the user trying to use it does not have permission to the restore point referenced in the JSON of the disks's createdData. This is an issue with the PowerShell method of doing this as well, since they both use a PUT method and include the createdData with the PUT method.

If you only have Virtual Machine Contributor role as your RBAC and you perform a disk size change from lets say 500GB to 512GB this will work regardless on how the disk was created because it is using a PATCH method.

But if you use Azure CLI or Azure PowerShell, they both use a PUT Method. With Azure PowerShell, there is a workaround New-AzDiskUpdateConfig -DiskSizeGB 512 | Update-AzDisk -ResourceGroupName $rgName -DiskName $diskName

If you use the REST API to update the disk size then this will work, since that is only supplying the diskSizeGB parameter.

Minimum API Version Required

2023-04-02

Swagger PR link / SDK link

https://learn.microsoft.com/en-us/rest/api/compute/disks/update?view=rest-compute-2023-04-02&tabs=HTTP

Request Example

PATCH https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk?api-version=2023-04-02

{
"properties": {
"diskSizeGB": 1024
}
}

Target Date

2025-03-16

PM Contact

zhoxing

Engineer Contact

thomasdread

Additional context

This originated from an issue reported that was then brought to our internal teams and I was asked to create this effort to best handle. I have the full 241 line --debug output of the azure CLI if that is needed as well.

Metadata

Metadata

Labels

Auto-AssignAuto assign by botAzure CLI TeamThe command of the issue is owned by Azure CLI teamComputeaz vm/vmss/image/disk/snapshotcustomer-reportedIssues that are reported by GitHub users external to the Azure organization.feature-request

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions