Reputation: 1194
Mistakenly changed the windows firewall setting to Block all incoming connection including those in the allowed list
Now i am unable to take the RDP of the VM. so i can't reverse the option also
I tried reset the RDP configuration from the Azure portal but that also did not help..
How can i revert the change to take RDP of the VM now..??
Upvotes: 0
Views: 184
Reputation: 1194
Found the Solution finally...
1) Turn off the current VM.
2) Spin Up a new VM (VM2) and attach the OS disk from VM1 as a data disk. See this question for reference.
3) Boot VM2 and open registry
4) Load the registry hive from the attached OS disk of VM1. See this question for reference
5) Disable the firewall by looking for the following key EnableFirewall in HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\services\SharedAccess\Parameters\FirewallPolicy
See this question for reference
6) Unload the registry hive.
7) Turn off VM2 and remove the attach disk
8) Create a new Vm withe Detached disk access via RDP
Upvotes: 0
Reputation: 1161
You could take advantage of PowerShell DSC through Azure Automation to resolve this issue by having DSC enforce a firewall rule.
A number of components will be required though:
You can then use the following DSC script:
configuration AddRdpAccess
{
param
(
[string]$NodeName = 'localhost'
)
Import-DSCResource -ModuleName xNetworking
Node $NodeName
{
xFirewall Firewall
{
Name = "AllowExternalRdp"
DisplayName = "Firewall Rule for RDP"
Ensure = "Present"
Enabled = "True"
Profile = ("Domain", "Private")
Direction = "Inbound"
RemotePort = ("3389")
LocalPort = ("3389")
Protocol = "TCP"
Program = "c:\windows\system32\mstsc.exe"
}
}
}
AddRdpAccess
Start-DscConfiguration -Path AddRdpAccess -Wait -Verbose -Force
From here you can use that script and load it in via the Azure Automation UI.
Upvotes: 2