Skip to main content

service_principal_secrets

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

Overview

Nameservice_principal_secrets
TypeResource
Iddatabricks_workspace.oauth2.service_principal_secrets

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
idstringID of the secret
create_timestring
expire_timestringUTC time when the secret will expire. If the field is not present, the secret does not expire.
secret_hashstringSecret Hash
statusstringStatus of the secret
update_timestringUTC time when the secret was updated

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
listselectservice_principal_id, deployment_namepage_size, page_tokenList all secrets associated with the given service principal. This operation only returns information
createinsertservice_principal_id, deployment_nameCreate a secret for the given service principal.
deletedeleteservice_principal_id, secret_id, deployment_nameDelete a secret from the given service principal.

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)
secret_idstringThe secret ID.
service_principal_idstringThe service principal ID.
page_sizeinteger
page_tokenstringAn opaque page token which was the next_page_token in the response of the previous request to list the secrets for this service principal. Provide this token to retrieve the next page of secret entries. When providing a page_token, all other parameters provided to the request must match the previous request. To list all of the secrets for a service principal, it is necessary to continue requesting pages of entries until the response contains no next_page_token. Note that the number of entries returned must not be used to determine when the listing is complete.

SELECT examples

List all secrets associated with the given service principal. This operation only returns information

SELECT
id,
create_time,
expire_time,
secret_hash,
status,
update_time
FROM databricks_workspace.oauth2.service_principal_secrets
WHERE service_principal_id = '{{ service_principal_id }}' -- required
AND deployment_name = '{{ deployment_name }}' -- required
AND page_size = '{{ page_size }}'
AND page_token = '{{ page_token }}'
;

INSERT examples

Create a secret for the given service principal.

INSERT INTO databricks_workspace.oauth2.service_principal_secrets (
lifetime,
service_principal_id,
deployment_name
)
SELECT
'{{ lifetime }}',
'{{ service_principal_id }}',
'{{ deployment_name }}'
RETURNING
id,
create_time,
expire_time,
secret,
secret_hash,
status,
update_time
;

DELETE examples

Delete a secret from the given service principal.

DELETE FROM databricks_workspace.oauth2.service_principal_secrets
WHERE service_principal_id = '{{ service_principal_id }}' --required
AND secret_id = '{{ secret_id }}' --required
AND deployment_name = '{{ deployment_name }}' --required
;