Skip to main content

service_principal_secrets

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

Overview

Nameservice_principal_secrets
TypeResource
Iddatabricks_account.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
service_principal_secrets_listselectaccount_id, service_principal_idpage_size, page_tokenList all secrets associated with the given service principal. This operation only returns information
service_principal_secrets_createinsertaccount_id, service_principal_idCreate a secret for the given service principal.
service_principal_secrets_deletedeleteaccount_id, service_principal_id, secret_idDelete 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
account_idstring
secret_idstringThe secret ID.
service_principal_idstringThe service principal ID.
page_sizeinteger:param page_token: str (optional) An 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.
page_tokenstring

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_account.oauth2.service_principal_secrets
WHERE account_id = '{{ account_id }}' -- required
AND service_principal_id = '{{ service_principal_id }}' -- required
AND page_size = '{{ page_size }}'
AND page_token = '{{ page_token }}'
;

INSERT examples

Create a secret for the given service principal.

INSERT INTO databricks_account.oauth2.service_principal_secrets (
lifetime,
account_id,
service_principal_id
)
SELECT
'{{ lifetime }}',
'{{ account_id }}',
'{{ service_principal_id }}'
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_account.oauth2.service_principal_secrets
WHERE account_id = '{{ account_id }}' --required
AND service_principal_id = '{{ service_principal_id }}' --required
AND secret_id = '{{ secret_id }}' --required
;