For system, network and cloud administrators

How to update Azure disk performance SKU using Azure CLI

In order to update a current Azure disk performance SKU, from Standard_LRS to Premium_LRS, for example, type:

az disk update --name yourdiskname --resource-group yourresourcegroup --sku Premium_LRS

How to delete all Azure managed disks that start with a pattern using Azure CLI and Bash shell

In order to be able to delete all Azure managed disks that start with mydisk, for example, you’ll first need to run the Azure Bash shell instead of PowerShell and then type:

az disk list --query "[?starts_with(name,'mydisk')].[name]" | xargs -L1 bash -c 'az disk delete --resource-group yourresourcegroup --name $0 --yes'


How to list all Azure managed disks using Azure CLI

In order to view all managed disks in Azure, type:

az disk list --output tsv


How to delete an Azure managed disk using Azure CLI

In order do delete a managed disk in Azure and without the need for the command execution confirmation (because of the –yes) parameter, type:

az disk delete --resource-group yourresourcegroup --name yourdiskname --yes


How to view disk size of an Azure managed disk using Azure CLI

In order to check the size of the managed disk in Azure, type:

az disk show --resource-group yourresourcegroup --name yourdiskname --query diskSizeGb