Skip to main content

Command Palette

Search for a command to run...

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

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

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:

  1. Create a Linux VM using username and password authentication

  2. Connect to the VM using password-based SSH

  3. 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

  1. Open your browser and navigate to portal.azure.com

  2. Sign in with your Microsoft credentials

    Step 2: Create a New Virtual Machine

    1. From the Azure dashboard, click Create a resource

    2. Select Virtual Machine

    3. Click CreateAzure 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)


Step 4: Configure Administrator Account (Username & Password)

  1. Authentication type: Password

  2. Username: hagital

  3. Password: Create a strong password

  4. 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

  1. Click Review + Create

  2. Confirm validation passed

  3. 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

  1. Navigate to the overview page, click on ‘connect’ then ‘connect’

  2. Copy the SSH command, run on a terminal

  3. Follow the prompt

  4. 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.

More from this blog

IniDevOpsLab

11 posts