Enabling Remote Desktop in Windows Azure with Visual Studio
Remote Desktop enables you to access the desktop of a role instance running in Windows Azure. You can use a remote desktop connection to configure the virtual machine or troubleshoot problems with your application. Windows Azure Tools for Microsoft Visual Studio, which is included in Windows Azure SDK for .NET, lets you configure Remote Desktop Services from a Windows Azure project in Visual Studio.
This task includes the following steps:
Step 1: Configure Remote Desktop connections
When you are working on a Windows Azure project in Visual Studio, you have the option of configuring Remote Desktop for the application's role instances, which would allow you to remotely connect to the role instances after the application has been published.
Note: To perform this step, you need an application that's ready to be published.
-
In a Windows Azure project in Visual Studio 2010, open Solution Explorer, right-click the name of your project, and then click Configure Remote Desktop.
The Remote Desktop Configuration dialog box appears.

- In the Remote Desktop Configuration dialog box, select the Enable connections for all roles check box.
- In the certificate drop-down list, leave it on Automatic, which means an appropriate certificate from your current certificate store will be automatically selected or a new one will be created if an appropriate one doesn't exist. Alternatively, you can pick a certificate to use or create a new one.
- In the User name, Password, and Confirm password fields, enter the user name and password you want to use to remotely log on to a role instance.
- (Optional) In the Account expiration date field, enter a date for the user account to expire on the role instances.
- Click OK.
Visual Studio then inserts remote desktop settings and certificate details into the service configuration and service definition files for your application.
Step 2: Publish the application
To move the remote desktop settings in your service configuration and service definition files to Windows Azure and to upload the certificate required by Remote Desktop connections, you need to publish the application.
-
In Solution Explorer, right-click the name of your project, and click Publish.
The Publish Windows Azure Application wizard appears.

- On the Windows Azure Publish Sign In page, select the named authentication credentials you want to use, and then click Next. For more information, see Setting Up Named Authentication Credentials.
- On the Windows Azure Publish Settings page, select the hosted service in which to publish the application, production or staging environment, the build configuration, and the service configuration. Make sure Remote desktop connections for all roles is selected, and then click Next.
- On the Windows Azure Publish Summary page, review the settings, and then click Publish.
Visual Studio starts the publishing process of packaging the application and then deploying it to Windows Azure. After several minutes, the deployment is completed.
Step 3: Connect to the role instance
After the application is deployed, you use the Windows Azure Management Portal to initiate the connection to one of the role instances.
- Open the Windows Azure Management Portal.
- In the lower navigation pane of the Management Portal, click Hosted Services, Storage Accounts, & CDN.
- In the upper navigation pane, click Hosted Services. The hosted service in which your newly deployed application is running appears in the portal listed under your subscription.
-
Under the deployment, select a role instance, and then click Connect.

-
When prompted to open or save the .rdp file, click Open.

-
If you receive the Remote Desktop Connection security warning, click Connect.

-
In the Windows Security dialog box, enter the user name and password that you specified when you configured the Remote Desktop Connection settings in Visual Studio earlier, and then click OK.

The Remote Desktop Connection session opens on the Windows Azure role instance.
Congratulations! You have successfully enabled Remote Desktop Connection for your role instances and can log on to them whenever you need to manage your application on the instance itself.
Additional Resources