azure - 限制从 Azure 函数子网对存储帐户的访问

标签 azure azure-functions azure-storage vnet

我有一个托管在 (S1) 应用服务计划上的 Azure 函数。 Azure Function 集成到 VNet 子网。此子网启用了 Microsoft.StorageMicrosoft.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/

相关文章:

asp.net-mvc - 如何从 MVC 应用程序调用逻辑应用程序?

Azure Blob 存储触发器函数未触发

excel - 如何使用定时器触发器在azure函数应用程序中创建excel文件

azure - 复制到雪花保存文件作为八位字节流,

azure - 如何在门户仪表板中再次显示Azure Function

laravel - 无法让 laravel 在 Azure Web App Linux 上运行

Python Azure 函数 - 使用 Key Vault 进行 MSI 身份验证

azure-storage - 看不到 ADLS Gen2 的 'Lifecycle management' 选项

azure - 使用 Azure SDK 将 VHD 上传到 Azure

json - 关于使用 Azure 搜索 Blob 索引器在 Azure 上对 Blob 建立索引的可行性