Search code examples
azureremote-accessazure-virtual-machinepowershell-remoting

Unable to connect to Azure VM after changing RDP Port to 443


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.


Solution

  • 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.