Re-enable Remote Desktop Windows Firewall Rule on Windows Azure

时光怂恿深爱的人放手 提交于 2019-12-13 05:15:38

问题


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:

  1. Click reset password

  1. Change mode to "Reset configuration only"

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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!