Skip to main content

Manage virtual machines in Azure. Part of az, the command-line client for Microsoft Azure.

# To list details of availible Virtual Machines:
az vm list

# To create an 'UbuntuServer 18.04 LTS' Virtual Machine and generate ssh keys:
az vm create --resource-group <rg> --name <vm_name> --image <Canonical:UbuntuServer:18.04-LTS:latest> --admin-user <azureuser> --generate-ssh-keys

# To stop a Virtual Machine:
az vm stop --resource-group <rg> --name <vm_name>

# To deallocate a Virtual Machine:
az vm deallocate --resource-group <rg> --name <vm_name>

# To start a Virtual Machine:
az vm start --resource-group <rg> --name <vm_name>

# To restart a Virtual Machine:
az vm restart --resource-group <rg> --name <vm_name>

# To list VM images availiable in the Azure Marketplace:
az vm image list