Sunday, 24 July 2011

Enabling Remote Desktop for Windows Azure Web Role

Microsoft introduced a new feature Remote Desktop with Windows Azure SDK 1.3. By using Remote Desktop, the developer can access the actual server which is running for the Role. So it is possible to do any configuration in the server directly or to troubleshoot if anything gone wrong with the Web/Worker roles.

This post provides steps to configure Remote Desktop to a Web Role.

Step 1 - Get the Azure Web Role project in Visual Studio.
For demo purpose I have created a Web Role Azure project in Visual Studio. The solution explorer looks as shows below.

Step 2 - Publish the Web Role by enabling Remote Desktop.
Certificate plays a major role to enable RDP for a Web Role. To enable RDP for a Web Role, the Web Role and the system should have common certificate installed. So while publishing Web Role from Visual Studio, it is important to upload a certificate with the Remote Desktop option. The steps as follows

  1. Right Click and Publish the Project. It will open Deploy Windows Azure Project windows will popup
    You have the option to deploy to Azure by creating and uploading package or directly to Windows Azure environment from Visual Studio. Here I am taking an example of creating package and upload to the Azure environment using Management Portal..
  2. Click the Configure Remote Desktop connections… link. It will open Remote Desktop Configuration window.
    Under the Certificate selection dropdown box, click the Create option.
  3. Enter a friendly name of the certificate. Click OK
  4. In the Remote Desktop Connection window, enter the User name, Password and Expiry Date. Click OK.
    The User name and Password is used to login into the Web Role system when RDP to the Role.
  5. In the Deploy Windows Azure Project window, click OK. The Visual Studio will create package and configuration files and popup that published folder.

Step 3 - Export the certificate from Certificate Management Console
Before uploading the package in Azure, it is important to get the certificate created in .pfx format from Certificate Management Console.

  1. Open Certificate Management Console by running certmgr.msc command In Run window.
  2. In the left side, expand PersonalCertificate tree nodes. The Console will list the certificates in the right hand side. There will be one certificate with Friendly Name column which given when created the certificate in Visual Studio (RDPWebRole).
  3. Right click the Certificate select All TasksExport menu. It will open Certificate Export Wizard window. Press Next.
  4. In the Export Private Key window, select Yes, export the private key and press Next.
  5. In the Export file format window, Accept the default selection and press Next.
  6. In the password window, give the Password and press Next.
    This is the password you required when installing the same certificate in another system to access RDP of the Web Role.
  7. Provide the file path with file name and press Next.
  8. Press Finish. It will export the file in .pfx format at the selected folder and show a message.

Step 4 - Creating Hosting Service in Management Portal
  1. Create a New Hosting service in Azure Management Portal by selecting New Hosting Service icon.
  2. Provide Service Name, url as defined in the figure and select the published package from Visual Studio.
  3. Click Add Certificate button for adding certificate.
  4. Enter Certificate file, Password and press OK.
  5. In the Create a New Hosting Service window, Press OK.
  6. If only one instance running with the role, there will be a warning message. Press Yes.
  7. The Management Portal will upload the package and create related deployment process.

Step 5 - Connecting the Role instance
  1. Once the deployment ready, select the role on the deployed service and verify the Enable checkbox selected in the Remote Access section on the top icons. If Remote Desktop required disabling for the selected role, can be done by un checking the Enable check box.
    The Configure is option used to change the User name and Password on remote desktop window.
  2. By clicking the instance of the role, the Connect icon will be enabled in the Remote Desktop section.
    Click the Connect icon to access the Remote Desktop of the instance. It will download an rdp file.
  3. By opening the rdp file, it will show Remote Desktop Connection window. Press Connect.
  4. It will show Windows Security window to enter the User name and Password to access the remote desktop.
    Click OK.
  5. The system will connect the Remote Desktop of the Web role instance.

1 Response to “Enabling Remote Desktop for Windows Azure Web Role”

  • Anonymous says:
    16 January 2013 at 05:00

    Nice and detailed information..Thank u

Post a Comment