问题
I have disabled the remote desktop firewall rule in a Windows Azure virtual machine.As you would expect, I can no longer remote desktop in to the server.
Does anyone know if it is possible to re-enable the Remote Desktop Windows firewall rule?
What I have tried
As a long shot, I have downloaded the Windows Azure CLI but can't see anything in there that would do it but have not found anything.
I have also tried to execute the following command against the MSSQL server:
EXEC xp_cmdshell 'netsh advfirewall firewall set rule group="remote desktop" new enable=Yes';
GO
I am getting the following message from the query:
The requested operation requires elevation (Run as administrator).
Please tell me I don't have to re-create the site (which is backed up).
回答1:
If you're using a VM inside a resource group with the new azure portal, you can do this:
- Click reset password
Change mode to "Reset configuration only"
Click update and wipe your sweat off :)
回答2:
It turns out that all I needed to do was to PowerShell into the Azure VM.
Steps:
- Make sure PowerShell is enabled in the Endpoints section of the Azure portal.
- Get the server's certificate (PowerShell needs this for remote commands). You can get the server certificate by going to your domains' URL:
https://yourdomaing.cloudapp.net:12345
(where :12345 is the port that PowerShell uses). - Export the SSL certificate of the site as a .CER file and install it on your local machine.
- Save it to the "Trusted Root Certification Authorities" store on your machine.
- Open PowerShell with administrative privileges on your local machine and type:
Enter-PSSession -ComputerName yourdomain.cloudapp.net -Port 5986 -Credential YourUserName -UseSSL
- A login popup will appear, enter your VM's login credentials here.
- You will now be able to execute commands against the Azure VM. In my case, I ran
netsh advfirewall firewall set rule group="remote desktop" new enable=Yes
and exited the PowerShell session and was able to remotely connect to my machine.
来源:https://stackoverflow.com/questions/19192210/re-enable-remote-desktop-windows-firewall-rule-on-windows-azure