Q: I disabled RDP on my Azure virtual machine; how can I re-enable it?
A: As long as your virtual machine has the Azure VM Agent installed, it's very simple to fix the RDP configuration on the virtual machine using PowerShell. To check whether the VM Agent is installed, run the following command:
Get-AzureVM –ServiceName <service> -Name <vm>
Note whether the GuestAgentStatus is populated. To enable RDP and ensure the required firewall exception is enabled, run the following command:
Get-AzureVM –ServiceName <service> -Name <vm> | Set-AzureVMAccessExtension | Update-AzureVM
You should now be able to RDP to the server. If you still can't connect to the virtual machine, try restarting it. If you still can't connect, you can try a few other fixes, such as recreating the endpoint, moving the virtual machine to another Azure host by changing the virtual machine configuration, and even recreating the virtual machine. Microsoft has a great blog post, "Troubleshooting Endpoint Connectivity (RDP/SSH/HTTP, etc. failures)," that walks through troubleshooting RDP connectivity.