For system, network and cloud administrators

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 check Azure disk performance SKU using Azure PowerShell

Check disk performance SKU a particular disk is using by typing in your PowerShell session:

(Get-AzDisk -ResourceGroupName yourresourcegroup -DiskName yourdiskname).Sku

How to update Azure disk performance SKU using Azure PowerShell

After an initial deployment, you might run into the need of changing the initial disk performance SKU in Azure. In the example below, we’re updating the SKU from Standard_LRS to Premium_LRS. In your PowerShell session type:

New-AzDiskUpdateConfig -Sku Premium_LRS | Update-AzDisk -ResourceGroupName yourresourcegroup -Name yourdiskname