Mount ADLS Gen2 storage to DBFS with SAS token

P, John 240 Reputation points
2024-02-12T03:35:32.03+00:00

According to the link https://learn.microsoft.com/en-us/azure/databricks/connect/storage/azure-storage, user can access the ADLS Gen2 with OAuth2, SAS token, and Account key. To mount the ADLS to DBFS, the document https://learn.microsoft.com/en-us/azure/databricks/dbfs/mounts, listed on OAuth2. Is it possible to mount ADLS Gen2 to DBFS with SAS or Account key? If so, how to do it?

Azure Databricks
Azure Databricks
An Apache Spark-based analytics platform optimized for Azure.
2,534 questions
0 comments No comments
{count} votes

Accepted answer
  1. AnnuKumari-MSFT 34,556 Reputation points Microsoft Employee Moderator
    2024-02-12T10:45:43.63+00:00

    Hi Pan, John , Thankyou for using Microsoft Q&A platform and thanks for posting your query here. As per my understanding you are looking for way to mount ADLS gen2 using Account Key or SAS token in Azure Databricks. This can be achieved using the following code snippet : Account Key:

       dbutils.fs.mount(
          source = "wasbs://{containerName}@{storageAccountName}.blob.core.windows.net",
          mount_point = mountPoint,
          #extra_configs = {'fs.azure.account.key.' + storageAccountName + '.blob.core.windows.net': storageAccountAccessKey}
    

    User's image

    SAS token:

       dbutils.fs.mount(
          source ="wasbs://
          mount_point = mountPoint,
          extra_configs = {'fs.azure.sas.' + blobContainerName + '.' + storageAccountName + '.blob.core.windows.net': sasToken}
     
    

    User's image

    For more details, kindly watch out the below resources: Create Mount point using dbutils.fs.mount() in Azure Databricks Mount Azure Blob Storage to DBFS in Azure Databricks

    Without having to create mount point, you can set Spark properties to configure Azure credentials to access Azure storage both using access key and SAS token , watch out the below videos for implementation : Access ADLS Gen2 storage using Account Key in Azure Databricks Access ADLS Gen2 or Blob Storage using a SAS token in Azure Databricks Hope it helps. Kindly accept the answer by clicking on Accept answer button. Thankyou


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.