Share via


Losing the Remote Desktop (RDP) connectivity with Cloud Services targeting Window Azure SDK 1.7/ SDK 1.8

In recent past I have noticed that, the customer’s who leveraging Windows Azure SDK 1.7 / SDK 1.8 complaining that intermittently they were unable to rdp into their VM, and sometimes issue should be resolved after couple of reboot/reimage of corresponding VM. So I have done an investigation for one of such customer’s , and noticed that this is caused by a know issue with Windows Azure SDK 1.7 / SDK1.8, which is fixed in the latest Windows Azure SDK 2.0. However. I am aware that, there are still  lots of developers, who leverages Windows Azure SDK 1.7/ SDK 1.8 for developing Cloud Services (Web/Worker Role) , and if your one of the such person, and hitting the remote desktop connectivity issue,  please go through this blog.

Cause: [RDP Issue]
A timing issue in role startup in SDK versions 1.7 and 1.8 (or even older version) sometimes causes a firewall rule required by the Remote Forwarder Service to be deleted.  Restart of the service will correct the problem and recreate the firewall rule but this is not a persistent fix.  Any redeployment or restart of the role instance may cause the problem to reoccur.
 
Work Around:
Azure application developers can implement a custom startup task that refers to a .cmd (eg RemoteForwarderConfig.cmd) file with the following contents.  This will ensure a firewall rule is created that opens ports for the Remote Forwarder Service.  This startup task should be added to the role designated for running the remote forwarder, see note under Symptoms above.  Documentation on startup tasks is available at https://msdn.microsoft.com/en-us/library/windowsazure/gg456327.aspx
 
Example task config:

<snip>

<Startup>
       <Task commandLine="RemoteForwarderConfig.cmd" executionContext="elevated" taskType="background"></Task>                                          </Startup>

<snip>
 
RemoteForwarderConfig.cmd cmd file’s contents:

@echo off
netsh advfirewall firewall add rule name="RemoteForwarderService custom rule" description="Allow incoming connections to the remote forwarder" dir=in protocol=tcp program="%ProgramFiles%\Windows Azure Remote Forwarder\RemoteForwarder\RemoteForwarderService.exe" action=allow enable=yes
sc start WaRemoteForwarderService

Reference :

You can download the latest Windows Azure SDK package from here