DEV Community

Cover image for Creating a Linux Virtual Machine in Azure using an SSH Authentication Key
PRECIOUS BEDEKEMO
PRECIOUS BEDEKEMO

Posted on

Creating a Linux Virtual Machine in Azure using an SSH Authentication Key

A Linux VM is a virtual machine that runs Linux as its operating system. A virtual machine is like having a computer within a computer, where the cloud provider allocates resources such as memory, processing capabilities, and storage to the VM. This enables the VM to operate independently, running its operating system and applications just like a physical system.

How can one create an Azure Linux VM?
It is done by either using
i) Password or
ii) Secure Socket Shell (SSH) KEY

Let's consider how it is done using an SSH Key.

Login into your Azure account based on subscription or you can check on how to get a free account. Then go to the home page and click on virtual machine. Apply the following steps:

STEP 1: Type in your subscription
STEP 2: Create a new resource group
STEP 3: Type a name for your virtual machine
STEP 4: Choose a region.

Image description
STEP 5: Select availability zone
STEP 6: Choose a particular zone
STEP 7: Select the security type you want
STEP 8: Choose an image(in this case, Linux)
STEP 9: Choose a size

Image description
STEP 10: Click SSH public key
STEP 11: Type a username
STEP 12: Under SSH public key source, click on generate new key pair
STEP 13: Under key pair name, enter the name of your choice
STEP 14: Under public inbound ports, Click on 'Allow selected
ports'
STEP 15: Under select inbound ports, click on SSH(22)

Image description
STEP 16: At the top, Click on Review and Create
STEP 17: Once you see validation passed, click on create

Image description
STEP 18: Click on 'download private key and create resource'

Image description
You will see on the screen 'Deployment is in progress'
On your browser check for the downloaded file (We will be needing it)

Image description
STEP 19: Once deployment is complete, click on 'go to resource'

Image description

STEP 20: Go to the downloaded file, right-click on it and click properties

Image description

STEP 21: Click on security, copy and save the object name perhaps on a sticky note for easy access. This is the key path

Image description
STEP 22: Now on your azure page, click on connect

Image description

On the next page, copy the ip address and admin username on your sticky note for easy access.

Image description
STEP 23: Open Windows PowerShell on your system by using the search bar to search for it.

Image description
STEP 24: On the PowerShell, type ssh -i (give a space) followed by the key path (give a space) followed by your admin username followed by @(no space)your ip address and press ENTER

Image description
STEP 25: Next type yes

Image description

Now your Linux VM is ready for use!

Image description

Feel free to comment, like and share your thoughts on the article.

Top comments (0)