az-disk
Manage Azure managed disks
TLDR
Create a managed disk
List managed disks in a resource group
Delete a managed disk
Grant read or write access to a managed disk (for export)
Update disk size
SYNOPSIS
az disk [command] [options]
PARAMETERS
create
Create a managed disk.
delete
Delete a managed disk.
list
List managed disks.
show
Get the details of a managed disk.
update
Update a managed disk.
grant-access
Grant access to the disk.
revoke-access
Revoke access to the disk.
DESCRIPTION
The az disk command is part of the Azure Command-Line Interface (CLI) and is used to manage Azure managed disks. It allows you to create, update, delete, and list managed disks within your Azure subscriptions. Managed disks are virtual hard disks (VHDs) stored as page blobs in Azure storage accounts and are used with Azure Virtual Machines. This command simplifies disk management by abstracting away the underlying storage account details.
With az disk, you can specify parameters such as disk size, storage tier (e.g., Standard_LRS, Premium_LRS), and source images or snapshots to create disks. You can also manage encryption settings, update disk properties, and perform other administrative tasks. The command provides options for both data disks (used for storing application data) and OS disks (used for the operating system of a virtual machine). It can be very helpful for deployment pipelines, automating resource configurations and maintaining the infrastructure as code principle.
For example, using 'az disk create' will allow you to quickly provision a new disk in your Azure resource group with customizable properties. The 'az disk list' is an essential function to quickly enumerate disks that can be filtered by resource groups or tags.
EXAMPLES
Create a managed disk:
az disk create -g MyResourceGroup -n MyDisk --size-gb 128 --location eastus
List managed disks in a resource group:
az disk list -g MyResourceGroup
Update a managed disk's size:
az disk update -g MyResourceGroup -n MyDisk --size-gb 256
SEE ALSO
az vm(1), az snapshot(1), az group(1)