This blog explains about provisioning virtual machines through the CLI Tool. To start that, we need to have the Command Line Interface (CLI) tool installed on our Windows machine.
To install CLI, start the PowerShell command prompt as an administrator and run the below command.
- Invoke-WebRequest -Uri https://aka.ms/installazurecliwindows -OutFile .\AzureCLI.msi; Start-Process msiexec.exe -Wait -ArgumentList '/I AzureCLI.msi /quiet'
After installing the CLI, you can log in to your Azure account by typing the below code and hitting Enter on your command prompt or Windows PowerShell.
- az login
Resource Group
Resource Group is a container that holds and stores your Azure solution in a specified group. By this resource group, you can retrieve metadata of your resources. Let's get to know how to create the Resource Group using CLI command.
- az group create \
- -- name "demo-rg" \
- -- location "centralus"
"\" - refers to continue the execution to the next line.
The above code will create the Resource group on your Azure portal with the name "demo-rg". If you want to verify the list of groups on your Aure account or to check the resource group you have created, run the below code on your CLI tool. This will execute the list of all resource groups available on your subscription.
- az group list -o table
Virtual Network and Subnet
Once we have created the resource group, we are going to create the Virtual Network under the same resource group. Below CLI code will help us to create the Virtual Network and subnet together on the "demo-rg" group we have created.
- az network vnet create \
- --resource-group "demo-rg" \
- --name "demo-vnet-1" \
- --address-prefix "10.1.0.0/16" \
- --subnet-name "demo-subnet-1" \
- --subnet-prefix "10.1.1.0/24"

Join the conversation! Your thoughts help the community grow.