Azure Functions 存储帐户网络安全

Azure Functions storage account network security

我目前正在与一个客户合作,该客户需要尽可能多地锁定对所有 Azure 资源的访问权限,而我的 Azure Functions 使用的存储帐户有问题。

将门户中的防火墙和虚拟网络边栏选项卡设置为 "All Networks" 我能够部署到 Function App 并且它运行没有问题。

然而,一旦我通过检查"Selected Networks"启用访问限制,无论我输入什么虚拟网络子网或 IP 地址,我都无法进行通信

我已经输入了我们基于消费的功能应用程序的出站 IP 地址,并检查了来自 Powershell 的其他 IP 地址是否已全部添加到白名单中。我还添加了本地 Azure 数据中心的所有 CIDR IP 范围,但同样不起作用。

我们遇到的问题是,一旦实施访问限制,我们就无法部署到 Function App,并且该应用程序不再运行。是否支持此方案?限制对存储帐户的访问以便只有 Function App 可以使用它的机制是什么。

据我所知,您有两个选项可以限制从您的函数应用程序或 Web 应用程序访问您的存储帐户。

  1. 在存储帐户的防火墙中将函数应用程序的 outboundIpAddressespossibleOutboundIpAddresses 列入白名单。但是,如果位于同一区域的 Azure Function App 和 Azure 存储引用 .
  2. 则不起作用

when you hit the storage account from your function, because they are in the same region as each other, all the traffic goes over the internal Azure network on internal IP's, not the public IPs listed in the web app, and so is not allowed over the firewall.

  1. 如果您的资源位于不同区域,您可以使用函数应用程序的网络部分允许函数应用程序访问 VNet 中的资源,然后在此应用程序集成子网中为 Microsoft.Storage 启用服务终结点。但是您需要参考本教程的 Azure Functions Premium 计划:integrate Functions with an Azure virtual network.

有时,网络的部署顺序很重要。在这种情况下,您将部署以下内容:

首先,您可以使用未使用的子网部署新 VNet 集成。 VNet 集成完成并重新启动函数应用后,你可以为此子网启用服务端点。最后,您可以在存储帐户的防火墙中添加子网。

请注意,新版本目前处于预览阶段。您还可以查看这些 characteristics and get more references from this .