Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-02-2025 10:30 AM - edited 07-02-2025 10:33 AM
Use the below code in your notebook. You cannot set spark config in serverless as there is no advanced options in cluster.
credential_id = dbutils.secrets.get(scope="{scope_name}",key="{app_id}")
credential_key = dbutils.secrets.get(scope="{scope_name}",key="{app_key}")
spark.conf.set("fs.azure.account.auth.type.dfs.core.windows.net", "OAuth")
spark.conf.set("fs.azure.account.oauth.provider.type.dfs.core.windows.net", "org.apache.hadoop.fs.azurebfs.oauth2.ClientCredsTokenProvider")
spark.conf.set("fs.azure.account.oauth2.client.id.dfs.core.windows.net", credential_id)
spark.conf.set("fs.azure.account.oauth2.client.secret.dfs.core.windows.net", credential_key)
spark.conf.set("fs.azure.account.oauth2.client.endpoint.dfs.core.windows.net", "https://login.microsoftonline.com/{azure tenant id}/oauth2/token")If you are using serverless please use external locations and Unity catalog for data lake access.
https://docs.databricks.com/aws/en/sql/language-manual/sql-ref-external-locations