Fixing RDP Connectivity Issue with a Windows VM in Azure

When making system changes to a Windows virtual machine running in Azure it is possible to accidentally block RDP access.  This could happen in a number of ways:

  • Making changes to Windows Firewall
  • Changes made to the registry
  • Turning off Remote Desktop

To regain RDP connectivity to your virtual machine you can use the PowerShell Set-AzureVMAccessExtension cmdlet.   Below is a sample script that shows how to use the cmdlet.  Replace the VM name and the cloud service name with the appropriate values for your environment.

Add-AzureAccount
Get-AzureVM –Name MyVM –ServiceName MyVMService |Set-AzureVMAccessExtension | Update-AzureVM

Once you have run the script, use the Azure Management portal to reboot the virtual machine.  Once it has restarted you should be able to use Remote Desktop to connect.

To learn more about the VM extensions check out the blog post VM Agent and Extensions – Part 1

Leave a Reply