How to Create a Linux virtual machine in the Azure portal
Published: 2024-04-14 21:18:37

Azure virtual machines (VMs) can be created through the Azure portal. The Azure portal is a browser-based user interface to create Azure resources. This tutorial shows you how to use the Azure portal to deploy a Linux virtual machine (VM) running Ubuntu Server 22.04 LTS.

**Create virtual machine**

1) Sign in to the Azure portal 
2) Enter virtual machines in the search.
3) Under Services, select Virtual machines.


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


4) In the Virtual machines page, select Create and then Virtual machine. The Create a virtual machine page opens.


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


5) In the Basics tab, **under Project details**, make sure the correct subscription is selected and then choose the resource group or click create new to create resource group.


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

6) **Under Instance details,** 
**Virtual machine name:** Input the Virtual machine name.
**Region:** Select the region of your choice.
**Availability Option:** Select availability zone. 
**Availability Zone:** Choose any zone of your choice. 
**Security type:** select trusted lunch virtual machines.
**Image:** Choose Ubuntu Server 22.04 LTS - Gen2 for your Image or any of your choice.
**Size:** select the size of your choice.


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


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

**Under Administrator account** 

**Authentication type:** Select SSH public key or password.
**Username:** enter your username, exceluser.
**Password:** Enter your password.
**Confirm password:** Confirm the password entered above. 

**Under Inbound port rules** 

 **Public inbound ports:** choose Allow selected ports. 
 **Select inbound port:** Select SSH (22).

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

7) Leave the remaining defaults and then select the Review + create button at the bottom of the page


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

8) click create after validation is successfully passed.


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

9) When the deployment is finished, select Go to resource.


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

**Connect to virtual machine**
a) click connect, in the drop down menu, select connect


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

b) Open windows PowerShell and type in the following command on the powershell command prompt, ssh username@public ip address and then strike enter. 
c) It will give you a massage if you are connecting for the first time, The authenticity of host "public ip address" (public ip address)' can't be established.....
d) Are you sure you want to continue connecting (yes/no/[fingerprint])?
e) Type "yes" and strike enter, then it will request for your password.
f) Type in your password and strike enter, if all things are ok you will be connected.

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


Great!!!
Here we are in our linux virtual machine.