Monday, October 16, 2017

How to change the default RDP port in Azure VM

Changing an RDP default port in a Server is not a rocket science. But to do that in a VM which is hosted in the Azure environment will make more troubles if you failed to follow the correct steps.

The first thing that I recommend is to keep another server in the same resource group and the same subnet.

Then, even if you make a mistake, then you have a way of accessing your registry by using your secondary VM.

Once you ready to change the  RDP port, logged into your VM through the RDP and open the Registry Editor.

Then go into below location,

HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp\PortNumber

image

Default port will be 3389 and as you can see above change that to the port that you want.

Before doing any changes make sure that you have allowed the firewall for this port or to do the testing disable the Windows firewall

Click Ok and restart the VM.

Now go into the Azure portal and the Networking pane under settings. There you can find the default RDP endpoint which was created earlier.

Edit that and change the RDP inbound port as you configured in your VM. Same port needs to be in the both the configuration files.

image

Now  open the RDP connection and give the VM IP and the port as mentioned in the below print screen.

image

This will help you to minimize the brute force attacks to your Azure VM.

No comments: