Azure上重新启用远程桌面Windows防火墙规则

Azure上重新启用远程桌面Windows防火墙规则

本文介绍了在Windows Azure上重新启用远程桌面Windows防火墙规则的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已在Windows Azure虚拟机中禁用了远程桌面防火墙规则.正如您所期望的,我不再可以将远程桌面插入服务器.

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.

有人知道是否可以重新启用远程桌面Windows防火墙规则吗?

Does anyone know if it is possible to re-enable the Remote Desktop Windows firewall rule?

我尝试过的事情

从长远来看,我已经下载了Windows Azure CLI,但是在其中看不到可以执行的任何操作,但是没有找到任何内容.

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.

我还试图对MSSQL服务器执行以下命令:

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:

请求的操作需要提升(以管理员身份运行).

请告诉我,我不必重新创建站点(已备份).

Please tell me I don't have to re-create the site (which is backed up).

推荐答案

事实证明,我要做的就是将PowerShell集成到Azure VM中.

It turns out that all I needed to do was to PowerShell into the Azure VM.

步骤:

  • 确保在Azure门户的端点"部分中启用了PowerShell.
  • 获取服务器的证书(PowerShell远程命令需要此证书).您可以通过以下方法获取服务器证书:域的URL: https://yourdomaing.cloudapp.net:12345 (其中:12345是PowerShell使用的端口).
  • 将站点的SSL证书导出为.CER文件,并将其安装在本地计算机上.
  • 将其保存到计算机上的受信任的根证书颁发机构"存储中.
  • 使用本地计算机上的管理特权打开PowerShell,然后键入: Enter-PSSession -ComputerName yourdomain.cloudapp.net-端口5986-凭据YourUserName -UseSSL
  • 将出现一个登录弹出窗口,在此处输入您的VM的登录凭据.
  • 您现在将能够对Azure VM执行命令.就我而言,我运行了 netsh advfirewall防火墙设置规则group ="remote desktop" new enable = Yes 并退出了PowerShell会话,并能够远程连接到我的计算机.
  • 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.

这篇关于在Windows Azure上重新启用远程桌面Windows防火墙规则的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-06 16:20