For system, network and cloud administrators

How to create an Azure resource group using Azure PowerShell

In order to create a new Azure resource group, remember you’ll also have to mention a location.

New-AzResourceGroup -Name yourresourcegroupname -Location westeurope


How to delete all Azure managed disks that start with a pattern using Azure PowerShell

In order to remove all Azure managed disks that start with the name disk, in your PowerShell session type:

Get-AzDisk -ResourceGroupName yourgroupresource -Name 'disk*' | Remove-AzDisk -Force -Verbose


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 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