How to mount Azure Blob Storage with OAuth2?

jwilliam
Contributor

We already know that we can mount Azure Data Lake Gen2 with OAuth2 using this:

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": "",
          "fs.azure.account.oauth2.client.secret": dbutils.secrets.get(scope="",key=""),
          "fs.azure.account.oauth2.client.endpoint": "https://login.microsoftonline.com//oauth2/token"}
 
# Optionally, you can add  to the source URI of your mount point.
dbutils.fs.mount(
  source = "abfss://@.dfs.core.windows.net/",
  mount_point = "/mnt/",
  extra_configs = configs)

However, when I used wasbs instead of abfss, it gives this error:

AzureException: shaded.databricks.org.apache.hadoop.fs.azure.AzureException: Unable to access container *** in account YYY.dfs.core.windows.net using anonymous credentials, and no credentials found for them  in the configuration.
Caused by: AzureException: Unable to access container *** in account YYY.dfs.core.windows.net using anonymous credentials, and no credentials found for them  in the configuration.

Is it possible to mount Azure Blob Storage (not ADLS2) by OAuth2?