【问题标题】:Query Azure SQL Database from Google App Engine (NodeJs)从 Google App Engine (NodeJs) 查询 Azure SQL 数据库
【发布时间】:2018-04-02 18:40:11
【问题描述】:

我在 Google App Engine 上使用 node-mssql 来查询托管在 Azure 上的 Sql 数据库。我遇到的问题是 App Engine 节点服务器不断更改 IP 地址。因此,我必须将 Azure 上所有可能的(我不知道有多少)IP 地址列入白名单。有没有其他办法解决这个问题?

【问题讨论】:

  • 根据我在文档中看到的内容,您可以关闭 Azure 上的防火墙过滤(不推荐)或从 App Engine(或 Azure)切换到其他东西,因为静态 IP 映射到应用程序不是可以在 App Engine 中 (cloud.google.com/appengine/kb)

标签: google-app-engine azure-sql-database node-mssql


【解决方案1】:

您可以使用 PowerShell 以编程方式更改 IP 地址白名单,如 document 中所述。要添加新的 IP 地址范围,请运行

New-AzureRmSqlServerFirewallRule -ResourceGroupName "myResourceGroup" `
-ServerName $servername `
-FirewallRuleName "AllowSome" -StartIpAddress "0.0.0.0" -EndIpAddress "0.0.0.0"

要删除 IP 地址范围,请运行

Remove-AzureRmSqlServerFirewallRule -ResourceGroupName "myResourceGroup" `
-ServerName $servername `
-FirewallRuleName "AllowSome" -StartIpAddress "0.0.0.0" -EndIpAddress "0.0.0.0"

不过,您可能需要一个 Windows 客户端来运行 Azure PowerShell。请参阅此文档以获取 startup guide

在 Azure 中使用虚拟网络并在 Azure 上部署应用的替代方法。

【讨论】:

  • 我不确定这是否能解决问题,因为我仍然需要不断设置列入白名单的 IP 地址。问题是 IP 地址总是在变化,而且它不是一个一致的范围。所以,我很确定,任何设置 IP 白名单的解决方案都不是真正可行的。
  • 如果您希望避免 IP 白名单,请考虑迁移到 Azure 应用程序并使用 VNET。 azure.microsoft.com/en-us/blog/…
猜你喜欢
  • 1970-01-01
  • 2013-05-17
  • 2019-11-27
  • 1970-01-01
  • 1970-01-01
  • 2011-07-05
  • 1970-01-01
  • 1970-01-01
  • 2016-10-19
相关资源
最近更新 更多