Troubleshooting Microsoft Azure VM Remote Desktop Connections

In this Ask the Admin, I’ll show you how to reestablish a connection to an Azure VM where the Remote Desktop settings have accidentally been changed or disabled.

Out-of-band management on Azure VMs running in the public cloud can be a little harder compared to VMs hosted by on-premise Hyper-V servers because there’s no direct access to the VMbus. But the VM guest agent can be a life saver in situations where VMs stop responding, can no longer be connected to using Remote Desktop, or where you need to perform some other management operation to restore service.

The VM Agent installs a set of extensions that you can interface with from the command-line and in out-of-band management situations, including VMAccessAgent for resetting passwords and Remote Desktop configuration, and IaaSDiagnostics, which enables and configures Azure Diagnostics.

Fix Remote Desktop using an SDP package

To demonstrate how these extensions can be used in practice, I’ll attempt to regain access to an Azure VM where Remote Desktop has been inadvertently disabled. The easiest way to do this is generate a Support Diagnostics Platform (SDP) package, which you can either distribute or use yourself for troubleshooting the problem.

Create a Support Diagnostics Platform package on Microsoft's website (Image Credit: Russell Smith)
Create a Support Diagnostics Platform package on Microsoft’s website (Image Credit: Russell Smith)

First let’s generate an SDP package using Microsoft’s Support Diagnostics website. You’ll need to be logged in as a local administrator to Windows 8 or Windows Server 2012 or later to run the package, and the VM that’s experiencing a Remote Desktop problem must be started.

  • On the Support Diagnostics page, type iaas into the box below Diagnostic Packages and click the search icon.
  • Now click Microsoft Azure IaaS (Windows) diagnostics package in the results.
  • Leave the Session Name set to Microsoft Azure IaaS (Windows) diagnostics package, optionally enter a tracking ID, and then click Create.

The browser will prompt you to run or save the application. You can choose as appropriate.

  • Run the downloaded application directly from the browser or from the saved location.
  • In the Microsoft Automated Troubleshooting Services dialog, click Run now on this PC.
  • Agree to the terms and conditions by clicking Accept.
  • On the Azure VM Troubleshooter (Windows) screen, click Start. The tool will use the VMAccessAgent extension on the remote computer.

The troubleshooter will download the Azure PowerShell Module, which might take a few minutes.

  • On the Authenticate to Azure Subscription screen, click Next.
  • Enter your Microsoft ID into the Sign in to Windows Azure PowerShell dialog, and click Continue.
  • Now enter your password and click Sign in.
  • On the Azure Subscription Selection screen, select the subscription that you want to connect to, and click Next.
  • On the authorization screen, select I authorize Azure VM data collection, and click Next.
  • On the Azure Storage Account Selection screen, select the storage account you want the troubleshooter to analyze, and click Next. Select the storage account that holds your VM’s disks.
  • On the Which of the following issues are you experiencing with your Azure VM? screen, select *RDP connectivity to a Azure VM (Reboot Required), and click Next.
  • On the Select Virtual Machines screen, check the VM that has a Remote Desktop problem, and click Next.
Choose the type of fix you want to run on the remote Azure VM (Image Credit: Russell Smith)
Choose the type of fix you want to run on the remote Azure VM (Image Credit: Russell Smith)

The troubleshooter will execute the RDP Fix using the agent on the remote device. This can take a long time to complete, ranging from 10 minutes or more.

Once the troubleshooter has finished running all the tasks on the remote VM, you will see a message saying that the VM is restarting. After the reboot, you’ll be presented with a Remote Desktop dialog box so that you can test connectivity to the VM, and it should work as expected.

  • In the troubleshooter, either close the dialog if you don’t want to process the logs, or click Next on the Review the diagnostic results before you send them screen.
  • On the Send diagnostic data to Microsoft screen, you can opt to save a copy of the logs by clicking Save a copy, or click Send to have the logs sent to Microsoft.
  • Click Close to finish the process.