消费层上 Azure Function App 的白名单 IP

Posted

技术标签:

【中文标题】消费层上 Azure Function App 的白名单 IP【英文标题】:white list IPs for Azure Function App on consumption tier 【发布时间】:2021-10-04 16:47:48 【问题描述】:

我们将一些事件发布到 Azure 服务总线,并使用 Azure Function App 作为事件处理程序。从 Azure Function App 中,我们需要对合作伙伴 API 进行一些出站调用,但合作伙伴想要配置一些防火墙限制。 我知道我们可以使用高级功能应用程序并实现虚拟网络 NAT 网关来控制出站 IP,但我们正在尝试使用消费级功能应用程序以便宜的方式做到这一点......我可以看到 outboundIpAddresses 的列表和possibleOutboundIpAddresses Azure 资源浏览器中 subscriptions > your subscription > providers > Microsoft.Web > sites 下的 IP 地址。

在Azure addresses in Azure Functions 中,它说:

outboundIpAddresses 集当前可用于函数 应用程序。可能的OutboundIpAddresses 集包括IP 地址 仅当函数应用扩展到其他定价时才可用 层。

出站 IP 地址的相对稳定性取决于 托管计划。

由于自动缩放行为,出站 IP 在运行时可以随时更改 消费计划或高级计划。

似乎在使用消费层功能应用程序时我不应该将outboundIpAddresses 用于白名单,但没有明确说明possibleOutboundIpAddresses... 可以将possibleOutboundIpAddresses 的IP 列表列入白名单吗? ?这个列表有可能会改变吗?

FWIW 如果我查看 2 个不同的功能应用程序(同一区域),它们都列出了 10 个用于可能的OutboundIpAddresses 的 IP,它们是完全不同的列表。

【问题讨论】:

【参考方案1】:

outboundIpAddresses 和 possibleOutboundIpAddresses 都不适用于消费函数应用。出站 IP 地址可能在 possibleOutboundIpAddresses 列表之外。

对于消费层功能应用程序,此方案中的解决方案是将所有数据中心出站 IP 地址列入白名单,如documentation 中所述。

【讨论】:

感谢 ChaitanyaN-MSFT。不太喜欢将整个 DC 列入白名单的想法......我们最终可能会执行以下操作之一:a)在 AKS(而不是无服务器)中使用 NAT 网关作为容器化服务运行,b)使用连接的高级功能应用程序使用 NAT 网关连接到我们的 VNET,或者 c) 使用 APIM 作为代理,然后将 APIM(高级层)虚拟 IP 列入白名单。

以上是关于消费层上 Azure Function App 的白名单 IP的主要内容,如果未能解决你的问题,请参考以下文章

资源所有者密码凭据令牌在 Azure Function App 上导致 401

Newtonsoft 11.0.0.0 无法在 Azure Function App 2.0 上加载

从 Azure Function App 访问带有防火墙的 Azure Blob 存储

Windows Azure Web Site (15) 基于Azure Web App的企业官网改造

将 Microsoft Azure Function App 2.0 预览版绑定到 0.0.0.0

Azure App Function (Functions 2.x):通过 HTTP 函数在 CosmosDB 中创建新文档