我试图通过使用凭据传递将访问Azure存储帐户Gen2容器的权限授予其Databricks工作区中的团队,方法是将其安装到dbfs。我希望能够使用active Directory管理访问,因为最终会有容器以只读方式安装。
从我的conf中提取:
"spark_conf": {
"spark.databricks.cluster.profile": "serverless","spark.databricks.passthrough.enabled": "true","spark.databricks.delta.preview.enabled": "true","spark.databricks.pyspark.enableProcessIsolation": "true","spark.databricks.repl.allowedLanguages": "python,sql"
}
然后我运行以下代码:
dbutils.fs.mount(
source = f"wasbs://data@storage_account_name.blob.core.windows.net",mount_point = "/mnt/data/",extra_configs = {
"fs.azure.account.auth.type":"CustomaccessToken","fs.azure.account.custom.token.provider.class":spark.conf.get("spark.databricks.passthrough.adls.gen2.tokenProviderClassname")
}
这是成功的,因为我可以使用dbutils访问该卷。
>> dbutils.fs.ls('dbfs:/mnt/storage_account_name/data')
[FileInfo(path='dbfs:/mnt/storage_account_name/data/folder/',name='folder/',size=0)]
我的问题是我运行%sh ls /dbfs/mnt/storage_account_name/data
或尝试使用python进行访问
>> import os
>> os.listdir('/dbfs/')
Out[1]: []
>> os.listdir('/dbfs/mnt/')
FileNotFoundError: [Errno 2] No such file or directory: '/dbfs/mnt/'
我找不到我想念的东西。是否有一些配置可以使其可被python访问? 谢谢。