允许 IP 地址通过 SQL 服务器防火墙

Allowing IP Address through SQL Server Firewall

我有一个网站(应用程序服务),1 个 Sql 服务器,上面有 2 个数据库。 每个月我都会随机收到一个错误:

Cannot open server 'myServer' requested by the login. Client with IP address 'xx.xxx.87.3' is not allowed to access the server. 
To enable access, use the Windows Azure Management Portal or run sp_set_firewall_rule on the master database to create a firewall rule for this IP address or address range. 
It may take up to five minutes for this change to take effect.

我的问题是,我怎么知道 application/service 这个 IP 地址是什么? 这不是我网站的 IP 地址,如果我 ping 我数据库的 CNAME,它与这个 IP 不匹配。但是,如果我不添加它,我的整个站点将无法运行。 当某些事情发生变化时,我必须每月手动添加一次。我如何找出这个 IP 地址连接到什么?

基本上,有两种方法可以解决您的问题:

  1. 在您的 SQL 服务器防火墙配置中将 Allow Azure services and resources to access this server 指定为 Yes,这样您的 SQL 服务器将允许所有 Azure 资源访问。

  2. 将所有 outbound IPs of your Azure app service 添加到您的 SQL 服务器防火墙白名单中。它比第一种方式具有更高的安全级别。您可以在此处找到 Azure 门户上的所有出站 IP: