SALES: 1-800-867-1380

Set Up a Remote Desktop Connection for a Role in Azure

Updated: May 9, 2014

After you create a cloud service that is running your application, you can remotely access a role instance in that application to configure settings or troubleshoot issues. How you set up a remote desktop connection depends on the type of role instance that you are using and the environment you are working in.

The following information can help you set up and use a remote desktop connection:

To enable a remote desktop connection for a web role or worker role, you can set up the connection in the service model for the application, or you can use the Azure Management Portal to set up the connection after the instances are running.

The Imports element must be added to the service definition file that imports the RemoteAccess module and the RemoteForwarder module into the service model. When you create an Azure project by using Visual Studio, the files for the service model are created for you.

The service model consists of a ServiceDefinition.csdef file and a ServiceConfiguration.cscfg file. The definition file is packaged with the role binaries when the application for the cloud service is prepared for deployment. The ServiceConfiguration.cscfg file is deployed with the application package and is used by Azure to determine how the application should run. For more information about the ServiceDefinition.csdef file, see Set Up a Cloud Service for Azure. For more information about creating a project, see Creating an Azure Project with Visual Studio.

After you create your project, you can enable a remote desktop connection by using the information in Using Remote Desktop with Azure Roles.

After you configure the connection, the service definition file should be similar to the following example with the Imports element added.


<ServiceDefinition name="<name-of-cloud-service>" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceDefinition" schemaVersion="2013-03.2.0">
  <WebRole name="WebRole1" vmsize="Small">
    <Sites>
      <Site name="Web">
        <Bindings>
          <Binding name="Endpoint1" endpointName="Endpoint1" />
        </Bindings>
      </Site>
    </Sites>
    <Endpoints>
      <InputEndpoint name="Endpoint1" protocol="http" port="80" />
    </Endpoints>
    <Imports>
      <Import moduleName="Diagnostics" />
      <Import moduleName="RemoteAccess" />
      <Import moduleName="RemoteForwarder" />
    </Imports>
  </WebRole>
</ServiceDefinition>

The service configuration file should be similar to the following example with the values that you provided when you set up the connection:


<?xml version="1.0" encoding="utf-8"?>
<ServiceConfiguration serviceName="<name-of-cloud-service>" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceConfiguration" osFamily="3" osVersion="*" schemaVersion="2013-03.2.0">
  <Role name="WebRole1">
    <Instances count="2" />
    <ConfigurationSettings>
      <Setting name="Microsoft.WindowsAzure.Plugins.RemoteAccess.Enabled" value="true" />
      <Setting name="Microsoft.WindowsAzure.Plugins.RemoteAccess.AccountUsername" value="<name-of-user-account>" />
      <Setting name="Microsoft.WindowsAzure.Plugins.RemoteAccess.AccountEncryptedPassword" value="<base-64-encrypted-password>" />
      <Setting name="Microsoft.WindowsAzure.Plugins.RemoteAccess.AccountExpiration" value="<certificate-expiration>" />
      <Setting name="Microsoft.WindowsAzure.Plugins.RemoteForwarder.Enabled" value="true" />
    </ConfigurationSettings>
    <Certificates>
      <Certificate name="Microsoft.WindowsAzure.Plugins.RemoteAccess.PasswordEncryption" thumbprint="<certificate-thumbprint>" thumbprintAlgorithm="sha1" />
    </Certificates>
  </Role>
</ServiceConfiguration>

When you package and publish the application, you must ensure that the Enable Remote Desktop for all Roles check box is selected. For more information, see Publishing a Cloud Service using the Azure Tools.

On the Configure page for your cloud service, you can enable or modify remote desktop connection settings. For more information, see Configure remote access to role instances.

To enable a remote desktop connection for a Virtual Machine, an input endpoint must be added to the machine that specifies the port to use for the connection. You can set up an input endpoint by using the Management Portal. For more information, see How to Set Up Endpoints to a Virtual Machine. You can also add an input endpoint when you programmatically create the machine by using the Service Management REST APIs. For more information, see the InputEndpoints element in Create Virtual Machine Deployment.

To access instances of web roles, worker roles, or Virtual Machines, you must use a remote desktop protocol (RDP) file. You can download the file from the Management Portal or you can programmatically retrieve the file.

You can use the following steps to retrieve the RDP file from the Management Portal and then use Remote Desktop Connection to connect to the instance using the file:

  1. On the Instances page, select the instance, and then click Connect on the command bar.

  2. Click Save to save the remote desktop protocol file to your local computer.

  3. Open Remote Desktop Connection, click Show Options, and then click Open.

  4. Browse to the location where you saved the RDP file, select the file, click Open, and then click Connect. Follow the instructions to complete the connection.

You can use the Get-AzureRemoteDesktopFile cmdlet to retrieve the RDP file. For more information, see Log on to a Virtual Machine by using a Remote Desktop Connection.

In Visual Studio, you can use the Server Explorer to create a remote desktop connection.

  1. In Server Explorer, expand the Azure Compute node or the Azure Virtual Machines node.

  2. Complete one of the following:

    • For web roles or worker roles, expand the cloud service node, expand the role node, right-click an instance node, click Connect using Remote Desktop, and then enter the user name and password.

    • For Virtual Machines, right-click the Virtual Machine node, click Connect using Remote Desktop, and then enter the user name and password.

You can use the Download RDP File REST operation to download the RDP file. You can then use the RDP file with Remote Desktop Connection to access the Virtual Machine.

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft