cancel
Showing results for 
Search instead for 
Did you mean: 
Data Engineering
Join discussions on data engineering best practices, architectures, and optimization strategies within the Databricks Community. Exchange insights and solutions with fellow data engineers.
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

aladda
Honored Contributor II
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

Connect with Databricks Users in Your Area

Join a Regional User Group to connect with local Databricks users. Events will be happening in your city, and you won’t want to miss the chance to attend and share knowledge.

If there isn’t a group near you, start one and help create a community that brings people together.

Request a New Group