- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-13-2026 10:35 AM
How can I access secrets in pipeline yaml or directly in python script file?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-13-2026 10:49 AM
Hi @prakharsachan ,
In Declarative Automation Bundles YAML (formerly known as Databricks Assets Bundles) you can only define secret scopes:
If you want to read secrets from secret scope you can use dbutils in python script:
password = dbutils.secrets.get(scope = "<scope-name>", key = "<key-name>")If you're talking more about devops pipeline you can also use databricks cli to read secret in following way:
databricks secrets get-secret <scope-name> <key-name> | jq -r .value | base64 --decode
More information you can find below:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-13-2026 10:38 PM
@szymon_dybczak
But dbutils utility can be used only in notebooks , but cant be used in python .py files.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-14-2026 12:25 AM
Hi @prakharsachan ,
If dbutils doesn't work for you then you can use Databricks Python SDK. Below you can find get_secret method which you can use to read secret from a secret scope:
w.secrets: Secret — Databricks SDK for Python beta documentation