我有一个托管在 (S1) 应用服务计划上的 Azure 函数。 Azure Function 集成到 VNet 子网。此子网启用了 Microsoft.Storage 和 Microsoft.Web 服务终结点,并且将其委托(delegate)给 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 限制时,一切正常。
我可能做错了什么?
谢谢。
最佳答案
以下文档可能有助于解释为什么会发生这种情况: 来自微软文档: 创建函数应用时,必须创建或链接到支持 Blob、队列和表存储的通用 Azure 存储帐户。您当前无法对此帐户使用任何虚拟网络限制。如果在用于函数应用的存储帐户上配置虚拟网络服务终结点,该配置将破坏您的应用。 引用:enter link description here
关于azure - 限制从 Azure 函数子网对存储帐户的访问,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60272781/