![](/img/trans.png)
[英]Import ML Model from ADLS to Azure ML using Databricks
[英]Access data from ADLS using Azure Databricks
我正在尝试使用存储帐户访问密钥通过 Azure Databricks 访问存储在 ADLS 位置的数据文件。 要访问数据文件,我在 azure databricks 和以下命令中使用 python 笔记本工作正常,
spark.conf.set(
"fs.azure.account.key.<storage-account-name>.dfs.core.windows.net",
"<access-key>"
)
但是,当我尝试使用以下命令列出目录时,会引发错误
dbutils.fs.ls("abfss://<container-name>@<storage-account-name>.dfs.core.windows.net")
错误:
ExecutionError: An error occurred while calling z:com.databricks.backend.daemon.dbutils.FSUtils.ls.
: Operation failed: "This request is not authorized to perform this operation using this permission.", 403, GET, https://<storage-account-name>.dfs.core.windows.net/<container-name>?upn=false&resource=filesystem&maxResults=500&timeout=90&recursive=false, AuthorizationPermissionMismatch, "This request is not authorized to perform this operation using this permission. RequestId:<request-id> Time:2021-08-03T08:53:28.0215432Z"
我不确定它需要什么许可以及如何继续。
此外,我正在使用 ADLS Gen2 和 Azure Databricks(试用版 - 高级版)。
提前致谢!
完整的配置密钥称为“spark.hadoop.fs.azure.account.key.adlsiqdigital.dfs.core.windows.net”
但是,使用服务帐户和挂载点对生产环境来说是有益的。 这样,存储上的操作可以更容易地追溯到这个应用程序,而不仅仅是使用通用访问密钥和挂载点,避免在代码中的任何地方指定连接字符串。
试试这个。
spark.conf.set("fs.azure.account.key.<your-storage-account-name>.blob.core.windows.net","<your-storage-account-access-key>")
dbutils.fs.mount(source = "abfss://<container-name>@<your-storage-account-name>.dfs.core.windows.net/", mount_point = "/mnt/test")
您可以通过 Databricks 使用访问密钥挂载 ADLS 存储帐户,然后读取/写入数据。 请尝试以下代码:
dbutils.fs.mount(
source = "wasbs://<container-name>@<storage-account-name>.blob.core.windows.net",
mount_point = "/mnt/<mount-name>",
extra_configs = {"fs.azure.account.key.<storage-account-name>.blob.core.windows.net":dbutils.secrets.get(scope = "<scope-name>", key = "<key-name>")})
dbutils.fs.ls("/mnt/<mount-name>")
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.