1

I have set up an Azure virtual machine running Windows 10 Client. As per the below post I changed the RDP Port to 443 but didn't add the VM Firewall Rule and restarted the VM. New Azure portal (no End Points) how to connect to VM with RDP from behind a firewall Now I am unable to connect to my Azure VM. I tried the following things 1) Unable to connect to remote Powershell since WinRM is disabled. I tried enabling it but somehow not working 2) Read about attaching this VM hard disk to second VM and loading the registry in second VM. But not sure how to do it.

Any suggestions.

Shui shengbao
  • 18,746
  • 3
  • 27
  • 45
masthi
  • 23
  • 5

2 Answers2

2

You could use Azure Custom Script Extension to open port on Windows Firewall. Please refer to the following steps:

1.Start your VM.

2.Write a script to open port on Windows firewall. Like below:

netsh advfirewall firewall add rule name="Open Port 443" dir=in action=allow protocol=TCP localport=443

3.Execute this script by Custom Script Extension, you could do it on Azure Portal. Your VM-->Extensions-->+--> Custom Script Extension

enter image description here

Note: You also need open port 443 on Azure NSG. When you select Service, select Custom not https.

Community
  • 1
  • 1
Shui shengbao
  • 18,746
  • 3
  • 27
  • 45
  • Thanks Walter. That worked like a charm. I have been trying to install this extension through PowerShell Command but didnt worked. Instead of running your command I ran the following command to change the port back to 3389 and rebooted the VM and it worked. – masthi Sep 25 '17 at 10:14
  • 1
    Forgot to add the command Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-TCP\" -Name PortNumber -Value 3389 – masthi Sep 25 '17 at 10:15
0

you may restore default port using "RUN COMMAND" option

follow the below steps:

  1. choose desired VM machine
  2. Click on "Run Command" from the left menu panel
  3. Choose "SetRDPPort" from the Command "Name" List
  4. Enter "Port Number" that you want to or 3389 for default
  5. Click on "Run" button
  6. It will take 2 minutes to finish and your RDP port will be changed and added to the VM firewall as well.
  7. Restart VM Machine
  8. Now you can access your machine via RDP

Furthermore, refer picture below for better understanding,

enter image description here

Haseeb
  • 746
  • 7
  • 22