Azure -Windows VM RDP Port got disabled on MS Firewall

Hello All,

On today Scenario i will demonstrate how to recover from a mistake where you have blocked the RDP Port within your Local MS Firewall.

In my Demo i used a windows 2016 Datacenter.

for this Demo I have created a Rule to block RDP Requests.

Once i press finish I got thrown from that session.

Below we can see the connection got cut and we are not able to reach the VM via RDP.


Recover Steps:

  • Navigate to Azure Portal
  • Go to the VM facing that issue
  • Select Extension and Press +ADD
  • On you Desktop create a Files and insert the below

PS C:\Users\tzachie\Desktop> cat .\disable_MSFW_All_Profiles.ps1

Set-NetFirewallProfile -Profile Domain,Public,Private -Enabled False

Save the Files as with any name you like i gave it this name disable_MSFW_All_Profiles.Ps1 Powershell

Upload the Ps1 file you have created.

Verify that the Extension was provisioned succeeded







Testing the Port from PowerShell

Port is responsive.

You should be able to RDP Now.


This is the current Firewall state (VM is at Risk)

-Fix your Firewall rules soon as possible and Turn On MS Firewall.


Healthy  MS Firewall state.

If you get stuck during the Process or this debug is not for You Please raise a ticket to Our Support and an engineer will help you to Mitigate the issue.


Thank You,

Tzachi Elkabatz