AzureUbuntu 22.04Full Guide

How to Create Ubuntu 22.04 VM in Azure

Step-by-step instructions from Portal setup to SSH connection.

Pre-requisites

1

Portal Configuration

  • 1. Login to the Azure Portal.
  • 2. Search for Virtual Machines and click Create > Azure Virtual Machine.
  • 3. Select your Subscription and create a new Resource Group (e.g., RG-Ubuntu-Lab).
  • 4. VM Name: MyUbuntuVM | Region: East US.
  • 5. Image: Select Ubuntu Server 22.04 LTS - x64 Gen2.
2

Authentication (SSH)

Choose SSH Public Key as the authentication type.

  • Username: azureuser
  • Key pair name: myUbuntuVM_key
Note: You will be prompted to download the .pem file later. Keep it safe!
3

Networking & Ports

Under the Networking tab:

  • Ensure NIC Public IP is created.
  • Select Allow selected ports.
  • Choose SSH (22).
  • Enable "Delete public IP and NIC when VM is deleted" to avoid extra costs.
4

Review and Create

Click Review + Create. Once validation passes, click Create. A popup will appear—click Download private key and create resource.

5

Connecting via SSH

Open your terminal and navigate to your Downloads folder. Run these commands:

1. Secure your Key

chmod 400 myUbuntuVM_key.pem

2. Connect to VM

ssh -i myUbuntuVM_key.pem azureuser@<YOUR_VM_PUBLIC_IP>

Verification

Once connected, you will see the Ubuntu welcome message in your terminal. Run the following to update your packages:

sudo apt update && sudo apt upgrade -y