For system, network and cloud administrators

How to create an Azure virtual machine using Azure CLI

In order to create an Azure virtual machine, let’s say Ubuntu, you can use:

az vm create --name YourVMName --resource-group YourResourceGroup --admin-username myuser --image UbuntuLTS --public-ip-sku Standard --generate-ssh-keys --verbose


How to set default Azure subscription using Azure CLI

In order to make a particular Azure subscription as a default subscription, type:

az account set --subscription "yourAzuresubscriptionID"


How to set default Azure resource group using Azure CLI

In order to set a default Azure resource group, type:

az configure --defaults group="yourresourcegroup"

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 list all Azure SKUs that contain a pattern using Azure CLI?

In order to view all SKUs that contain Standard_D2s in their name, for example, type:

az vm list-skus -o table --query "[?contains(name,'Standard_D2s')].name"