Creating an Azure virtual machine using command-line interface (CLI)

henriettatkr

Henrietta Takor

Posted on May 13, 2023

Creating an Azure virtual machine using command-line interface (CLI)

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.

Image description

Select the Bash option to open the command line environment within the Cloud Shell.

Image description

Step 1: Create a Resource Group
To create a resource group, you can use the following command:

az group create --name myCoolg --location EastUs
Enter fullscreen mode Exit fullscreen mode

Image description

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
Enter fullscreen mode Exit fullscreen mode

Image description

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

Image description

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.

💖 💪 🙅 🚩
henriettatkr
Henrietta Takor

Posted on May 13, 2023

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related