Last active
October 26, 2021 07:21
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #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