az disk
Manage Azure Managed Disks.
Azure Virtual Machines use disks as a place to store an operating system, applications, and data. All Azure virtual machines have at least two disks: An operating system disk, and a temporary disk. The operating system disk is created from an image, and both the operating system disk and the image are actually virtual hard disks (VHDs) stored in an Azure storage account. Virtual machines also can have one or more data disks, that are also stored as VHDs. Azure Managed and Unmanaged Data Disks have a maximum size of 4095 GB (with the exception of larger disks in preview). Azure Unmanaged Disks also have a maximum capacity of 4095 GB. For more information, see:
- Azure Disks - https://docs.microsoft.com/azure/virtual-machines/linux/about-disks-and-vhds and https://docs.microsoft.com/azure/virtual-machines/windows/about-disks-and-vhds.
- Larger Managed Disks in Public Preview - https://azure.microsoft.com/blog/introducing-the-public-preview-of-larger-managed-disks-sizes/
- Ultra SSD Managed Disks in Public Preview - https://docs.microsoft.com/azure/virtual-machines/windows/disks-ultra-ssd.
Commands
az disk create |
Create a managed disk. |
az disk delete |
Delete a managed disk. |
az disk grant-access |
Grant a resource access to a managed disk. |
az disk list |
List managed disks. |
az disk revoke-access |
Revoke a resource's read access to a managed disk. |
az disk show |
Gets information about a disk. |
az disk update |
Update a managed disk. |
az disk wait |
Place the CLI in a waiting state until a condition of a managed disk is met. |
az disk create
Create a managed disk.
az disk create --name
--resource-group
[--disk-access]
[--disk-encryption-set]
[--disk-iops-read-only]
[--disk-iops-read-write]
[--disk-mbps-read-only]
[--disk-mbps-read-write]
[--edge-zone]
[--enable-bursting {false, true}]
[--encryption-type {EncryptionAtRestWithCustomerKey, EncryptionAtRestWithPlatformAndCustomerKeys, EncryptionAtRestWithPlatformKey}]
[--for-upload {false, true}]
[--gallery-image-reference]
[--gallery-image-reference-lun]
[--hyper-v-generation {V1, V2}]
[--image-reference]
[--image-reference-lun]
[--location]
[--logical-sector-size]
[--max-shares]
[--network-access-policy {AllowAll, AllowPrivate, DenyAll}]
[--no-wait]
[--os-type {Linux, Windows}]
[--size-gb]
[--sku {Premium_LRS, Premium_ZRS, StandardSSD_LRS, StandardSSD_ZRS, Standard_LRS, UltraSSD_LRS}]
[--source]
[--source-storage-account-id]
[--subscription]
[--tags]
[--tier]
[--upload-size-bytes]
[--zone {1, 2, 3}]
Examples
Create a managed disk by importing from a blob uri.
az disk create -g MyResourceGroup -n MyDisk --source https://vhd1234.blob.core.windows.net/vhds/osdisk1234.vhd
Create an empty managed disk.
az disk create -g MyResourceGroup -n MyDisk --size-gb 10
Create an empty managed disk with bursting enabled.
az disk create -g MyResourceGroup -n MyDisk --size-gb 1024 --location centraluseuap --enable-bursting
Create a managed disk by copying an existing disk or snapshot.
az disk create -g MyResourceGroup -n MyDisk2 --source MyDisk
Create a disk in an availability zone in the region of "East US 2"
az disk create -g MyResourceGroup -n MyDisk --size-gb 10 --location eastus2 --zone 1
Create a disk from image.
az disk create -g MyResourceGroup -n MyDisk --image-reference Canonical:UbuntuServer:18.04-LTS:18.04.202002180
Create a disk from gallery image.
az disk create -g MyResourceGroup -n MyDisk --gallery-image-reference $id
Create a disk with total number of IOPS and total throughput (MBps) limitation.
az disk create -g MyResourceGroup -n MyDisk --size-gb 10 --sku UltraSSD_LRS --disk-iops-read-only 200 --disk-mbps-read-only 30
Create a disk and specify maximum number of VMs that can attach to the disk at the same time.
az disk create -g MyResourceGroup -n MyDisk --size-gb 256 --max-shares 2 -l centraluseuap
Create a disk and associate it with a disk access resource.
az disk create -g MyResourceGroup -n MyDisk --size-gb 10 --network-access-policy AllowPrivate --disk-access MyDiskAccessID
Required Parameters
The name of the managed disk.
Name of resource group. You can configure the default group using az configure --defaults group=<name>
.
Optional Parameters
Name or ID of the disk access resource for using private endpoints on disks.
Name or ID of disk encryption set that is used to encrypt the disk.
The total number of IOPS that will be allowed across all VMs mounting the shared disk as ReadOnly. One operation can transfer between 4k and 256k bytes.
The number of IOPS allowed for this disk. Only settable for UltraSSD disks. One operation can transfer between 4k and 256k bytes.
The total throughput (MBps) that will be allowed across all VMs mounting the shared disk as ReadOnly. MBps means millions of bytes per second - MB here uses the ISO notation, of powers of 10.
The bandwidth allowed for this disk. Only settable for UltraSSD disks. MBps means millions of bytes per second with ISO notation of powers of 10.
Name of edge zone extended location.
Enable bursting beyond the provisioned performance target of the disk. Bursting is disabled by default, and it does not apply to Ultra disks.
Encryption type. EncryptionAtRestWithPlatformKey: Disk is encrypted with XStore managed key at rest. It is the default encryption type. EncryptionAtRestWithCustomerKey: Disk is encrypted with Customer managed key at rest.
Create the disk for uploading blobs later on through storage commands. Run "az disk grant-access --access-level Write" to retrieve the disk's SAS token.
ID of the shared galley image version from which to create a disk.
If the disk is created from an image's data disk, this is an index that indicates which of the data disks in the image to use. For OS disks, this field is null.
The hypervisor generation of the Virtual Machine. Applicable to OS disks only.
ID or URN (publisher:offer:sku:version) of the image from which to create a disk.
If the disk is created from an image's data disk, this is an index that indicates which of the data disks in the image to use. For OS disks, this field is null.
Location. Values from: az account list-locations
. You can configure the default location using az configure --defaults location=<location>
. If location is not specified and no default location specified, location will be automatically set as same as the resource group.
Logical sector size in bytes for Ultra disks. Supported values are 512 ad 4096. 4096 is the default.
The maximum number of VMs that can attach to the disk at the same time. Value greater than one indicates a disk that can be mounted on multiple VMs at the same time.
Policy for accessing the disk via network.
Do not wait for the long-running operation to finish.
The Operating System type of the Disk.
Size in GB. Max size: 4095 GB (certain preview disks can be larger).
Underlying storage SKU.
Source to create the disk/snapshot from, including unmanaged blob uri, managed disk id or name, or snapshot id or name.
Used when source blob is in a different subscription.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
Space-separated tags: key[=value] [key[=value] ...]. Use "" to clear existing tags.
Performance tier of the disk (e.g, P4, S10) as described here: https://azure.microsoft.com/en-us/pricing/details/managed-disks/. Does not apply to Ultra disks.
The size (in bytes) of the contents of the upload including the VHD footer. Min value: 20972032. Max value: 35183298347520.
Availability zone into which to provision the resource.
Increase logging verbosity to show all debug logs.
Show this help message and exit.
Only show errors, suppressing warnings.
Output format.
JMESPath query string. See http://jmespath.org/ for more information and examples.
Increase logging verbosity. Use --debug for full debug logs.
az disk delete
Delete a managed disk.
az disk delete [--ids]
[--name]
[--no-wait]
[--resource-group]
[--subscription]
[--yes]
Examples
Delete a managed disk. (autogenerated)
az disk delete --name MyManagedDisk --resource-group MyResourceGroup
Optional Parameters
One or more resource IDs (space-delimited). It should be a complete resource ID containing all information of 'Resource Id' arguments. You should provide either --ids or other 'Resource Id' arguments.
The name of the managed disk.
Do not wait for the long-running operation to finish.
Name of resource group. You can configure the default group using az configure --defaults group=<name>
.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
Do not prompt for confirmation.
Increase logging verbosity to show all debug logs.
Show this help message and exit.
Only show errors, suppressing warnings.
Output format.
JMESPath query string. See http://jmespath.org/ for more information and examples.
Increase logging verbosity. Use --debug for full debug logs.
az disk grant-access
Grant a resource access to a managed disk.
az disk grant-access --duration-in-seconds
[--access-level {Read, Write}]
[--ids]
[--name]
[--resource-group]
[--subscription]
Examples
Grant a resource read access to a managed disk. (autogenerated)
az disk grant-access --access-level Read --duration-in-seconds 3600 --name MyManagedDisk --resource-group MyResourceGroup
Required Parameters
Time duration in seconds until the SAS access expires.
Optional Parameters
Access level.
One or more resource IDs (space-delimited). It should be a complete resource ID containing all information of 'Resource Id' arguments. You should provide either --ids or other 'Resource Id' arguments.
The name of the managed disk.
Name of resource group. You can configure the default group using az configure --defaults group=<name>
.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
Increase logging verbosity to show all debug logs.
Show this help message and exit.
Only show errors, suppressing warnings.
Output format.
JMESPath query string. See http://jmespath.org/ for more information and examples.
Increase logging verbosity. Use --debug for full debug logs.
az disk list
List managed disks.
az disk list [--query-examples]
[--resource-group]
[--subscription]
Optional Parameters
Recommend JMESPath string for you. You can copy one of the query and paste it after --query parameter within double quotation marks to see the results. You can add one or more positional keywords so that we can give suggestions based on these key words.
Name of resource group. You can configure the default group using az configure --defaults group=<name>
.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
Increase logging verbosity to show all debug logs.
Show this help message and exit.
Only show errors, suppressing warnings.
Output format.
JMESPath query string. See http://jmespath.org/ for more information and examples.
Increase logging verbosity. Use --debug for full debug logs.
az disk revoke-access
Revoke a resource's read access to a managed disk.
az disk revoke-access [--ids]
[--name]
[--resource-group]
[--subscription]
Examples
Revoke a resource's read access to a managed disk. (autogenerated)
az disk revoke-access --ids $id
Revoke a resource's read access to a managed disk. (autogenerated)
az disk revoke-access --name MyManagedDisk --resource-group MyResourceGroup
Optional Parameters
One or more resource IDs (space-delimited). It should be a complete resource ID containing all information of 'Resource Id' arguments. You should provide either --ids or other 'Resource Id' arguments.
The name of the managed disk.
Name of resource group. You can configure the default group using az configure --defaults group=<name>
.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
Increase logging verbosity to show all debug logs.
Show this help message and exit.
Only show errors, suppressing warnings.
Output format.
JMESPath query string. See http://jmespath.org/ for more information and examples.
Increase logging verbosity. Use --debug for full debug logs.
az disk show
Gets information about a disk.
az disk show [--ids]
[--name]
[--query-examples]
[--resource-group]
[--subscription]
Optional Parameters
One or more resource IDs (space-delimited). It should be a complete resource ID containing all information of 'Resource Id' arguments. You should provide either --ids or other 'Resource Id' arguments.
The name of the managed disk.
Recommend JMESPath string for you. You can copy one of the query and paste it after --query parameter within double quotation marks to see the results. You can add one or more positional keywords so that we can give suggestions based on these key words.
Name of resource group. You can configure the default group using az configure --defaults group=<name>
.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
Increase logging verbosity to show all debug logs.
Show this help message and exit.
Only show errors, suppressing warnings.
Output format.
JMESPath query string. See http://jmespath.org/ for more information and examples.
Increase logging verbosity. Use --debug for full debug logs.
az disk update
Update a managed disk.
az disk update [--add]
[--disk-access]
[--disk-encryption-set]
[--disk-iops-read-only]
[--disk-iops-read-write]
[--disk-mbps-read-only]
[--disk-mbps-read-write]
[--enable-bursting {false, true}]
[--encryption-type {EncryptionAtRestWithCustomerKey, EncryptionAtRestWithPlatformAndCustomerKeys, EncryptionAtRestWithPlatformKey}]
[--force-string]
[--ids]
[--max-shares]
[--name]
[--network-access-policy {AllowAll, AllowPrivate, DenyAll}]
[--no-wait]
[--remove]
[--resource-group]
[--set]
[--size-gb]
[--sku {Premium_LRS, Premium_ZRS, StandardSSD_LRS, StandardSSD_ZRS, Standard_LRS, UltraSSD_LRS}]
[--subscription]
Examples
Update a managed disk and associate it with a disk access resource.
az disk update --name MyManagedDisk --resource-group MyResourceGroup --network-access-policy AllowPrivate --disk-access MyDiskAccessID
Update a managed disk. (autogenerated)
az disk update --name MyManagedDisk --resource-group MyResourceGroup --size-gb 20
Optional Parameters
Add an object to a list of objects by specifying a path and key value pairs. Example: --add property.listProperty <key=value, string or JSON string>.
Name or ID of the disk access resource for using private endpoints on disks.
Name or ID of disk encryption set that is used to encrypt the disk.
The total number of IOPS that will be allowed across all VMs mounting the shared disk as ReadOnly. One operation can transfer between 4k and 256k bytes.
The number of IOPS allowed for this disk. Only settable for UltraSSD disks. One operation can transfer between 4k and 256k bytes.
The total throughput (MBps) that will be allowed across all VMs mounting the shared disk as ReadOnly. MBps means millions of bytes per second - MB here uses the ISO notation, of powers of 10.
The bandwidth allowed for this disk. Only settable for UltraSSD disks. MBps means millions of bytes per second with ISO notation of powers of 10.
Enable bursting beyond the provisioned performance target of the disk. Bursting is disabled by default, and it does not apply to Ultra disks.
Encryption type. EncryptionAtRestWithPlatformKey: Disk is encrypted with XStore managed key at rest. It is the default encryption type. EncryptionAtRestWithCustomerKey: Disk is encrypted with Customer managed key at rest.
When using 'set' or 'add', preserve string literals instead of attempting to convert to JSON.
One or more resource IDs (space-delimited). It should be a complete resource ID containing all information of 'Resource Id' arguments. You should provide either --ids or other 'Resource Id' arguments.
The maximum number of VMs that can attach to the disk at the same time. Value greater than one indicates a disk that can be mounted on multiple VMs at the same time.
The name of the managed disk.
Policy for accessing the disk via network.
Do not wait for the long-running operation to finish.
Remove a property or an element from a list. Example: --remove property.list OR --remove propertyToRemove.
Name of resource group. You can configure the default group using az configure --defaults group=<name>
.
Update an object by specifying a property path and value to set. Example: --set property1.property2=.
Size in GB. Max size: 4095 GB (certain preview disks can be larger).
Underlying storage SKU.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
Increase logging verbosity to show all debug logs.
Show this help message and exit.
Only show errors, suppressing warnings.
Output format.
JMESPath query string. See http://jmespath.org/ for more information and examples.
Increase logging verbosity. Use --debug for full debug logs.
az disk wait
Place the CLI in a waiting state until a condition of a managed disk is met.
az disk wait [--created]
[--custom]
[--deleted]
[--exists]
[--ids]
[--interval]
[--name]
[--resource-group]
[--subscription]
[--timeout]
[--updated]
Examples
Place the CLI in a waiting state until a condition of a managed disk is met. (autogenerated)
az disk wait --created --name MyManagedDisk --resource-group MyResourceGroup
Place the CLI in a waiting state until a condition of a managed disk is met. (autogenerated)
az disk wait --deleted --name MyManagedDisk --resource-group MyResourceGroup --subscription mysubscription
Optional Parameters
Wait until created with 'provisioningState' at 'Succeeded'.
Wait until the condition satisfies a custom JMESPath query. E.g. provisioningState!='InProgress', instanceView.statuses[?code=='PowerState/running'].
Wait until deleted.
Wait until the resource exists.
One or more resource IDs (space-delimited). It should be a complete resource ID containing all information of 'Resource Id' arguments. You should provide either --ids or other 'Resource Id' arguments.
Polling interval in seconds.
The name of the managed disk.
Name of resource group. You can configure the default group using az configure --defaults group=<name>
.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
Maximum wait in seconds.
Wait until updated with provisioningState at 'Succeeded'.
Increase logging verbosity to show all debug logs.
Show this help message and exit.
Only show errors, suppressing warnings.
Output format.
JMESPath query string. See http://jmespath.org/ for more information and examples.
Increase logging verbosity. Use --debug for full debug logs.