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
- Right Click and Publish the Project. It will open Deploy Windows Azure Project windows will popup
- Click the Configure Remote Desktop connections… link. It will open Remote Desktop Configuration window.
Under the Certificate selection dropdown box, click the Create option.
- Enter a friendly name of the certificate. Click OK
- In the Remote Desktop Connection window, enter the User name, Password and Expiry Date. Click OK.
- 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.
- Open Certificate Management Console by running certmgr.msc command In Run window.
- 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).
- Right click the Certificate select All TasksExport menu. It will open Certificate Export Wizard window. Press Next.
- In the Export Private Key window, select Yes, export the private key and press Next.
- In the Export file format window, Accept the default selection and press Next.
- In the password window, give the Password and press Next.
- Provide the file path with file name and press Next.
- Press Finish. It will export the file in .pfx format at the selected folder and show a message.
- Create a New Hosting service in Azure Management Portal by selecting New Hosting Service icon.
- Provide Service Name, url as defined in the figure and select the published package from Visual Studio.
- Click Add Certificate button for adding certificate.
- Enter Certificate file, Password and press OK.
- In the Create a New Hosting Service window, Press OK.
- If only one instance running with the role, there will be a warning message. Press Yes.
- The Management Portal will upload the package and create related deployment process.
- 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.
- By clicking the instance of the role, the Connect icon will be enabled in the Remote Desktop section.
- By opening the rdp file, it will show Remote Desktop Connection window. Press Connect.
- It will show Windows Security window to enter the User name and Password to access the remote desktop.
- The system will connect the Remote Desktop of the Web role instance.