我在我的环境中尝试了相同的操作并得到了如下所示的相同错误:
HTTP/1.1 403 This request is not authorized to perform this operation.
content-length: 246
content-type: application/xml
date: Wed, 31 May 2023 12:19:02 GMT
request-context: appId=cid-v1:fd69b195-73bf-4983-8e10-20874ab6fd70
vary: Origin
x-ms-error-code: AuthorizationFailure
x-ms-request-id: 0482fe63-001e-0005-0cba-93338e000000
添加了对IP地址或虚拟网络的应用服务访问限制,如下所示:
在存储帐户防火墙中添加 IP 地址,如下所示:
Make sure in Exceptions allow azure service on the trusted service list to access this storage account
在 APIM 中打开托管身份。分配Storage Blob Data Contributor
存储容器下的 Azure APIM 服务主体的角色。
现在应用程序服务中的访问限制,仅允许所需的 Ip 和成功执行的存储帐户相同,如下所示:
HTTP/1.1 200 OK
accept-ranges: bytes
content-length: 534283
content-md5: Fq04hjyWtblQ0ljt0ObAeQ==
content-type: image/png
date: Wed, 31 May 2023 12:56:56 GMT
etag: "0x8DB61A69A90XXX"
last-modified: Wed, 31 May 2023 07:13:58 GMT
request-context: appId=cid-v1:fd69b195-73bf-4983-8e10-20874ab6fd70
vary: Origin
x-ms-blob-type: BlockBlob
x-ms-creation-time: Wed, 31 May 2023 07:13:58 GMT
x-ms-lease-state: available
x-ms-lease-status: unlocked
x-ms-request-id: 8c7194fc-601e-0061-04bf-XXXXXXX
x-ms-server-encrypted: true
x-ms-version: 2017-11-09
参考:
使用 Azure API 管理和托管身份保护 Azure Blob 存储 |作者:马库斯·蒂 (Marcus Tee)马库斯 T 恤随时 |中等的 by 马库斯·蒂