cancel
Showing results forย 
Search instead forย 
Did you mean:ย 
Data Engineering
Join discussions on data engineering best practices, architectures, and optimization strategies within the Databricks Community. Exchange insights and solutions with fellow data engineers.
cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

Error while mounting ADLS in python using AccountKey

Krish1
New Contributor II

I'm using the below code using Account key to mount ADLS in python but running into error:shaded.databricks.org.apache.hadoop.fs.azure.AzureException: java.lang.IllegalArgumentException: The String is not a valid Base64-encoded string. Can you please help?

AccountKey = dbutils.secrets.get(scope="ADB_KV_Secret_Scope", key="dev-storage-account-clientid")

url = "wasbs://dev@storage.blob.core.windows.net"

mnt = "/mnt/findatamart"

configs =  "fs.azure.account.key.storage.blob.core.windows.net"

dbutils.fs.mount(

  source = url,

  mount_point = mnt,

  extra_configs ={configs:AccountKey}

  )

4 REPLIES 4

Prabakar
Databricks Employee
Databricks Employee

@Krish Lamโ€‹ you need to provide more details for the config. Please refer to the below doc.

Mounting cloud object storage on Azure Databricks - Azure Databricks | Microsoft Learn

Prabakar
Databricks Employee
Databricks Employee

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"}

# Optionally, you can add <directory-name> to the source URI of your mount point.

dbutils.fs.mount(

 source = "abfss://<container-name>@<storage-account-name>.dfs.core.windows.net/",

 mount_point = "/mnt/<mount-name>",

 extra_configs = configs)

Replace

  • <application-id> with the Application (client) ID for the Azure Active Directory application.
  • <scope-name> with the Databricks secret scope name.
  • <service-credential-key-name> with the name of the key containing the client secret.
  • <directory-id> with the Directory (tenant) ID for the Azure Active Directory application.
  • <container-name> with the name of a container in the ADLS Gen2 storage account.
  • <storage-account-name> with the ADLS Gen2 storage account name.
  • <mount-name> with the name of the intended mount point in DBFS.

Krish1
New Contributor II

Thank you. That worked.

Anonymous
Not applicable

Hi @Krish Lamโ€‹ 

Thank you for posting your question in our community! We are happy to assist you.

To help us provide you with the most accurate information, could you please take a moment to review the responses and select the one that best answers your question?

This will also help other community members who may have similar questions in the future. Thank you for your participation and let us know if you need any further assistance! 

Connect with Databricks Users in Your Area

Join a Regional User Group to connect with local Databricks users. Events will be happening in your city, and you wonโ€™t want to miss the chance to attend and share knowledge.

If there isnโ€™t a group near you, start one and help create a community that brings people together.

Request a New Group