DEV Community

Cover image for Creating Resource group and Virtual machine using Command-line interface (CLI) in Azure
Tijani Mojeed
Tijani Mojeed

Posted on • Edited on

Creating Resource group and Virtual machine using Command-line interface (CLI) in Azure

Azure command-line interface (Azure CLI) is another way of creating Virtual Machine in Azure apart from PowerShell. Like Azure PowerShell, the Azure CLI is a command-driven scripting environment that also uses the Azure REST API to execute management tasks in Azure. It is nearly identical to Azure PowerShell in capability and function, running on Windows, Linux, and Mac.
Also, as with Azure PowerShell, you can run the Azure CLI in a web browser through the Azure Cloud Shell, giving you the capability to run the Azure CLI in scenarios were running it natively might not be possible or feasible.
Below are the steps to take when using CLI to create Resource group and Virtual machine in Azure.

Login to your Azure portal
After that click on the cloud shell in the Azure porta, then select Bash

Image description

After clicking on Bash, then you can paste your resource group script to create your Resource group just as shown below

Image description

From the above image, it shows that resource group has been created which “myCoolRg” and this can also be confirm by clicking on Resource group in Azure portal to see if our resource group has been created. See the image below

Image description

The next step is to create virtual machine by pasting the script as shown below

Image description

Image description

Click on the virtual machine name “myVMcli” to see if it has been created and running.
See the image below

Image description

Wow! we have our virtual machine running.

Top comments (0)