Azure Functions IP 地址超出范围
Azure Functions IP addresses out of range
我有一个 Azure Function,它通过 REST 从我自己的 Cosmos DB 和一个外部数据库进行计算、存储和读取数据 API。
在 Azure 门户中,我可以看到“outboundIpAddresses”和“possibleOutboundIpAddresses”(订阅 > {您的订阅} > 提供商 > Microsoft.Web > 站点)。总共12个IP地址。当我 运行 本地函数(VS Code)时,一切顺利。但是,当我部署该功能时,出现以下错误:
Result: Failure Exception: CosmosHttpResponseError: (Forbidden) Request originated from client IP <IP-address> through public internet. This is blocked by your Cosmos DB account firewall settings
这本身是不言自明的,但问题是错误消息中提到的 IP 地址既不属于“outboundIpAddresses”也不属于“possibleOutboundIpAddresses”。而且几乎每次触发该功能时,错误消息中的客户端 IP 都会发生变化。
您知道为什么会发生这种情况以及如何解决这个问题吗?
你的函数应用在消费计划中吗?如果是,当缩放在消费计划上运行的函数应用程序时,可能会分配新范围的出站 IP 地址。当 运行 在消费计划上时,您可能需要将整个 data center.
列入白名单
另外请注意,如果您加入应用服务计划,您可以选择分配 dedicated IP address。
我有一个 Azure Function,它通过 REST 从我自己的 Cosmos DB 和一个外部数据库进行计算、存储和读取数据 API。
在 Azure 门户中,我可以看到“outboundIpAddresses”和“possibleOutboundIpAddresses”(订阅 > {您的订阅} > 提供商 > Microsoft.Web > 站点)。总共12个IP地址。当我 运行 本地函数(VS Code)时,一切顺利。但是,当我部署该功能时,出现以下错误:
Result: Failure Exception: CosmosHttpResponseError: (Forbidden) Request originated from client IP <IP-address> through public internet. This is blocked by your Cosmos DB account firewall settings
这本身是不言自明的,但问题是错误消息中提到的 IP 地址既不属于“outboundIpAddresses”也不属于“possibleOutboundIpAddresses”。而且几乎每次触发该功能时,错误消息中的客户端 IP 都会发生变化。
您知道为什么会发生这种情况以及如何解决这个问题吗?
你的函数应用在消费计划中吗?如果是,当缩放在消费计划上运行的函数应用程序时,可能会分配新范围的出站 IP 地址。当 运行 在消费计划上时,您可能需要将整个 data center.
列入白名单另外请注意,如果您加入应用服务计划,您可以选择分配 dedicated IP address。