Connect to Azure Linux Host Using SSH from VS Code

This blog post will show how to connect to a Linux VM running in Azure using SSH from Visual Studio Code (VS Code).

When we create a Linux virtual machine (VM) in Azure, we are provided with the option to connect to it using SSH protocol and can access the VM over the internet using port 22. In this post, I will explain how to safely SSH to a Ubuntu Linux VM using an SSH key generated by Azure.

In this post, I’m going to SSH to a Ubuntu Linux VM using an SSH Key generated by Azure, which is the safest method of connecting.

SSH Config File

When creating a VM in Azure, Azure generates a private key for us to download. The private key has a file extension of .pem.

Save the file on your machine and open VS Code.

By default, if you are using a Windows machine like me, your SSH configuration file is located at

Open the file and add the following entry to it (you will need the details of your VM).

Save the file and Open VS Code.

From the bottom left corner, click on Connect

Select Connect to Host

Select the name of the VM you configured on the config file (Host)

Follow the prompt until you connect to the VM. Once connected you will see the host’s name in the connection icon.

Success! You're on the list.



, ,



Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.