Share via

Azure databricks include spark.conf.set

sakuraime 2,351 Reputation points
2021-03-26T14:02:53.737+00:00

Currently the notebook need to use spark.conf.set to set storage account password .
like

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", ".**************************")
spark.conf.set("fs.azure.account.oauth2.client.secret..**************************.dfs.core.windows.net", dbutils.secrets.get(scope=".**************************",key=".**************************"))
spark.conf.set("fs.azure.account.oauth2.client.endpoint..**************************.dfs.core.windows.net", "https://login.microsoftonline.com/.**************************/oauth2/token")j

how to include in during spark cluster startup as a global config ?

Azure Databricks
Azure Databricks

An Apache Spark-based analytics platform optimized for Azure.

{count} votes

2 answers

Sort by: Most helpful
  1. Aneesh Kumar A L 21 Reputation points
    2021-05-16T08:41:04.727+00:00

    Hi @PRADEEPCHEEKATLA , I have used the same configuration as mentioned above and getting the following error. Could you please help.

    The configuration is working fine when I give the application id and secret value directly (not from key vault)

    key-vault : it is the secret scope created in the workspace.96903-image.png

    96904-image.png

    0 comments No comments

  2. PRADEEPCHEEKATLA 91,846 Reputation points
    2021-04-05T12:46:29.377+00:00

    Here are the steps to access secrets in databricks initscript:

    1. Go to cluster
    2. Click Edit next to the Cluster information.
    3. On the Configure Cluster page, click Advanced Options.
    4. On the Spark tab, enter the following Spark Config:

    88072-image.png

    Sample ini code:

    fs.azure.account.auth.type.chepragen2.dfs.core.windows.net OAuth  
    fs.azure.account.oauth.provider.type.chepragen2.dfs.core.windows.net org.apache.hadoop.fs.azurebfs.oauth2.ClientCredsTokenProvider  
    fs.azure.account.oauth2.client.id.chepragen2.dfs.core.windows.net {{secrets/chepra/ClientID}}  
    fs.azure.account.oauth2.client.secret.chepragen2.dfs.core.windows.net {{secrets/chepra/ClientSecret}}  
    fs.azure.account.oauth2.client.endpoint.chepragen2.dfs.core.windows.net https://login.microsoftonline.com/72f988bf-86f1-41af-91ab-2d7cd011db47/oauth2/token  
    

    For more details, refer Azure Databricks - configure the cluster to read secrets from the secret scope.

    Hope this helps. Do let us know if you any further queries.

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

    Please don’t forget to Accept Answer and Up-Vote wherever the information provided helps you, this can be beneficial to other community members.


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.