Azure – CLI – Create VM in Azure Cloud Shell

email me

Azure Cloud Shell?

Create VM

USERNAME=azureuser
PASSWORD=$(openssl rand -base64 32)

az vm create \
--name myVM \
--resource-group 79fdb1a1-c11e-4716-8a08-f9c4d710ed47 \
--image Win2016Datacenter \
--size Standard_DS2_v2 \
--location eastus \
--admin-username $USERNAME \
--admin-password $PASSWORD


Verify VM

az vm get-instance-view \
--name myVM \
--resource-group 79fdb1a1-c11e-4716-8a08-f9c4d710ed47 \
--output table

Output

 

Notes

Install Azure CLI for Windows

Azure Az Commands

Official Documentation by Microsoft

Microsoft Quickstart: Create a Windows virtual machine with the Azure CLI