az disk

Manage Azure Managed Disks.

Commands

az disk create Create a managed disk.
az disk delete Delete a managed disk.
az disk grant-access Grant a resource read 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
[--location]
[--no-wait]
[--size-gb]
[--sku {Premium_LRS, Standard_LRS}]
[--source]
[--source-storage-account-id]
[--tags]
[--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 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 -n MyDisk -g MyResourceGroup --size-gb 10 --location eastus2 --zone 1

Required Parameters

--name -n

The name of the managed disk.

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

Optional Parameters

--location -l

Location. You can configure the default location using az configure --defaults location=<location>.

--no-wait

Do not wait for the long-running operation to finish.

--size-gb -z

Size in GB.

--sku

Underlying storage sku.

accepted values: Premium_LRS, Standard_LRS
default value: Premium_LRS
--source

Source to create the disk/snapshot from, including unmanaged blob uri, managed disk id or name, or snapshot id or name.

--source-storage-account-id

Used when source blob is in a different subscription.

--tags

Space separated tags in 'key[=value]' format. Use "" to clear existing tags.

--zone

Availability zone into which to provision the resource.

accepted values: 1, 2, 3

az disk delete

Delete a managed disk.

az disk delete --name
--resource-group
[--no-wait]
[--yes]

Required Parameters

--name -n

The name of the managed disk.

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

Optional Parameters

--no-wait

Do not wait for the long-running operation to finish.

--yes -y

Do not prompt for confirmation.

az disk grant-access

Grant a resource read access to a managed disk.

az disk grant-access --duration-in-seconds
--name
--resource-group

Required Parameters

--duration-in-seconds

Time duration in seconds until the SAS access expires.

--name -n

The name of the managed disk.

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

az disk list

List managed disks.

az disk list [--resource-group]

Optional Parameters

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

az disk revoke-access

Revoke a resource's read access to a managed disk.

az disk revoke-access --name
--resource-group

Required Parameters

--name -n

The name of the managed disk.

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

az disk show

Gets information about a disk.

az disk show --name
--resource-group

Required Parameters

--name -n

The name of the managed disk.

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

az disk update

Update a managed disk.

az disk update --name
--resource-group
[--add]
[--no-wait]
[--remove]
[--set]
[--size-gb]
[--sku {Premium_LRS, Standard_LRS}]

Required Parameters

--name -n

The name of the managed disk.

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

Optional Parameters

--add

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>.

--no-wait

Do not wait for the long-running operation to finish.

--remove

Remove a property or an element from a list. Example: --remove property.list OR --remove propertyToRemove.

--set

Update an object by specifying a property path and value to set. Example: --set property1.property2=.

--size-gb -z

Size in GB.

--sku

Underlying storage sku.

accepted values: Premium_LRS, Standard_LRS

az disk wait

Place the CLI in a waiting state until a condition of a managed disk is met.

az disk wait --name
--resource-group
[--created]
[--custom]
[--deleted]
[--exists]
[--interval]
[--timeout]
[--updated]

Required Parameters

--name -n

The name of the managed disk.

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

Optional Parameters

--created

Wait until created with 'provisioningState' at 'Succeeded'.

--custom

Wait until the condition satisfies a custom JMESPath query. E.g. provisioningState!='InProgress', instanceView.statuses[?code=='PowerState/running'].

--deleted

Wait until deleted.

--exists

Wait until the resource exists.

--interval

Polling interval in seconds.

default value: 30
--timeout

Maximum wait in seconds.

default value: 3600
--updated

Wait until updated with provisioningState at 'Succeeded'.