Skip to main content

user_tokens

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

Overview

Nameuser_tokens
TypeResource
Iddatabricks_workspace.workspace.user_tokens

Fields

The following fields are returned by SELECT queries:

Request completed successfully.

NameDatatypeDescription
token_idstring
commentstring
creation_timeinteger
expiry_timeinteger

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
listtokensselectdeployment_nameLists all the valid tokens for a user-workspace pair.
createinsertdeployment_nameCreates and returns a token for a user. If this call is made through token authentication, it creates a token with the same client ID as the authenticated token. If the user's token quota is exceeded, this call returns an error
revoketokenexecdeployment_nameRevokes an access token.

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)

SELECT examples

Lists all the valid tokens for a user-workspace pair.

SELECT
token_id,
comment,
creation_time,
expiry_time
FROM databricks_workspace.workspace.user_tokens
WHERE deployment_name = '{{ deployment_name }}' -- required;

INSERT examples

Creates and returns a token for a user. If this call is made through token authentication, it creates a token with the same client ID as the authenticated token. If the user's token quota is exceeded, this call returns an error

INSERT INTO databricks_workspace.workspace.user_tokens (
data__lifetime_seconds,
data__comment,
deployment_name
)
SELECT
{{ lifetime_seconds }},
'{{ comment }}',
'{{ deployment_name }}'
RETURNING
token_info,
token_value
;

Lifecycle Methods

Revokes an access token.

EXEC databricks_workspace.workspace.user_tokens.revoketoken 
@deployment_name='{{ deployment_name }}' --required
@@json=
'{
"token_id": "{{ token_id }}"
}';