Simplifying Azure Bastion - 4 Connecting to Linux VMs using Azure Bastion over SSH

@20aman    Apr 10, 2021

In the previous blog, we saw how to RDP to a Windows VM using Bastion. In this post, we will look at how to SSH to a Linux VM using the Bastion service.

To connect to the VM via Bastion, first, navigate to the Linux VM in Azure. Click on the Connect button. In the pop-out menu, click on the Bastion option.

Bastion Option

Next, click on the Use Bastion button on the next screen.

Use Bastion button

In the next screen to "Connect using Azure Bastion" make note of the following:

  1. At the top you will see the Bastion host being used for the connection. This is for your information only. You do not need to take any action here. You may need this if you run into any issues and have to troubleshoot.
  2. I recommend leaving the check box for "Open in new window" checked. This ensures that the connection opens in a new tab or window and uses the maximum area. If you uncheck this then the connection will open in a new blade to the right and the view will be limited.
  3. Next provide the Username that will be used to connect via SSH to the Linux VM
  4. Authentication type is important. Select the one that you want to leverage. The next entry will update as per the selection here.
  5. Provide the additional information for the selection you made in the previous point.
  6. The advanced settings are optional and can be skipped. This does not relate to all authentication types.
  7. Finally click on the Connect button to connect to the VM

The options for authentication types are as follows:

  1. Password - This is to use the normal username and password-based authentication
  2. SSH Private Key - This option is used when you want to provide the key phrase manually
  3. SSH Private Key from Local File - This is to upload the private key file from the local computer. You can optionally provide a passphrase for this.
  4. SSH Private Key from Azure Key Vault - This is to use a private key file that you have previously uploaded to the Azure Key Vault.
Connecting via Bastion

Once you click on the Connect button, the SSH session to the VM opens up in a new tab.

Connected VM

Note: Almost all the Caveats from the previous blog for RDP to Windows VM also apply to the SSH to Linux VMs.