Skip to content

Instantly share code, notes, and snippets.

@RaMSFT
Last active October 26, 2021 07:21
Show Gist options
  • Select an option

  • Save RaMSFT/02298c835191a71a10b2aabf1277c853 to your computer and use it in GitHub Desktop.

Select an option

Save RaMSFT/02298c835191a71a10b2aabf1277c853 to your computer and use it in GitHub Desktop.
This piece of code is to mount a ADLS Gen2 Container / directory with Databricks
#Don't change configs
configs = {
"fs.azure.account.auth.type": "CustomAccessToken",
"fs.azure.account.custom.token.provider.class": spark.conf.get("spark.databricks.passthrough.adls.gen2.tokenProviderClassName")
}
"""
One need following details from ADLS
1. Your container Name (Optionally, coresponding directory name)
2. Your Storage account Name
"""
# Optionally, you can add <directory-name> to the source URI of your mount point.
dbutils.fs.mount(
source = "abfss://<your Container Name>@<Your storage account name>.dfs.core.windows.net/<Optional - Specific Directory under container>",
mount_point = "/mnt/<Desired name for your mount - must be unique>",
extra_configs = configs)
#List mounts
dbutils.fs.mounts()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment