Skip to main content

secrets

Creates, updates, deletes, gets or lists a secrets resource.

Overview

Namesecrets
TypeResource
Iddatabricks_workspace.workspace.secrets

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
keystring
valuestringThe value of the secret in its byte representation.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectscope, key, deployment_nameGets a secret for a given key and scope. This API can only be called from the DBUtils interface. Users
listselectscope, deployment_nameLists the secret keys that are stored at this scope. This is a metadata-only operation; secret data
putinsertdeployment_name, scope, keyInserts a secret under the provided scope with the given name. If a secret already exists with the
deleteexecdeployment_name, scope, keyDeletes the secret stored in this secret scope. You must have WRITE or MANAGE permission on

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
deployment_namestringThe Databricks Workspace Deployment Name (default: dbc-abcd0123-a1bc)
keystringName of the secret to fetch value information.
scopestringThe name of the scope to list secrets within.

SELECT examples

Gets a secret for a given key and scope. This API can only be called from the DBUtils interface. Users

SELECT
key,
value
FROM databricks_workspace.workspace.secrets
WHERE scope = '{{ scope }}' -- required
AND key = '{{ key }}' -- required
AND deployment_name = '{{ deployment_name }}' -- required
;

INSERT examples

Inserts a secret under the provided scope with the given name. If a secret already exists with the

INSERT INTO databricks_workspace.workspace.secrets (
scope,
key,
bytes_value,
string_value,
deployment_name
)
SELECT
'{{ scope }}' /* required */,
'{{ key }}' /* required */,
'{{ bytes_value }}',
'{{ string_value }}',
'{{ deployment_name }}'
;

Lifecycle Methods

Deletes the secret stored in this secret scope. You must have WRITE or MANAGE permission on

EXEC databricks_workspace.workspace.secrets.delete 
@deployment_name='{{ deployment_name }}' --required
@@json=
'{
"scope": "{{ scope }}",
"key": "{{ key }}"
}'
;