AI智能
改变未来

【Azure 存储服务】App Service 访问开启防火墙的存储账号时遇见 403 (This request is not authorized to perform this operation.)


问题描述

需要 App Service 访问开启防火墙的存储账号。存储账号中设置为允许选中的VNET访问,同时允许了信任的Azure服务的访问,但是仍然报错 “403 (This request is not authorized to perform this operation.)”

因为App Service 并没有与Stroage Account允许访问所选的VNET进行集成,所以App Service是通过Outbound IP地址与Storage Account进行通信。当Storage Account与App Service处于同一数据中心时,把App Service所有的出口IP地址都添加到Storage Account的 Firewall中,依然出现403问题。这是什么原因呢?

问题分析

查看Storage Account的IP网络规则文档,发现其中有一点 “限制对与存储帐户部署在同一区域中的 Azure 服务的访问” 这是因为与存储帐户部署在同一区域中的Azure服务使用专用的 Azure IP 地址进行通信。 因此,不能基于特定的 Azure 服务的公共出站 IP(App Service的出口IP) 地址范围来限制对其的访问。

如何来避免这个问题呢?

1)当App Service 与 Stroage Account 都处于同一区域时,可以把App Service集成在Storage Account所允许访问的VNET中,使得App Service与Storage Account通过VNET进行通信。

2)当App Service 与 Storage Account 不在同一个区域时,在Storage Account的Firewall中添加 所有App Service的出口IP地址为允许访问即可。

参考文档

配置 Azure 存储防火墙和虚拟网络: https://docs.azure.cn/zh-cn/storage/common/storage-network-security?toc=%2Fstorage%2Fblobs%2Ftoc.json&tabs=azure-portal#grant-access-from-an-internet-ip-range

将应用与 Azure 虚拟网络集成: https://docs.azure.cn/zh-cn/app-service/web-sites-integrate-with-vnet#regional-vnet-integration

赞(0) 打赏
未经允许不得转载:爱站程序员基地 » 【Azure 存储服务】App Service 访问开启防火墙的存储账号时遇见 403 (This request is not authorized to perform this operation.)