Troubleshoot RDP issues for Azure VM

In this blog post, we will discuss how to Enable a disabled  RDP in Azure VM using the VM’s serial console. 

if you want to know more about the Azure VM serial console. please have a look at my previous blog post – 
http://techtalk.cloud/how-to-connect-to-an-azure-vm-using-the-serial-console/

One of my customers accidentally disabled the RDP for one of his Azure VM and he was unable to connect to the VM using its IP address. I simulated this scenario in my lab by disabling the RDP for one of my test VM 

Turned Off RDP for a test VM

After turning off the RDP, VM wasn’t accessible for remote desktop. I then connected to the VM using its Azure serial console and launched the PowerShell session and ran the following command: 

Set-ItemProperty -Path ‘HKLM:\System\CurrentControlSet\Control\Terminal Server’ -name “fDenyTSConnections” -value 0

Somehow I couldn’t run this command in one line, so I used set-itemproperty and filled all the information as it’s displayed in the print screen

Enabling RDP Connection using PowerShell

I also needed to run Enable-NetFirewallRule and then only I was able to enable the RDP connection

Cheers!!