Deploying Ubuntu VM in Azure with Remote Desktop Access

Posted by Nicolas Prigent on September 10, 2019

When you deploy a new Linux Virtual Machine in Microsoft Azure, you can only connect to using SSH. The reason is Linux Virtual Machines do not support Remote Desktop (RDP) natively. It means that you must allow the 22 port number in the Network Security Group. Sometimes, it can be useful to enable RDP on a Linux Virtual Machine, so in this article, I will explain how to setup a Linux Virtual Machine in Azure with RDP access that you can use for testing purposes.

To enable RDP on the Linux VM, I will use the xrdp project which is an open source project that added Remote Desktop Protocol (RDP) support to Linux machines. The xrdp project let you connect to the Linux machine with a graphical user interface.

Setting up a Linux VM in Azure

The first thing to do is to deploy a new Linux Virtual Machine from the Azure Marketplace. Open the Azure portal and navigate to the Marketplace, select “Ubuntu Server”:

Azure Marketplace

Next, enter the information required about the Virtual Machine, such as:

  • the subscription,
  • the resource group,
  • the name of the VM,
  • the region where the VM will be located,
  • the size of the VM

Create a Virtual Machine

Then, select the authentication type between password and SSH key. Here, I choose username + password. Before validating the process, you must allow the following ports in the NSG:

  • 22 for SSH
  • 3389 for RDP

allow the ports in the NSG

You can review the configuration and close the wizard by clicking “Create”

Review the configuration

Connect to the Linux VM with Remote Desktop Client

Open the Virtual Machine blade and click “Connect”. You need to select “SSH” because RDP is not enabled. Download a SSH client such as “Putty” and connect to the VM using the information

 Remote Desktop Client

We must install LXDE using the following command:

Install LXDE

Then, install the xRDP project using the following command:

Install the xRDP project

Next, we need to start the xRDP service using the following command:

Start the xRDP service

Ok, everything is ready, so we can try to connect to the VM using the RDP access. Go back to the Virtual Machine blade and select “Download RDP File”:

“Download RDP File”

Run the RDP file and confirm that the following window appears:

Run the RDP file

To finish, you just need to enter the credentials created during the provisioning wizard:

Enter the credentials

Related materials:

Views All Time
Views Today
Return to all posts

[Azure] Discovering of KeyVault
How to Transfer Files to-and-from Ubuntu through Magic Wormhole