- A Microsoft Azure account ( You can use a free trial if you do not have one)
- An existing Linux Virtual Machine that has been already deployed to a resource group.
By default, connecting to a Linux VM in Azure is usually done over an SSH Connection.
In this post, I 'am going to show you how to RDP/ Remote Desktop into a Linux VM (Ubuntu) so that you can manage it the traditional Windows way.
We are going to use xfce as our desktop environment for this scenario. There are many desktop environments and you can install any of your choice. However, my choice for xfce is because it's a lightweight desktop environment that reserves resources. And then, we shall also use xdrp which is an open source rdp manager.
SSH into your Linux virtual machine. Note that you can also open a serial connection to your Azure VM instead of an SSH connection, As shown below.
The serial console connection can be found at the Support + Troubleshooting section of your Azure VM Instance.
You will need to press enter at the serial console once it's done loading since it doesn't bring up login prompt immediately after it has loaded.
Once we are logged in, we then run the command below to install xfce.
sudo apt-get update sudo apt-get -y install xfce4
"For CentOS users, you will need to use the yum package manager to install xfce"
It takes about 5 minutes to install xfce.
When it's done installing, we then run the commands below to install and enable our remote desktop connection protocol for Linux, xrdp.
sudo apt-get -y install xrdp sudo systemctl enable xrdp
When that is done we configure xrdp to connect to our desktop environment session as shown in the command below and then finalize by restarting the xrdp service.
echo xfce4-session >~/.xsession sudo service xrdp restart
The last step involves creating a network security rule to allow rdp traffic into our VM and we can use the command below to achieve that through the Azure cloud shell as shown below.
Replace the resource-group name to your's in this case mine is tech-talk-rg1 and also the name of my vm is ubuntu-node01. RDP connects over port 3389 and this is the port we want to allow access.
Once that is done, we then connect to our vm using the usual windows remote desktop connection console and we get an xrdp session as shown below.