cancel
Showing results for 
Search instead for 
Did you mean: 
Get Started Discussions
Start your journey with Databricks by joining discussions on getting started guides, tutorials, and introductory topics. Connect with beginners and experts alike to kickstart your Databricks experience.
cancel
Showing results for 
Search instead for 
Did you mean: 

How to create a mount point to File share in Azure Storage account

RajaDOP
New Contributor

Hello All,

I have a requirement to create a mount point to file share in Azure Storage account, I did follow the official documentation. However, I could not create the mount point to fileshare.. and the documentation discribed the mount point creation to only containers in Azure storage account.. that did not work for fileshare.

Documentation I followed and it explained only for container mounting: Access Azure Blob Storage using Azure Databricks and Azure Key Vault | Microsoft Learn

Command I used:
---------------------------------------

dbutils.fs.mount(
source = "wasbs://<your-container-name>@<your-storage-account-name>.blob.core.windows.net",
mount_point = "/mnt/<mount-name>",
extra_configs = {"<conf-key>":dbutils.secrets.get(scope = "<scope-name>", key = "<key-name>")})

df = spark.read.text("/mnt/<mount-name>/<file-name>")

df.show()

------------

Can somoone please share the step-by-spey process to create mount point to Fileshare in Azure Storage account from Databricks only.

Appreciate your help.!!

Raja

1 REPLY 1

Aaaddison
New Contributor II

Hi Raja,

You're correct that the wasbs:// method is for Azure Blob Storage, not File Shares! I believe File Share mounting is different and would require you to use SMB protocol mounted outside of Databricks since File Shares isn't natively supported! So you can either use a VM or container, or instead of mounting, use the Azure SDK for Python to read/write files directly from Azure File Share: 

1. install SDK: pip install azure-storage-file-share

2.read the file you want from Azure File Share w/Python in Databricks (sample code):

from azure.storage.fileshare import ShareFileClient

file_client = ShareFileClient.from_connection_string(
  conn_str="<your-connection-string>",
  share_name="<share-name>",
  file_path="<file-name>"
)

download = file_client.download_file()
file_content = download.readall()
print(file_content.decode())

Join Us as a Local Community Builder!

Passionate about hosting events and connecting people? Help us grow a vibrant local community—sign up today to get started!

Sign Up Now