cancel
Showing results for 
Search instead for 
Did you mean: 
Data Engineering
cancel
Showing results for 
Search instead for 
Did you mean: 

Secrets in databricks

User16790091296
Contributor II

I created a secret on databricks using the secrets API.

Code :

Scope_name : {"scope": "dbtest", "initial_manage_principal":"user"}
Resp= requests.post('https://instancename.net/mynoteid/api/2.0/secrets/scopes/create',json=Scope_name)

Similar way, I added the user and password

Code:

Content = {"scope":"dbtest","key":"user","string_value":"Vidyasekar"}
requests.post('https://instancename.net/mynoteid/api/2.0/secrets/put', json=content)

After the execution I got response : 

<Response [200]>

Which means secrets stored successfully.

While listing the same using the list API call or 

dbutils.secrets.get()

, its shows 'Secret does not exist with scope

Here my doubt is, How to get the databricks intance name? Where the secrets stored in the DBFS location?

1 REPLY 1

Anand_Ladda
Honored Contributor II

You'll have to specify the scope and the key in the format below to get the value.

dbutils.secret.get(scope="dbtest", key="user") 

Probably a good idea to review the Secret Management documentation for details on how to get this setup the right way - https://docs.databricks.com/security/secrets/index.html

Welcome to Databricks Community: Lets learn, network and celebrate together

Join our fast-growing data practitioner and expert community of 80K+ members, ready to discover, help and collaborate together while making meaningful connections. 

Click here to register and join today! 

Engage in exciting technical discussions, join a group with your peers and meet our Featured Members.