azure - 限制从 Azure 函数子网访问存储帐户
问题描述
我有一个托管在 (S1) 应用服务计划上的 azure 函数。Azure 函数已集成到 VNet 子网。此子网启用了Microsoft.Storage和Microsoft.Web服务端点,并且它被委派给Microsoft.Web/serverFarms
另一方面,存储帐户配置为仅接受来自 azure 函数所属子网的请求。
不幸的是,这不起作用。当我尝试从 Azure 功能与存储帐户通信时,出现以下错误
2020-02-18T02:03:03.505 [Error] Faliure Occured
Azure.RequestFailedException : This request is not authorized to perform this operation.
RequestId:0b034a99-701e-002c-09ff-e5bd0a000000
Time:2020-02-18T02:03:03.1177265Z
Status: 403 (This request is not authorized to perform this operation.)
ErrorCode: AuthorizationFailure
Headers:
Server: Microsoft-HTTPAPI/2.0
x-ms-request-id: 0b034a99-701e-002c-09ff-e5bd0a000000
x-ms-client-request-id: 0bbe8185-4657-47f3-8566-5bcbd16c4274
x-ms-error-code: AuthorizationFailure
Date: Tue, 18 Feb 2020 02:03:02 GMT
Content-Length: 246
Content-Type: application/xml
at Azure.Storage.Blobs.BlobRestClient.Container.GetPropertiesAsync_CreateResponse(ClientDiagnostics clientDiagnostics,Response response)
at async Azure.Storage.Blobs.BlobRestClient.Container.GetPropertiesAsync(ClientDiagnostics clientDiagnostics,HttpPipeline pipeline,Uri resourceUri,String version,Nullable`1 timeout,String leaseId,String requestId,Boolean async,String operationName,CancellationToken cancellationToken)
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at async Azure.Storage.Blobs.BlobContainerClient.GetPropertiesInternal(BlobRequestConditions conditions,Boolean async,CancellationToken cancellationToken)
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at Azure.Storage.TaskExtensions.EnsureCompleted[T](Task`1 task)
at Azure.Storage.Blobs.BlobContainerClient.GetProperties(BlobRequestConditions conditions,CancellationToken cancellationToken)
at SharedLib.Utils.TestStorageAccountAccess() at D:\poc-code\NetworkSecurityPoc\SharedLib\Utils.cs : 13
at async MessengerFunction.Trigger.Run(HttpRequest req,ILogger log) at D:\poc-code\NetworkSecurityPoc\MessengerFunction\Trigger.cs : 25
但是当我禁用存储帐户的 vnet 限制时,一切正常。
我可能做错了什么?
谢谢你。
解决方案
以下文档可能有助于为什么会发生这种情况:来自 MS 文档:创建函数应用时,必须创建或链接到支持 Blob、队列和表存储的通用 Azure 存储帐户。您目前无法对此帐户使用任何虚拟网络限制。如果在用于函数应用的存储帐户上配置虚拟网络服务终结点,该配置将破坏你的应用。参考:在此处输入链接描述
推荐阅读
- angular - 使用 angular5 和 mongodb 的复选框概念
- pdf - iText5.x 在不破坏 Seal 的情况下设置按钮外观
- elasticsearch - ElasticSearch bool 查询结合 should 和 filter
- nodemcu - nodemcu - 写入内存中任意位置的问题
- tensorflow - TensorFlow:双射器中的变量不能重用
- laravel-5.6 - Laravel 5.7.2 中的路由问题
- c++ - 指向成员的指针对托管类无效
- python - Python:os.path.isfile 没有检测到文件
- spring - Spring Kafka 和事务
- php - Laravel 多认证导航栏