在使用python的数据块中,dbutils.fs.mount给出java.lang.NullPointerExcept



在databricks中使用db.fs.mount连接到azure gen2数据湖时,尝试连接到"时收到authEndpoint错误;abfss://theDir@DataLake.blob.core.windows.net/";然而,连接到";wasbs://theDir@DataLake.blob.core.windows.net/";工作良好。我试图理解为什么abfss会导致authEndpoint错误,而wasbs不会。

enter code here
#fails
endpoint = "abfss://theDir@theDataLake.blob.core.windows.net/";
dbutils.fs.mount(
source = endpoint,
mount_point = "/mnt/test",
extra_configs = {"fs.azure.account.key.theDataLake.blob.core.windows.net" : "xxxxxx"})
#works
endpoint = "wasbs://theDir@theDataLake.blob.core.windows.net/";
dbutils.fs.mount(
source = endpoint,
mount_point = "/mnt/test",
extra_configs = {"fs.azure.account.key.theDataLake.blob.core.windows.net" : "xxxxxx"})

您不能使用存储密钥装载ABFSS协议。只有在使用Service Principal(docs(时才能使用ABFSS进行装载,并且它需要extra_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": "<application-id>",
"fs.azure.account.oauth2.client.secret": dbutils.secrets.get(scope="<scope-name>",key="<service-credential-key-name>"),
"fs.azure.account.oauth2.client.endpoint": "https://login.microsoftonline.com/<directory-id>/oauth2/token"}