How to create a Linux (Ubuntu) Virtual Machine in Azure and Connect to it
Tags: azure, ubuntu, cloud, linux
Published: 2022-08-06 11:01:00

Creating and connecting to a Linux VM on azure portal can be tricky nevertheless, it is an easy process and only slightly different from windows VM. In this article I’ll be showing how to do just that. You should already have an azure account and subscription. The subscription can either be your regular paid subscription, free credits for new users or student’s account.


First Step is to login to your account on the Azure portal and click on the Virtual Machine tab. you can also search for it using the search bar.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/h61s8qif5nhnr404yqcl.png)
 
Click on the create tab at the top left in the virtual machine page and choose Azure Virtual Machine

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ohlz2wfl74awpbtnq1rj.png)

 Create a new resource group or pick an existing resource group.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/slz7v90qhl1u8lpg93tf.png)

Fill and choose the remaining parameters; Virtual Machine name, Region should be one close to your location. For the sake of this tutorial, no Availability options is needed so pick No infrastructure redundancy required. choose your preferred image Ubuntu. Choose your VM size
 

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0pwzwaiqzm2w41ei3895.png)

Choose your preferred mode of authentication. If you chose password it is very important to remember your username and password. your password must contain uppercase letters, lowercase letters, numbers and must be 12 characters long.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/y2alswx3wwa8r9m6vi8o.png)
 
You can also use SSH key for authentication. you should also remember the username and keypair name or write and store somewhere safe.
 

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/evesyt8l7hozcsgxlwwj.png)

You can click Review + Create if you are satisfied or click next to adjust other settings like changing the disk type or implementing auto-shutdown among others


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3n8l8aqghed68vfdkxsx.png)
 
Review your parameters then click create at the bottom left when you are satisfied. Your VM will begin to deploy



![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0c14mqd3uy5oj0xvhbd8.png)
 
If you chose SSH key as your mode of authentication, you will be prompted to download your private key. Click on download and remember the location where it is stored on your computer.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/boj2xd8cfv0btoc37n52.png)
 
After Deployment click on Go to resource

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/icv85ry2tonlv30jx5au.png)

Copy the IP address located at the top right (different for each VM)


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8mjjeojfef4g86papxcc.png)

The next step is to download MobaXterm software and install it. Open the app after installation. click on Session on the top left corner, click SSH and input the IP address copied earlier the tab for remote host. click OK
 

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/744mv7bx5sy9iao3ngjg.png)

If you are using SSH key pair for authentication, after you input your IP address, click Advanced SSH settings tick the box for use private key and the import the private key downloaded earlier and click OK
 

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tugg3oux1gc42hqclgu5.png)

You will be required to provide username and password that was provided earlier in the authentication settings. you will be prompted to provide username only if you are using SSH key pair (Note that the no characters will be displayed on your screen when typing your password)


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/p1sblrv888ms129qapge.png)

 if the username and password provided is correct, you will be successfully logged into the Command Line interface of the Ubuntu VM and can run Linux commands
 

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0t1wkpvjv8ahxkce2c6l.png)

Conclusion
Thank you for reading and I hope this article was helpful for you. Join me in my Cloud journey [LinkedIn](www.linkedin.com/in/MuyideenMorenigbade)