For system, network and cloud administrators

How to update the disk size of an Azure managed disk using Azure CLI

After an initial deployment, you might find yourself in need to change the size of the Azure managed disk you’ve just deployed. For example, if you want to change the size of it to 64GB, type:

az disk update --resource-group yourresourcegroup --name yourdiskname --size-gb 64


How to retrieve properties of a newly created Azure managed disk using Azure PowerShell

In order to display the properties of a managed disk, in PowerShell session type:

Get-AzDisk -ResourceGroupName yourresourcegroup -Name yourdiskname

How to create an Azure managed disk using Azure PowerShell

In order to create a managed disk, you’ll first need a configuration for that disk. In the following example, we’re creating a new variable called diskConfig which holds the commands for creating that initial disk configuration. After that being declared, the New-AzDisk command will actually create the disk. In PowerShell session type:

$diskConfig = New-AzDiskConfig `
-Location westeurope `
-CreateOption Empty `
-DiskSizeGB 32 `
-Sku Standard_LRS`

New-AzDisk `
-ResourceGroupName yourresourcegroup `
-DiskName yourdiskname `
-Disk $diskConfig

How to create an Azure managed disk using Azure CLI

The following command helps you create a basic Standard_LRS managed disk in Azure:

az disk create --resource-group yourresourcegroup --name yourdiskname --sku "Standard_LRS" --size-gb 32


How to create a new Azure resource group using Azure CLI

It’s really practical to know how to create resources using multiple methods. In order to create a new resource group type:

az group create --name yourresourcegroup --location yourdesiredlocation