How to create a Windows VM in Azure.

Environment

 Azure

Requisites

Azure CLI 2.0

 

Code:

 

#!/bin/bash
# Admin Passwd Here
AdminPassword=PutPasswdHere
# Create a resource group.
az group create --name myResourceGroup --location eastus
# Create a virtual machine. 
az vm create \
    --resource-group myResourceGroup \
    --name my2K16VM \
    --image win2016datacenter \
    --admin-username azureuser \
    --admin-password $AdminPassword \
    --no-wait