For system, network and cloud administrators
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
In order to display the properties of a managed disk, in PowerShell session type:
Get-AzDisk -ResourceGroupName yourresourcegroup -Name yourdiskname
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
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
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