Azure Data Lake:此请求无权执行此操作
Azure Data Lake: This request is not authorized to perform this operation
这个问题不是
的重复问题
我想从 Azure Functions 访问 Azure Data Lake。我使用托管身份并在我的数据湖 IAM 选项卡中为此功能分配了“所有者”角色。一切正常,但仅当我在我的数据湖中允许“所有网络”时。一旦我切换到“选定的网络”,即使我将我的 Azure 函数的所有出站 IP 地址添加到我的数据湖的防火墙规则中,我也会收到“此请求无权执行此操作”。
我在我的 Azure 函数中添加了对 https://api.ipify.org 的调用,以查看它的 public IP 地址。我还使用 socket.gethostbyname()
来获取数据湖主机名的已解析 IP 地址(只是为了检查这是否可能被解析为 Microsoft 数据中心内的私有 IP,但事实并非如此,它是 public知识产权)
我的函数的出站 IP 也出现在我的防火墙规则中:
我还是明白了
Error] Executed 'Functions.json-deserialize-eventhub' (Failed,
Id=10554e46-2f5e-42a7-a9f7-a95dad1b4e30, Duration=1063ms)Result:
FailureException: HttpResponseError: This request is not authorized to
perform this
operation.RequestId:84928ea9-201e-0092-5a97-d46e78000000Time:2020-12-17T17:07:38.2792923ZErrorCode:AuthorizationFailureError:NoneStack: File
"/azure-functions-host/workers/python/3.8/LINUX/X64/azure_functions_worker/dispatcher.py",
line 355, in _handle__invocation_requestcall_result = await
self._loop.run_in_executor(File
"/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in
runresult = self.fn(*self.args, **self.kwargs)File
"/azure-functions-host/workers/python/3.8/LINUX/X64/azure_functions_worker/dispatcher.py",
line 542, in __run_sync_funcreturn func(**params)File
"/home/site/wwwroot/json-deserialize-eventhub/init.py", line 38,
in maindlc.append_object(obj_converted, data_lake_target_url)File
"/home/site/wwwroot/shared/datalake.py", line 41, in append_objectfor
container in file_system_containers:File
"/home/site/wwwroot/.python_packages/lib/site-packages/azure/core/paging.py",
line 129, in __next__return next(self._page_iterator)File
"/home/site/wwwroot/.python_packages/lib/site-packages/azure/core/paging.py",
line 76, in __next__self._response =
self._get_next(self.continuation_token)File
"/home/site/wwwroot/.python_packages/lib/site-packages/azure/storage/blob/_models.py",
line 401, in _get_next_cbprocess_storage_error(error)File
"/home/site/wwwroot/.python_packages/lib/site-packages/azure/storage/blob/_shared/response_handlers.py",
line 147, in process_storage_errorraise error
代码本身很简单,我基本上只是使用 azure.storage.filedatalake
模块中的 DataLakeServiceClient
与数据湖进行通信。
为什么这不起作用?如何允许我的函数 write/read 数据? VNet 集成目前不是一个选项。
从错误来看,它说 HTTP 响应错误:此请求无权执行此操作。
因此除了添加 'Owner' RBAC 角色外,还请添加 'Storage Blob Data Owner' RBAC 角色。
There 是一种特殊情况,当您将存储帐户配置为允许从特定 public 互联网 IP 地址范围进行访问时。
Services deployed in the same region as the storage account use
private Azure IP addresses for communication. Thus, you cannot
restrict access to specific Azure services based on their public
outbound IP address range.
我还看到你的截图中有一个私有IP172.16.0.5
。您可以在与 Azure Data Lake 区域不同的区域中的另一个 Azure 函数中创建相同的 Function APP 来验证这一点。
这个问题不是
我想从 Azure Functions 访问 Azure Data Lake。我使用托管身份并在我的数据湖 IAM 选项卡中为此功能分配了“所有者”角色。一切正常,但仅当我在我的数据湖中允许“所有网络”时。一旦我切换到“选定的网络”,即使我将我的 Azure 函数的所有出站 IP 地址添加到我的数据湖的防火墙规则中,我也会收到“此请求无权执行此操作”。
我在我的 Azure 函数中添加了对 https://api.ipify.org 的调用,以查看它的 public IP 地址。我还使用 socket.gethostbyname()
来获取数据湖主机名的已解析 IP 地址(只是为了检查这是否可能被解析为 Microsoft 数据中心内的私有 IP,但事实并非如此,它是 public知识产权)
我的函数的出站 IP 也出现在我的防火墙规则中:
我还是明白了
Error] Executed 'Functions.json-deserialize-eventhub' (Failed, Id=10554e46-2f5e-42a7-a9f7-a95dad1b4e30, Duration=1063ms)Result: FailureException: HttpResponseError: This request is not authorized to perform this operation.RequestId:84928ea9-201e-0092-5a97-d46e78000000Time:2020-12-17T17:07:38.2792923ZErrorCode:AuthorizationFailureError:NoneStack: File "/azure-functions-host/workers/python/3.8/LINUX/X64/azure_functions_worker/dispatcher.py", line 355, in _handle__invocation_requestcall_result = await self._loop.run_in_executor(File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in runresult = self.fn(*self.args, **self.kwargs)File "/azure-functions-host/workers/python/3.8/LINUX/X64/azure_functions_worker/dispatcher.py", line 542, in __run_sync_funcreturn func(**params)File "/home/site/wwwroot/json-deserialize-eventhub/init.py", line 38, in maindlc.append_object(obj_converted, data_lake_target_url)File "/home/site/wwwroot/shared/datalake.py", line 41, in append_objectfor container in file_system_containers:File "/home/site/wwwroot/.python_packages/lib/site-packages/azure/core/paging.py", line 129, in __next__return next(self._page_iterator)File "/home/site/wwwroot/.python_packages/lib/site-packages/azure/core/paging.py", line 76, in __next__self._response = self._get_next(self.continuation_token)File "/home/site/wwwroot/.python_packages/lib/site-packages/azure/storage/blob/_models.py", line 401, in _get_next_cbprocess_storage_error(error)File "/home/site/wwwroot/.python_packages/lib/site-packages/azure/storage/blob/_shared/response_handlers.py", line 147, in process_storage_errorraise error
代码本身很简单,我基本上只是使用 azure.storage.filedatalake
模块中的 DataLakeServiceClient
与数据湖进行通信。
为什么这不起作用?如何允许我的函数 write/read 数据? VNet 集成目前不是一个选项。
从错误来看,它说 HTTP 响应错误:此请求无权执行此操作。
因此除了添加 'Owner' RBAC 角色外,还请添加 'Storage Blob Data Owner' RBAC 角色。
There 是一种特殊情况,当您将存储帐户配置为允许从特定 public 互联网 IP 地址范围进行访问时。
Services deployed in the same region as the storage account use private Azure IP addresses for communication. Thus, you cannot restrict access to specific Azure services based on their public outbound IP address range.
我还看到你的截图中有一个私有IP172.16.0.5
。您可以在与 Azure Data Lake 区域不同的区域中的另一个 Azure 函数中创建相同的 Function APP 来验证这一点。