DEV Community

Cover image for Create a Resource Group and Launch a Virtual Machine Using Azure CLI
Gbadamosi Tajudeen
Gbadamosi Tajudeen

Posted on

Create a Resource Group and Launch a Virtual Machine Using Azure CLI

  • Configure and install Azure CLI: Follow the procedures in the link below to install Azure CLI. [(https://docs.microsoft.com/cli/azure/install-azure-cli)] After installation, launch the terminal (Window Powershell) and sign in to your Azure account using the Username (e.g. “azstudent@74.235.163.162” and password (e.g. “Password123”) and following the displayed command to create a resource group and run a virtual machine (VM):

Username extracted from Azure account

  • Create a resource group: Choose a name for your resource group (e.g. "adex") and identify a desired Azure Region as location (e.g. "eastUS") and input the following command to create the resource group: az group create --name adex --location eastUS

Command for creating resource group

  • Create a virtual machine: Choose a name for your virtual Machine (e.g. “matrix”) and input the following command to create the virtual machine within the resource group by replacing resource-group (e.g. “adex”), (e.g. name “matrix”), and image (“UbuntuLTS”): az vm create --resource-group adex --name matrix --image UbuntuLTS --generate-ssh-keys

Command for creating VM

  • After the installation and configuration, you will have a resource group and a virtual machine set up in your Azure environment. To minimize expenses, keep in mind to delete resources when they are no longer needed.

Top comments (0)