Skip to main content

token_management

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

Overview

Nametoken_management
TypeResource
Iddatabricks_workspace.settings.token_management

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
token_infoobject

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselecttoken_id, deployment_nameGets information about a token, specified by its ID.
listselectdeployment_namecreated_by_id, created_by_usernameLists all tokens associated with the specified workspace or user.
createinsertdeployment_name, application_idCreates a token on behalf of a service principal.
token_management_update_token_managementupdatetoken_id, deployment_name, token, update_maskUpdates a token, specified by its ID.
deletedeletetoken_id, deployment_nameDeletes a token, specified by its ID.

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)
token_idstringThe ID of the token to revoke.
created_by_idintegerUser ID of the user that created the token.
created_by_usernamestringUsername of the user that created the token.

SELECT examples

Gets information about a token, specified by its ID.

SELECT
token_info
FROM databricks_workspace.settings.token_management
WHERE token_id = '{{ token_id }}' -- required
AND deployment_name = '{{ deployment_name }}' -- required
;

INSERT examples

Creates a token on behalf of a service principal.

INSERT INTO databricks_workspace.settings.token_management (
application_id,
autoscope_enabled,
comment,
lifetime_seconds,
scopes,
deployment_name
)
SELECT
'{{ application_id }}' /* required */,
{{ autoscope_enabled }},
'{{ comment }}',
{{ lifetime_seconds }},
'{{ scopes }}',
'{{ deployment_name }}'
RETURNING
token_info,
token_value
;

UPDATE examples

Updates a token, specified by its ID.

UPDATE databricks_workspace.settings.token_management
SET
token = '{{ token }}',
update_mask = '{{ update_mask }}'
WHERE
token_id = '{{ token_id }}' --required
AND deployment_name = '{{ deployment_name }}' --required
AND token = '{{ token }}' --required
AND update_mask = '{{ update_mask }}' --required
RETURNING
created_by_id,
owner_id,
token_id,
workspace_id,
autoscope_state,
backfill_scopes,
comment,
created_by_username,
creation_time,
expiry_time,
inferred_scopes,
last_used_day,
scopes;

DELETE examples

Deletes a token, specified by its ID.

DELETE FROM databricks_workspace.settings.token_management
WHERE token_id = '{{ token_id }}' --required
AND deployment_name = '{{ deployment_name }}' --required
;