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

The above command will also generate an SSH key but if you’ve already have previously generated one then Azure will use that one. Note that the command will use verbose so that the creation process is being displayed in the terminal.

But if you want to create a Windows server virtual machine, for example, you can use:

az vm create --name YourVMName --resource-group YourResourceGroup --image  Win2012Datacenter --public-ip-sku Standard --admin-username myuser 

Leave a Reply

Your email address will not be published. Required fields are marked *