Can we display key vault secret in Databricks notebook

Shreyash_Gupta
New Contributor III

I am using databricks notebook and Azure key vault.

When I am using below function I am getting as output [REDACTED].

'dbutils.secrets.get(scope_name,secret_name)'
 
I want to know if there is any way to display the secret in databricks.

Walter_C
Databricks Employee
Databricks Employee

In Databricks, secrets retrieved using dbutils.secrets.get(scope_name, secret_name) are intentionally redacted and displayed as [REDACTED] in notebook outputs to ensure sensitive information is not exposed. This behavior is a security feature to prevent accidental exposure of secrets.

If you need to verify the value of a secret, you should do so outside of the notebook environment, such as directly within the Azure Key Vault interface or using the Azure CLI.

I completely understand the security perspective. Just wanted to know if there is any way to do it or not.
Thankyou for your response.

daniel_sahal
Databricks MVP

@Shreyash_Gupta 
You can simply iterate over each letter of the secret and print it.
Something like this:

for letter in dbutils.secrets.get(scope_name,secret_name):
   print(letter)

View solution in original post

Thanks for this solution @daniel_sahal. It is simple yet effective