此请求无权使用此权限执行此操作

问题描述 投票:0回答:2

我正在尝试使用以下配置在dattabricks中安装adls gen2

configs = {"fs.azure.account.auth.type": "OAuth",
   "fs.azure.account.oauth.provider.type": "org.apache.hadoop.fs.azurebfs.oauth2.ClientCredsTokenProvider",
   "fs.azure.account.oauth2.client.id": "service principal id",
   "fs.azure.account.oauth2.client.secret": "service principal key",
   "fs.azure.account.oauth2.client.endpoint": "https://login.microsoftonline.com/tenant-id/oauth2/token",
   "fs.azure.createRemoteFileSystemDuringInitialization": "true"}
dbutils.fs.mount(
source = "abfss://[email protected]/directory",
mount_point = "/mnt/data",
extra_configs = configs)

我已经创建了服务主体并为其创建了密钥,然后在活动目录角色分配中为此服务主体提供了存储blob角色

按照文件

"abfss://<your-file-system-name>@<your-storage-account-name>.dfs.core.windows.net/<your-directory-name>"

什么应该是你的文件系统==> blob容器内的文件夹? you-directory-name ==>我在blob容器中只有一个文件夹,所以混淆这里storgae(ADLS gen 2 preview)Blob Container文件夹a.txt

错误


ExecutionError:调用o480.mount时发生错误。 HEAD https://xxxxxxxxx.dfs.core.windows.net/xxxxxx?resource=filesystem&timeout=90 StatusCode = 403 StatusDescription =此请求无权使用此权限执行此操作。 ErrorCode = ErrorMessage =在shaded.databricks.v20180920_b33d810.org.apache.hadoop.fs.azurebfs的shaded.databricks.v20180920_b33d810.org.apache.hadoop.fs.azurebfs.services.AbfsRestOperation.execute(AbfsRestOperation.java:134)。 services.AbfsClient.getFilesystemProperties(AbfsClient.java:197)位于shaded.databricks.v20180920_b33d810.org.apache的shaded.databricks.v20180920_b33d810.org.apache.hadoop.fs.azurebfs.AzureBlobFileSystemStore.getFilesystemProperties(AzureBlobFileSystemStore.java:214)。 hadoop.fs.azurebfs.AzureBlobFileSystem.fileSystemExists(AzureBlobFileSystem.java:749)位于com.databricks.backend的shaded.databricks.v20180920_b33d810.org.apache.hadoop.fs.azurebfs.AzureBlobFileSystem.initialize(AzureBlobFileSystem.java:110)。 daemon.dbutils.DBUtilsCore.verifyAzureFileSystem(DBUtilsCore.scala:485)位于太阳下的sun.reflect.GeneratedMethodAccessor400.invoke(未知来源)的com.databricks.backend.daemon.dbutils.DBUtilsCore.mount(DBUtilsCore.scala:435)。 reflect.DelegatingMethodAccessorImpl.i nvoke(DelegatingMethodAccessorImpl.java:43)位于py4j.reflection.RevlectionEngine.invoke(ReflectionEngine)py4j.reflection.MethodInvoker.invoke(MethodInvoker.java:244)的java.lang.reflect.Method.invoke(Method.java:498) .java:380)py4j.Gateway.invoke(Gateway.java:295)py4j.commands.AbstractCommand.invokeMethod(AbstractCommand.java:132)py4j.commands.CallCommand.execute(CallCommand.java:79)py4j .gatewayConnection.run(GatewayConnection.java:251)at java.lang.Thread.run(Thread.java:748)

databricks azure-databricks
2个回答
0
投票

Gen2湖没有容器,它们有文件系统(这是一个非常类似的概念)。

在您的存储帐户上,您是否启用了“分层命名空间”功能?您可以在Storage帐户的Configuration刀片中看到此信息。如果您有,则存储帐户是Lake Gen2 - 如果不是,它只是一个blob存储帐户,您需要按照说明使用blob存储。

假设您已设置该功能,那么您可以看到FileSystems刀片 - 在那里您创建文件系统,其方式与blob容器非常相似。这是您在abfss URL开头所需的名称。

但是,您的错误消息向我表明您的服务主体没有数据湖的权限。您应该使用存储帐户资源上的RBAC角色授予权限(添加到存储帐户贡献者或读者)。或者使用Storage Explorer以更精细的级别授予权限。

请记住,data lake需要对从root用户到您尝试读取/写入的文件夹的每个文件夹执行权限。作为测试尝试首先从root读取文件。


0
投票

我只是在努力解决这个问题:

"fs.azure.account.oauth.provider.type"

"fs.azure.account.oauth2.provider.type"

执行成功。

© www.soinside.com 2019 - 2024. All rights reserved.