BACK TO ARTICLES

Basic Azure Concepts & Create a Linux VM in Azure (Step By Step)

Published on August 24, 2020

Fakhar ul Hassan

Please see in my latest article some Microsoft Azure basics and how to create a Linux VM on Azure cloud? (Easy Step By Step Approach)

Basic Azure Concepts & Create a Linux VM in Azure (Step By Step)

By Fakhar ul Hassan

Azure Compute/VM

Azure uses a term called ACU (Azure Compute Unit) to describe its different compute power standards against VM sizes. For example:

– 100 ACU = Small VM (Standard A1)

Where the letter A stands for the family (i.e. refers to virtual processors, RAM, storage options etc). The number 1 denotes the version number or size.

The available Linux VM sizes in Azure are as follows:

(source: Azure Documentation)

 – General Purpose     (Balanced Memory & CPU, Best for Test and Development)

 – Compute Optimized    (High Ratio of CPU to Memory)

 – Memory Optimized     (High Ratio of Memory to CPU)

 – Storage Optimized    (High Disk Throughput and IO)

 – GPU           (Specialized VMs suitable for Heavy Grpahics)

 – High Performance Compute (Fastet and Most Powerful VMs)

Azure Storage

There are standard and premium disks storage options available in Azure, which are desribed below:

1- Standard Disk

This is the cost effective storage options backed with HDDs which are stored in Azure storage account. Secondly, there is Standard SSD storage option available for managed disks.

2- Premium Disk

These are the high speed SSDs (Solid State Drive), which are available via a pre-pay model with fix disk size options.

The aforementioned disks can be used with managed or unmanaged option. 

a) Unmanaged Disks

In the unmanaged disks, the VHDs (Virtual Hard Disks) are stored in Azure storage account (as page blobs) 

which is managed by us with following limitations:

– Storage capacity per VM => 256 TB Maximum

– Single standard storage A/C VM disks maximum IOPS limit => 20000

– Storage account availability is managed by us

b) Managed Disks

The managed disk has following characteristics:

– Supports Standard HDDs, Standard SSDs & Premium SSDs

– Managed by Azure (Storgae acoount level IOPS are managed by Azure)

– Available via a pre-pay model with fix disk size options

Virtual Network

A virtual network (VNet) is a communication boundary. All the VMs present in this VNet are able to communicate with each other. But the VMs which are connected to a different VNet has no out-of-the-box connectivity with other VNets. Within a VNet we can have an IPv4 address space and for which the subnetting can be done. The VMs are connected to VNIC (Virtual Network Interface Card) which has a private IP address (from VNet IP adress space) for communication inside VNet and optionally a public IP address to connect to the outside world.

High Availablility of VM

The high availability of Azure VM is maintained in following two ways:

1- Availability Set

2- Availability Zone

Availability Set

It is server level fault tolerance within a data center and in a single region. Consider we have two identical servers and we put these servers in a Azure high availability set. In that case, the Azure will place these two servers in two different fault domains (i.e. different physical racks/hardware host). So that, in case any component failure occurs in one rack/hardware host, it will not result in service down time, as the second server will be available in a physically separate hardware/rack.

One important thing to remember here is, the availability set should be assigned at VM deployment time otherwise downtime and additional working will be required to assign the availability set.

 Availability Zone

In this method of high availability, the identical VMs are placed in two different data centers within the same region. Now, if the one data center goes down the service will still remain available. But not all the Azure regions supports availability zones.

How to create a Linux VM in Azure?

Step-1: Login to Azure portal

No alt text provided for this image

Step-2: Click the Azure Cloud Shell, as shown below:

No alt text provided for this image

Step-3: Click the PowerShell, as shown below:

No alt text provided for this image

Step-4: Click the “Create storage” button, as shown below:

No alt text provided for this image

Please wait, while the storage is being created, see the image below: 

No alt text provided for this image

The Azure Cloud Shell has been connected successfully (see image below):

No alt text provided for this image

Step-5: At the Azure cloud shell prompt enter command “cd ~” to go to your home directory and then enter command “dir”. Now you should the contents of your home directory (see image below):

