Begin typing your search above and press return to search. Press Esc to cancel.

    • twitter
    • YouTube
    • linkedin

Beyond the Horizon…

Empower your digital transformation journey with boundless power of the cloud

Primary Navigation

  • Home
  • Azure
  • AI
  • Databricks
  • Snowflake
  • Kubernetes
  • Fabric
  • About me
  • Videos
  • Public Speaking
  • Books
  1. Home
  2. Azure
  3. How to mount Azure Storage Account to Databricks with SAS key?

How to mount Azure Storage Account to Databricks with SAS key?


By
rajaniesh
.
Published on April 6, 2020. August 21, 2023 0

In this blog, we will discuss on how to mount Azure storage accounts to Databricks with SAS key. The purpose of this blog post is to mount the storage account in the shortest possible time. Here are the steps involved:

  1. Open the storage account in the Azure Portal and then open the shared access signature key from the left panel.
  2. Select the duration of the SAS access key by selecting the start date time
  3. Select the duration of the SAS access key by selecting the end date time. This is described in the below screenshots (steps 2 and 3).
  4. Click Generate SAS and connection string. Step 4 in the screenshot.
  5. Copy the SAS key provided in step 5 in the screenshot.

Now you have the SAS key for the storage account. Let’s use it in the mounting config as per the below notebook code.

val storageAccount = "put storage account name here"
val container = "Container name to mount "
val sasKey = "Copy the SAS key generated at Step 5"

val mountPoint = s"/mnt/mymountpointname"


try {
  dbutils.fs.unmount(s"$mountPoint") // Use this to unmount as needed
} catch {
  case ioe: java.rmi.RemoteException => println(s"$mountPoint already unmounted")
}


val sourceString = s"wasbs://$container@$storageAccount.blob.core.windows.net/"
val confKey = s"fs.azure.sas.$container.$storageAccount.blob.core.windows.net"



try {
  dbutils.fs.mount(
    source = sourceString,
    mountPoint = mountPoint,
    extraConfigs = Map(confKey -> sasKey)
  )
}
catch {
  case e: Exception =>
    println(s"*** ERROR: Unable to mount $mountPoint. Run previous cells to unmount first")
}



%fs ls /mnt/mymountpointname/

/*This will list all the files located at the container*/

I hope this post is useful!!

Share this:

  • Tweet

Like this:

Like Loading...

Related

Categories Azure
Tags Azure authenticationAzure Databricksazure databricks demoAzure PortalAzure StorageAzure Storage AccountDatabricksMicrosoftmicrosoft azureSASSAS key

0 likes
avatar

Author

rajaniesh

  • Website

+ There are no comments

Add yours

Leave a ReplyCancel reply

Subscribe Now!

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Join 3,527 other subscribers

Connect with me

Rajaniesh Kaushikk is Microsoft MVP and TOGAF Certified Enterprise Architect with over 22 years of experience in delivering complex software application architectures for Fortune 500 companies. He specializes in Hybrid Cloud, Azure Cloud, Power BI, Azure Synapse, Data Lake, Data Warehouse, HDInsight, Databricks Lakehouse, Snowflake, Azure DevOps, Kubernetes, and production debugging. Rajaniesh holds several industry certifications, including Databricks Champion, Databricks Certified Data Engineer Professional, Microsoft Certified Azure Solutions Architect Expert, Snowflake SnowPro core, Snowflake Advanced Architect, and Microsoft Certified Trainer. He is also a blogger, YouTuber, and speaker on various Microsoft technology events.

Follow Us

  • Facebook
  • X
  • Tumblr
  • Instagram
  • Pinterest

2026 © Beyond the Horizon

Discover more from Beyond the Horizon...

Subscribe now to keep reading and get access to the full archive.

Continue reading

 

Loading Comments...
 

    %d