Create VM with Azure CLI

The Azure CLI is used to create and manage Azure resources from the command line or in scripts. This post explains how to create VM with Azure CLI. Below is the sample command to create VM in Azure.

az vm create \
--resource-group "resource_group_name" \
--name "vm_name" \
--image "image_name" \
--admin-username "admin_user"   

Following example creates a UbuntuLTS VM named "testVM" and uses "azureuser" for an administrative user name. You will be prompted to to enter a password at the command line.


az vm create \
--resource-group myTestResourceGroup \
--name testVM \
--image UbuntuLTS \
--admin-username azureuser

Follow US on Twitter: