az vm unmanaged-disk
Manage the unmanaged data disks attached to a VM.
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/managed-disks-overview.
- 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/disks-types.
Commands
Name | Description | Type | Status |
---|---|---|---|
az vm unmanaged-disk attach |
Attach an unmanaged persistent disk to a VM. |
Core | GA |
az vm unmanaged-disk detach |
Detach an unmanaged disk from a VM. |
Core | GA |
az vm unmanaged-disk list |
List unmanaged disks of a VM. |
Core | GA |
az vm unmanaged-disk attach
Attach an unmanaged persistent disk to a VM.
This allows for the preservation of data, even if the VM is reprovisioned due to maintenance or resizing.
az vm unmanaged-disk attach --resource-group
--vm-name
[--caching {None, ReadOnly, ReadWrite}]
[--lun]
[--name]
[--new]
[--size-gb]
[--vhd-uri]
Examples
Attach a new default sized (1023 GB) unmanaged data disk to a VM.
az vm unmanaged-disk attach -g MyResourceGroup --vm-name MyVm --new
Attach an existing data disk to a VM as unmanaged.
az vm unmanaged-disk attach -g MyResourceGroup --vm-name MyVm --name MyDataDisk \
--vhd-uri https://mystorage.blob.core.windows.net/vhds/d1.vhd
Attach an unmanaged persistent disk to a VM. (autogenerated)
az vm unmanaged-disk attach --name MyDataDisk --new --resource-group MyResourceGroup --size-gb 50 --vm-name MyVm
Required Parameters
Name of resource group. You can configure the default group using az configure --defaults group=<name>
.
The name of the Virtual Machine. You can configure the default using az configure --defaults vm=<name>
.
Optional Parameters
Disk caching policy.
0-based logical unit number (LUN). Max value depends on the Virtual Machine size.
The data disk name.
Create a new disk.
Size in GB. Max size: 4095 GB (certain preview disks can be larger).
Virtual hard disk URI. For example: https://mystorage.blob.core.windows.net/vhds/d1.vhd.
Global Parameters
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.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
Increase logging verbosity. Use --debug for full debug logs.
az vm unmanaged-disk detach
Detach an unmanaged disk from a VM.
az vm unmanaged-disk detach --name
--resource-group
--vm-name
Examples
Detach a data disk from a VM.
az vm unmanaged-disk detach -g MyResourceGroup --vm-name MyVm -n disk_name
Required Parameters
The data disk name.
Name of resource group. You can configure the default group using az configure --defaults group=<name>
.
The name of the Virtual Machine. You can configure the default using az configure --defaults vm=<name>
.
Global Parameters
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.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
Increase logging verbosity. Use --debug for full debug logs.
az vm unmanaged-disk list
List unmanaged disks of a VM.
az vm unmanaged-disk list --name
--resource-group
Examples
List the unmanaged disks attached to a VM.
az vm unmanaged-disk list -g MyResourceGroup --vm-name MyVm
List unmanaged disks with names containing the string "data_disk".
az vm unmanaged-disk list -g MyResourceGroup --vm-name MyVm \
--query "[?contains(name, 'data_disk')]" --output table
Required Parameters
The name of the Virtual Machine. You can configure the default using az configure --defaults vm=<name>
.
Name of resource group. You can configure the default group using az configure --defaults group=<name>
.
Global Parameters
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.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
Increase logging verbosity. Use --debug for full debug logs.