How can we find existing secret scopes in databricks workspace. And which keyvault is referred by specific SecretScope in Azure Databricks?
How can we find existing secret scopes in databricks workspace. And which keyvault is referred by specific SecretScope in Azure Databricks?
You can do this with either:
databricks secrets list-scopes command will show your KeyVault URLYou can try this snippet here in Python:
import pandas
import json
import requests
# COMMAND ----------
# MAGIC %md ### define variables
# COMMAND ----------
pat = 'EnterPATHere' # paste PAT. Get it from settings > user settings
workspaceURL = 'EnterWorkspaceURLHere' # paste the workspace url in the format of 'https://adb-1234567.89.azuredatabricks.net' Note, the URL must not end with '/'
# COMMAND ----------
# MAGIC %md ### list secret scopes
# COMMAND ----------
response = requests.get(workspaceURL + '/api/2.0/secrets/scopes/list',\
headers = {'Authorization' : 'Bearer '+ pat,\
'Content-Type': 'application/json'})
pandas.json_normalize(json.loads(response.content), record_path = 'scopes')
I have happened to have written a blog post about this where a full Python script is provided to manage secret scopes in Azure Databricks.