Azure Linux Remote Desktop



How to connect to a Linux VM using RDP (Remote Desktop Protocol) or X2Go remote desktop clients Set up graphical remote desktop solution When a lab is created from a Linux image, SSH (Secure Shell) access is automatically configured so that the instructor can connect to the template VM from the command line using SSH. Video covers how you can connect to a Linux VM on Microsoft Azure (IaaS). Steps include Azure specific steps such as enabling Remote Desktop endpoint for th. The Remote Desktop Protocol (RDP) connection to your Windows-based Azure virtual machine (VM) can fail for various reasons, leaving you unable to access your VM. The issue can be with the Remote Desktop service on the VM, the network connection, or the Remote Desktop client on your host computer.

Now that we have a Windows VM in Azure, the next thing you’ll do is put your applications and data on those VMs to process our traffic videos.

However, unless you’ve set up a site-to-site VPN to Azure, your Azure VMs won’t be accessible from your local network. If you’re just getting started with Azure, it’s unlikely that you have a working site-to-site VPN. So how can you transfer files to Azure VMs? One easy way is to use Azure’s Remote Desktop Connections feature to share your local drives with your new Azure VMs.

Now that we have a new Windows virtual machine, we need to install our custom software onto it. There are several options to choose from:

  • Remote Desktop Protocol (RDP)
  • Custom scripts
  • Custom VM images (with the software preinstalled)

Let's look at the simplest approach for Windows VMs: Remote Desktop.

What is the Remote Desktop Protocol?

Remote Desktop (RDP) provides remote connectivity to the UI of Windows-based computers. RDP enables you to sign in to a remote physical or virtual Windows computer and control that computer as if you were seated at the console. An RDP connection enables you to carry out the vast majority of operations that you can do from the console of a physical computer, with the exception of some power and hardware-related functions.

An RDP connection requires an RDP client. Microsoft provides RDP clients for the following operating systems:

  • Windows (built-in)
  • macOS
  • iOS
  • Android

The following screenshot displays the Remote Desktop Protocol client in Windows 10.

There are also open-source Linux clients, such as Remmina that enable you to connect to a Windows PC from an Ubuntu distribution.

Connecting to an Azure VM

Azure

As we saw a moment ago, Azure VMs communicate on a virtual network. They can also have an optional public IP address assigned to them. With a public IP, we can communicate with the VM over the Internet. Alternatively, we can set up a virtual private network (VPN) that connects our on-premises network to Azure - letting us securely connect to the VM without exposing a public IP. This approach is covered in another module and is fully documented if you are interested in exploring that option.

Azure Linux Remote Desktop To Windows

One thing to be aware of with public IP addresses in Azure is they're often dynamically allocated. That means the IP address can change over time - for VMs this happens when the VM is restarted. You can pay more to assign static addresses if you want to connect directly to an IP address instead of a name and need to ensure that the IP address won't change.

How do you connect to a VM in Azure using RDP?

Connecting to a VM in Azure using RDP is a simple process. In the Azure portal, you go to the properties of your VM, and at the top, click Connect. This will show you the IP addresses assigned to the VM and give you the option to download a preconfigured.rdp file that Windows then opens in the RDP client. You can choose to connect over the public IP address of the VM in the RDP file. Instead, if you're connecting over VPN or ExpressRoute, you can select the internal IP address. You can also select the port number for the connection.

If you're using a static public IP address for the VM, you can save the .rdp file to your desktop. If you're using dynamic IP addressing, the .rdp file only remains valid while the VM is running. If you stop and restart the VM, you must download another .rdp file.

Tip

You can also enter the public IP address of the VM into the Windows RDP client and click Connect.

When you connect, you'll typically receive two warnings. These are:

  • Publisher warning - caused by the .rdp file not being publicly signed.
  • Certificate warning - caused by the machine certificate not being trusted.

In test environments, these warnings can be ignored. In production environments, the .rdp file can be signed using RDPSIGN.EXE and the machine certificate placed in the client's Trusted Root Certification Authorities store.

Some days ago Chris Pietschmann wrote about How to Setup an Ubuntu Linux VM in Azure with Remote Desktop (RDP) Access(great job certainly), and in a little ping pong messages I ask about how to enable another Desktop GUI that be more “attractive” to the users (GNOME or Ubuntu Desktop)… Chris said that he tried with Ubuntu desktop, but something goes wrong with xRDP (the server for RDP for X Window)… and the challenge was born!… and here we are…

First that all… I want to recognize that I didn’t reinvent the wheel… I just put some pieces of the puzzle together :0).

I’ll to obviate the explanation about the support for RDP in Linux and the process to create an Ubuntu VM in Azure, for more detail go to the blog entry mentioned above…

When you get your Ubuntu VM up and running… connect via ssh (I use the Ubuntu bash in my Windows 10…) and do the next:

First you need to install Unity Desktop GUI (obviously):

  • To install Unity run the next commands in your terminal session:
    • sudo apt-get update
  • Restart the VM by the Azure portal

Azure Linux Vm Remote Desktop

You can see that the Unity Desktop is installed by using Boot diagnostics in the Azure portal


The next task that we need to do is to install and configure xRDP

  • Create a Downloads folder under your home directory, and go to there:
    • mkdir Downloads
    • cd Downloads
  • Download the next zip file (that contains the script to install and configure xRDP for Unity Interface).. I’ll give credits to Griffon who’s wrote the original one install-xrdp-1.9.1.zip
    • wget -O /home/terminator/Downloads https://tym1zq.bn.files.1drv.com/y4mWThEWEC0iKojSq34rQCdsw4GdG0dkbpLTLPMHJRT6AXndOq1f8rZ2VvTAi2g9lpg3CFrHKnG9XcF5FXPeR9FdOjdg9Oyvu8BIlxY4xXLR1HsI-1vRM4SIGr5Ik39gzKceZL3fqgROkVn3aMmYZEQI6xrFfVLYyMfC-RvBFjYGxLCNp8BpuqRu_LFVsVfAdi-/install-xrdp-1.9.1.zip
    • sudo apt-get install unzip
    • unzip install-xrdp-1.9.1.zip
    • chmod +x ~/Downloads/install-xrdp-1.9.1.sh

    The last image resumes the previous steps…

    And execute that! :O) (you can go to take a coffee in the while…)

    • sudo ./install-xrdp-1.9.1.sh

    … when the process ends (and you have tasted your coffee…) test the connection… is I posted in a Tweet reply to @BuildAzure if you use the Windows RDP client (mstsc.exe) the performance get slow… but if you use another one (for example FreeRDP) the connection works fine… according to some post in some blogs the issue is with the RemoteFX feature (in the client side)…

Azure Linux Remote Desktop Client


Linux Mint Remote Desktop

That’s all folks!