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

Join 100K+ Data Experts: Register Now & Grow with Us!

Excited to expand your horizons with us? Click here to Register and begin your journey to success!

Already a member? Login and join your local regional user group! If there isn’t one near you, fill out this form and we’ll create one for you to join!