DEV Community

Cover image for Creating an Azure Linux virtual machine and connecting to it using SSH
Tolu Iyoriobhe
Tolu Iyoriobhe

Posted on

Creating an Azure Linux virtual machine and connecting to it using SSH

Hi there,

I would like to walk you through on how you can create an Azure Linux Virtual Machine and connecting to it using SSH.

A Virtual machine (VM) is a software computer used as emulation of an actual physical computer. It includes virtual processor, memory, storage and networking. VMs are known for their flexibility and portability and provides many benefits, such as: cost savings, agility and speed, lowered downtime, scalability and security benefits.

For creating Azure VM, you will need to have a valid Azure account. If you do not have one, create using Azure Portal for free.

  • From the search box, type in virtual machines. Under Services, select Virtual machines.Virtual machine
  • Select create shown on the upper left side and then Virtual machine. The Create a Virtual machine page opens.Create Virtual machine
  • On the basics tab, fill in the followingBasics tab See below on how I filled out the detailsInstance detailsAdministrators accountInbound port rules
  • Leave the remaining defaults and select the Review + Create
  • Click on create once validation is passed.
  • Once you click on create, you would be prompted to download private key and create resource. Select and wait for it to download. Make sure you know where the file was downloaded, you will need the path to it in the next step.key pair
  • After downloading, it will immediately submit the deployment template for the resource group. Once deployment is complete, select Go to resourceDeployment complete Connect to Virtual Machine
  • On the overview page of the Virtual machine, select the Pubic IP addressVirtual machine
  • Change the IP address assignment from dynamic to static and click on save afterwardsIP address
  • Connect to the VM using SSHconnect to ssh
  • Copy out the highlighted command in 4 and paste it in your notepadSSH Note the following
  • Go to your notepad where you pasted the command highlighted in yellow above
  • Also, go to your downloads on your PC and right click the key PEM file download and select properties
  • Copy out the key and the location name separately to the note pad opened earliercommand to connect to VM
  • Merge the key and location name into one with a backlashkey and location name
  • Copy the above to the on the command pasted beforeSSH key pair

Open Windows PowerShell and copy and paste the SSH keypair above.

To run a command as administrator 'root user', type sudo su. To confirm it is an Ubuntu type of Linux, run the command apt update.

Let me know if this was helpful. I love feedback😊

Top comments (0)