For system, network and cloud administrators

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

How to retrieve properties of a newly created Azure resource group using Azure CLI

In order to display the properties of a specific resource group in Azure type:

az group show --name yourresourcegroup --output tsv