DEV Community

Cover image for Deploying and Connecting to an Ubuntu Linux VM on Azure Using SSH Public Key Authentication
Kolarinde Awopetutimileyin
Kolarinde Awopetutimileyin

Posted on

Deploying and Connecting to an Ubuntu Linux VM on Azure Using SSH Public Key Authentication

Step 1 — Configure SSH Public Key Authentication


On the Create a virtual machine page under Administrator account, set Authentication type to SSH public key. Enter a username, leave SSH public key source as "Generate new key pair," keep the RSA SSH format, and name the key pair. Under Inbound port rules, allow selected ports and choose SSH (22), then click Review + create.

Step 2 — Review and Create the VM


On the Review + create tab, confirm validation has passed, review the basics summary (subscription, resource group, VM name, region), and click Create to start deployment. Azure will prompt you to download the private key (.pem) at this point — save it somewhere memorable.

Step 3 — Deployment in Progress


The deployment overview page shows "Deployment is in progress" while Azure provisions the network interface, network security group, and public IP address.

Step 4 — Deployment Complete


Once finished, the page updates to "Your deployment is complete." Click Go to resource, or use the linked resource group, to open the new VM.

Step 5 — Open the VM and Start Connecting


From the VM's Overview page, review the essentials (public IP, OS, size) and click Connect to view connection options.

Step 6 — View the Native SSH Command


On the Connect page under Native SSH, Azure displays the destination VM's IP/port and a partial SSH command showing a placeholder — a warning notes the private key file path is missing.

Step 7 — Locate and Copy the Private Key Path


In File Explorer (e.g. Downloads folder), right-click the downloaded .pem private key file and select Copy as path to grab its exact local file location.

Step 8 — Paste the Key Path into Azure


Back on the Connect panel, click Edit settings, paste the copied .pem file path into the "Provide a path to your SSH private key file" field, and save. Azure then assembles the complete SSH command with the key path included.

Step 9 — Connect via Command Prompt


Copy the completed SSH command (e.g. ssh -i "C:\Users\HomePC\Downloads\azureuser.pem" azureuser@20.237.186.3), paste it into Command Prompt, and press Enter to establish the SSH connection to the VM.

Top comments (0)