Creating an Azure virtual machine using command-line interface (CLI)
Henrietta Takor
Posted on May 13, 2023
Welcome, tech enthusiasts! In this blog post, we will be looking at how to create an Azure virtual machine using the command line. This blog is perfect for you if you are new to Azure or are just beginning to explore the exciting possibilities of cloud computing.
But first, let's take a look back at some of our prior blog posts. We explained how to create a virtual machine using the Azure portal, PowerShell, an ARM Template, and Azure Quick Start in earlier posts. We hope you found those blogs helpful and educational. Today, we'll expand on that understanding by teaching you to the power of the command line.
Azure command-line interface (CLI) is a command-line tool that can be used to manage Azure resources from any operating system.
To begin, log in to the Azure Portal using this link
Once you are logged in, you should see a search bar at the top of the page. To the right of the search bar, there should be an icon that looks like a >_ symbol as highlighted in the image below. This is the Cloud Shell icon.
Click on the Cloud Shell icon to open the Cloud Shell window.
Select the Bash option to open the command line environment within the Cloud Shell.
Step 1: Create a Resource Group
To create a resource group, you can use the following command:
az group create --name myCoolg --location EastUs
Replace 'myCoolRg' with the name of your resource group and 'EastUS' with the location of your choice.
Step 2: Create a Virtual Machine
To create a virtual machine, you need to use the az vm create command. The command takes a few parameters that define the configuration of the virtual machine. Here's an example of how to create a virtual machine:
az vm create - -resource-group myCoolRg --name myVMcli --image UbuntuLTS --generate-ssh-keys
Step 3: Verify the Virtual Machine Creation
After you have created the virtual machine, you can verify that it has been created successfully and running
Creating an Azure virtual machine using the CLI is a simple process that involves creating a resource group, defining the configuration of the virtual machine, and verifying the creation. By following the steps outlined above, you can create an Azure virtual machine quickly and easily.
Posted on May 13, 2023
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.