You are currently viewing How To Create An Azure Virtual Machine Using Azure CLI

How To Create An Azure Virtual Machine Using Azure CLI

How To Create An Azure Virtual Machine Using Azure CLI

Hello Everyone

Welcome to CloudAffaire and this is Debjeet.

In this blog post, we will discuss how to create an Azure Virtual Machine using Azure CLI.

What Is Azure CLI:

Azure Command Line Interface or Azure CLI is a collection of commands that can be used to interact with Azure service. Like in AWS we use AWS CLI or in GCP we use gcloud, in Azure you can use Azure CLI to create and manage your Azure resources.

What is Azure Virtual Machine:

Azure Virtual Machine or Azure VM is the compute service offered by Azure to host your virtual servers in Azure cloud. Azure Virtual Machine is basically a virtual server running on Azure datacenter. Like in AWS you use EC2 instance or in GCP you use Google Compute Engine Instance, in Azure, you will use Azure VM instance if you need to create and manage your own server on Azure cloud.

Prerequisites:

  • One system with Azure CLI installed and configured.

You can follow the below blog post if you haven’t installed and configured Azure CLI yet.

https://cloudaffaire.com/how-to-install-and-configure-azure-cli/

How To Create An Azure Virtual Machine Using Azure CLI:

Step 1: Select the Azure location of your choice where you will deploy your Azure VM. For this demo, I am using southeastasia location.

Step 2: Create a resource group.

Step 3: Create a virtual network.

Step 4: Create a public IP address.

Step 5: Create a network security group.

Step 6: Create a virtual network card with the public IP address and network security group.

Step 7: Select an OS image for your Azure VM. For this demo, I am using CentOS image.

Step 8: Create your Azure VM and generate the ssh key for connection. Copy the public IP address from the output.

Note: The ssh key will be stored under .ssh directory in your home directory.

Step 9: Open 22 port in your Azure VM for SSH connectivity.

Step 10: Connect to your Azure VM.

Step 11: Cleanup

Hope you have enjoyed this blog post. Please refer below Azure documentation for more details

https://docs.microsoft.com/en-us/cli/azure/reference-index?view=azure-cli-latest

https://docs.microsoft.com/en-us/cli/azure/

https://docs.microsoft.com/en-us/azure/virtual-machines/linux/cli-samples

https://docs.microsoft.com/en-us/azure/virtual-machines/

 

Leave a Reply