Step-by-Step Guide: Creating and Connecting to a Linux VM on Microsoft Azure (Password and SSH Authentication)

I'm Iniobong Ema, a Cloud and DevOps Engineer, I'm passionate about automation, pipelines and building scalable systems. I document my journey, share tutorials and explore modern tech solutions-one experiment at a time. From Code to Cloud: My DevOps Journey. My contact information: Phone number: 08027604029 Gmail Address: iniema2025@gmail.com, iniakan4real2017@gmail.com
Linux Virtual Machines (VMs) are a core service on Microsoft Azure for hosting applications, running DevOps pipelines, and managing backend infrastructure. Azure provides multiple authentication options for accessing Linux VMs, including username & password and SSH key authentication.
In this guide, we will:
Create a Linux VM using username and password authentication
Connect to the VM using password-based SSH
Enable and use SSH key authentication for improved security
This approach mirrors real-world DevOps workflows—starting simple, then improving security.
Prerequisites
Before you begin, ensure you have:
An active Microsoft Azure account
Basic Linux knowledge
A terminal (Linux/macOS) or PowerShell/Command Prompt (Windows)
Internet connectivity
PART 1: Creating a Linux VM Using Username & Password Authentication
Step 1: Sign in to the Azure Portal
Open your browser and navigate to portal.azure.com
Sign in with your Microsoft credentials

Step 2: Create a New Virtual Machine
From the Azure dashboard, click Create a resource
Select Virtual Machine
Click Create → Azure virtual machines

After clicking on ‘Create’ select Virtual Machine

Step 3: Configure Basic VM Settings
Project Details
Subscription: Select your Azure subscription
Resource group:
Click Create new
Example:
rg-linux-devops
Instance Details
Virtual machine name: my-linux-vm
Region: Choose the closest region
Availability options: No infrastructure redundancy required
Image:
Choose Ubuntu Server 24.04 LTS (latest version)

Size:
- Example:
Standard B1s(cost-effective for labs)
- Example:

Step 4: Configure Administrator Account (Username & Password)
Authentication type: Password
Username: hagital
Password: Create a strong password
Confirm password

Step 5: Configure Inbound Port Rules
Public inbound ports: Allow selected ports
Select inbound ports:
HTTP (80), SSH (22)
Allow the configuration of Disks and Networking to remain, click on review and create

Step 6: Review and Create the VM
Click Review + Create
Confirm validation passed
Click Create

Validation is passed, click on ‘create’ for deployment

⏳ Deployment typically completes in 2–5 minutes.

Deployment is complete, click on ‘Go to Resource’
Step 7: Access the Virtual Machine Details
Navigate to the overview page, click on ‘connect’ then ‘connect’
Copy the SSH command, run on a terminal
Follow the prompt
Type your password and click ‘enter key’

Our Linux VM is successfully connected on azure using password.
PART 2: Creating a Linux VM Using SSH Authentication
Step 8: To connect to the Linux VM via SSH
On azure portal, create a virtual machine, fill in the following

Fill in the boxes

Input these, then create

Validation is successful, click on ‘create’

Download private key and create resources

Wait for deployment to be successful, then go to resource

Click on connect, then connect. On the SSH command, click on edit setting, copy the downloaded pem_key and paste, then run the command on the terminal

On the terminal, paste the file path and run the command

🎉 Our Linux VM is now connected using the SSH authentication and its live and accessible on Azure!
On your terminal, run sudo apt update, sudo apt upgrade -y, install Nginx (sudo apt install nginx -y). copy the IP address on azure portal and paste on the a new window to ensure the nginx is showing.

Conclusion
Azure Linux Virtual Machines support multiple authentication methods to suit different environments. Starting with username and password authentication helps beginners understand VM access, while transitioning to SSH key authentication aligns with DevOps and security best practices.
Mastering both methods is essential for any Cloud DevOps Engineer working with Azure infrastructure.




