DEV Community

Cover image for Creating a Linux Virtual Machine in Azure
Seun Okegbola
Seun Okegbola

Posted on

Creating a Linux Virtual Machine in Azure

Today I will be showing you how to setup a Linux Virtual Machine (VM) on Microsoft Azure. This guide is just for a basic setup and some. The Linux operating system of choice for this blog post will be Ubuntu.

Okay, time to begin.


First thing login to your Microsoft Azure Portal by going to

If you do not have an azure account sign up and create an account for free with this link Registration will require a phone number and a debit or credit card details to validate your account even for the free account. You have a choice between the free or pay as you go account.

Note: Make sure the bank card you use for signing up allows international transactions. The free trial account provides $200 in Azure credits to be utilized within the first 30 days of sign-up, plus 12 months of selected free services (subject to change). After the initial 30 days, you will need to upgrade to a pay-as-you-go subscription.

Once you’ve Logged into your account you can begin.

Creating Linux Virtual Machine

Step 1: Search for Virtual Machine (VM) in the search bar at the top of your portal page and Select Virtual Machines.

Image description

Step 2: Select Create and select Azure Virtual Machine. (There is a create button at the centre of your portal and another towards the top left side of your screen both function similarly)

Image description

Image description

Step 3: You are now in the Create a Virtual Machine page. We will be working primarily under the Basics tab.

Step 4: Project details
a. Subscription: Choose your subscription. Here we will be using the default Azure subscription, if you have others, you can select another.

b. Resource group: Select Create new and type a name and select OK.

Image description

Step 5: Instance details

a. Virtual machine name: Give your VM a name and it should be unique throughout the Azure network.

b. Region: Select a location you want your VM, from the dropdown menu. [ A region is the geographical location with data centres that host services and infrastructures, with each operating independently and self-contained]

c. Availability options: we leave on the default Availability zone.

d. Availability zone: Select the zone or zones you would like your VM to be located _[Each Region in Azure can consist of more than one Availability zone. Each zone are kilometres apart and independent of each other to minimize the impact of failures and disruptions. Multiple zones can be selected each having their own Virtual machine] _

Image description

e. Security type: We leave on the default Trusted launch virtual machines.

f. Image: Select from the dropdown menu a Linux image for this exercise I will be selecting Ubuntu Server 22.04 LTS - x64 Gen 2(free services eligible)

Image description

Step 6: Administrator Account
a. Authentication type: There are two options to choose from SSH public key or Password. In this blog post we will be selecting Password.

b. Username: Name your administrator account

c. Password: type your password and confirm the password

Image description

Step 7: Inbound port rules
a. Public inbound ports: Select Allow selected ports.

b. Select inbound ports: From the dropdown menu select SSH (22) if it's not selected by default.

Image description

c. Click Next: Disk > at the bottom left of your portal.

Image description

Step 8: Once you click Next: Disks> you are moved to the Disk **tab of the **Create Virtual Machine service.

a. OS disk type: Select any disk type of your choosing. I will be selecting Premium SSD.

Image description

Step 9: For this guide we will be leaving the Networking, Management, Monitoring, Advanced and Tag pages on their default configuration. Click on Review + Create at the bottom left of your portal.

Step 10: At the Review + Create you should get a Validation passed at the top left of your screen. Review your settings and make any changes if required and select Create.

Image description

Step 11: Once you get Your deployment is complete click on Go to resource.

Image description

Step 12: Take note of your Public IP address before you click Connect and select Connect again.

Image description

Step 13: Open Windows PowerShell on your computer. For those new to PowerShell you can simply press the windows button on your keyboard and search for Windows PowerShell and click to open.

Image description

a. Type in this command ssh username@ipaddress and press enter. (username is your administrator account username and your public ip address)

b. You will be asked ‘Are you sure you want to continue connecting (yes/no/[fingerprint])?’ type *Yes

Image description

c. Enter your password.

At this point if you delay in typing in your password your connection will be closed as seen in the picture highlighted below.

Image description

To resolve this

Step 14: Go back to your Azure portal click on Overview **and click the **Public IP address. This takes you to the configuration page.

Image description

a. Go to the idle timeout (in minutes). Increase this time to 30 minutes either by using the slider or typing in the box.

b. Click **Save **towards the top left

Image description

c. Go back to PowerShell and input command ssh username@ipaddress once again and press enter.

d. Enter your password and press enter. (do not be alarmed when typing in your password and no characters or figures shows it is completely normal, just input the right password)

If all the steps were done correctly then the connection will be successful, and you will be logged into your Ubuntu Virtual Machine.

Image description

Congrats on you have a Linux Virtual machine.

Top comments (0)