【问题标题】:Limiting access to Storage Account from Azure Function Subnet限制从 Azure 函数子网访问存储帐户
【发布时间】:2020-06-01 23:53:11
【问题描述】:

我有一个托管在 (S1) 应用服务计划上的 azure 函数。 Azure 函数已集成到 VNet 子网。此子网启用了 Microsoft.StorageMicrosoft.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 限制时,一切正常。

我做错了什么?

谢谢。

【问题讨论】:

  • 您是否需要使用区域虚拟网络集成或网关? Azure 函数应用是在 Windows 还是 Linux 上运行?
  • 我正在使用区域虚拟网络集成(显示“预览”的那个)。并且函数应用在 Windows 上运行。实际上我的 Vnet 没有网关子网。
  • 集成子网中除了azure功能外,不应使用其他资源。另外推荐使用this template自动部署。
  • 如果取消选中子网中启用的Microsoft.Web服务端点,是否有效?
  • 我已在当前​​设置中取消选中 Microsoft.Web,但它仍然无法正常工作。我也按原样部署了引用的模板,也没有工作

标签: azure azure-functions azure-storage vnet


【解决方案1】:

以下文档可能有助于说明为什么会发生这种情况: 来自 MS 文档: 创建函数应用时,必须创建或链接到支持 Blob、队列和表存储的通用 Azure 存储帐户。您目前无法对此帐户使用任何虚拟网络限制。如果在用于函数应用的存储帐户上配置虚拟网络服务终结点,该配置将破坏你的应用。 参考:enter link description here

【讨论】:

    【解决方案2】:

    我会说这是Function networking这里的网络问题所以设置WEBSITE_VNET_ROUTE_ALL to 1然后它应该可以工作..

    【讨论】:

      猜你喜欢
      • 2021-10-12
      • 2019-01-15
      • 2019-12-24
      • 1970-01-01
      • 2017-09-06
      • 2011-08-14
      • 1970-01-01
      • 1970-01-01
      • 2018-10-24
      相关资源
      最近更新 更多