No alt text provided for this image

Step-6: To check your storage account, enter command “Get-CloudDrive” (see image below):

No alt text provided for this image

Step-7: Now to see your file share, copy the storage account name from step-6 and paste it in the search bar in the top of the window (see image below):

No alt text provided for this image

Step-8: Now, click the “File shares”, as shown below:

No alt text provided for this image

Step-9: Now, click on your 6GB file share, as shown below:

No alt text provided for this image

Step-10: Click on the “cloudconsole” directory, as shown below:

No alt text provided for this image

Now, you can see the files, as shown below:

No alt text provided for this image

Step-11: Enter “az interactive” on the Azure Cloud Shell to launch Azure CLI, as shown below:

No alt text provided for this image

Step-12: To check the subscription id, enter “az account list”, as shown below (to change the output in table format, use the “az configure” command):

No alt text provided for this image

Step-13: To create a resource group use “az group create” command as shown below:

az group create –location eastus2 –name test-vnet-rg

Note: To list the possible location use command “az account list-locations”. Here I have used the location “eastus2”.

No alt text provided for this image

Step-14: To create a virtual network, enter the command as shown below:

az network vnet create -g test-vnet-rg –name test-vnet-1 –address-prefixes 192.168.0.0/16 –location eastus2 –subnet-name default –subnet-prefix 192.168.1.0/24

No alt text provided for this image

Step-15: Now, in the top search bar type “virtual network” and click “Virtual networks” option as shown below:

No alt text provided for this image

Step-16 [Optional]: Now you can see that new VNet created (see image below):

No alt text provided for this image

Step-17 [Optional]- Click on the “Subnets” to subnet range (if required):

No alt text provided for this image

See below the subnet address range:

No alt text provided for this image

Step-18: Now generate the SSH keys (see image below). You may use Windows PowerShell command “ssh-keygen” to generate the keys at your local machine. These keys will be used later during virtual machine creation.

No alt text provided for this image

Step-19: Now we are ready to create linux VM in Azure. In the top search bar type virtual machines and click the “virtual machine” from the drop down list, as shown below:

No alt text provided for this image

Step-20: Click “Add”, as shown in the below screen:

No alt text provided for this image

Step-21: Create the resource group, as shown below:

No alt text provided for this image

Step-22: Enter the appropriate VM details (see below image for reference):

Note: We have used SSH keys generated in Step-18.

No alt text provided for this image

Note: You may change the VM size, as per your need/choice.

Step-23: Set the appropriate inbound port rule as per your requirement, we have allowed SSH (see image below for reference):

No alt text provided for this image

Step-24: Select appropriate HDD or SSD (see image below for reference):

No alt text provided for this image

Step-25: Select appropriate Virtual Network, Subnet, NIC and Inbound Ports (see image below for reference):

No alt text provided for this image

Step-26: Click Next (See below image):

Note: You may enable the Azure Management Options for monitoring, identity, auto-shutdown and Back-up.

No alt text provided for this image

Step-27: Click Next (See below image):

No alt text provided for this image

Step-28: Click “Create”, as shown below:

No alt text provided for this image

Step-29: See the validation has been passed. Click “Create”, as shown below:

No alt text provided for this image

See below image, showing that the deployment is in progress …

No alt text provided for this image

See below image, the linux VM has been created successfully.

No alt text provided for this image

Step-30: Click the “Go to resource” in the above image to see the VM status and other details (see image below):

No alt text provided for this image

Step-31: To test SSH connection from your local machine use command ”ssh fakhar@publicIP”: (The public IP can be seen in the top right corner of the above image)

Note: Replace the publicIP in the above command and run it in your local machine (as shown below), with your newly deployed VM public IP.

No alt text provided for this image

The SSH connection has also been successfully established to newly deployed linux VM on Azure cloud.

Written by

Fakhar ul Hassan

Please see in my latest article some Microsoft Azure basics and how to create a Linux VM on Azure cloud? (Easy Step By Step Approach)