Changing RDP port for Virtual Machine

Rajat Srivastava 40 Reputation points
2023-11-02T13:10:34.4433333+00:00

Can someone tell me, is this the option for changing the RDP port for Azure Virtual Machine?

I changed the port to 8080, allowed incoming for the same in my NSG. (I know it's not required, I also allowed that in the windows firewall of the Virtual Machine). But I was still not able to take RDP on port 8080.

What am I missing? Can anyone help?

User's image

Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
7,585 questions
{count} votes

Accepted answer
  1. Andreas Baumgarten 104K Reputation points MVP
    2023-11-02T13:38:20.4666667+00:00

    Hi @Rajat Srivastava ,

    beside configuring the NSG for the new port of RDP the OS needs to be configured listening on the new port RDP should listen as well.

    You can get this done by PowerShell executed on the VM:

    $newRDPPort = "8080" # new listening port for RDP
    Set-ItemProperty -Path “HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-TCP\” -Name PortNumber -Value $newRDPPort
    New-NetFirewallRule -DisplayName “RDP New Port” -Direction Inbound –LocalPort $newRDPPort -Protocol TCP -Action Allow
    

    (If the reply was helpful please don't forget to upvote and/or accept as answer, thank you)

    Regards Andreas Baumgarten

    0 comments No comments

0 additional answers

Sort by: Most helpful