token_management
Creates, updates, deletes, gets or lists a token_management resource.
Overview
| Name | token_management |
| Type | Resource |
| Id | databricks_workspace.settings.token_management |
Fields
The following fields are returned by SELECT queries:
- get
- list
| Name | Datatype | Description |
|---|---|---|
token_info | object |
| Name | Datatype | Description |
|---|---|---|
created_by_id | integer | User ID of the user that created the token. |
owner_id | integer | User ID of the user that owns the token. |
token_id | string | ID of the token. |
workspace_id | integer | If applicable, the ID of the workspace that the token was created in. |
comment | string | |
created_by_username | string | Username of the user that created the token. |
creation_time | integer | Timestamp when the token was created. |
expiry_time | integer | Timestamp when the token expires. |
last_used_day | integer | Approximate timestamp for the day the token was last used. Accurate up to 1 day. |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get | select | token_id, deployment_name | Gets information about a token, specified by its ID. | |
list | select | deployment_name | created_by_id, created_by_username | Lists all tokens associated with the specified workspace or user. |
create | insert | deployment_name, application_id | Creates a token on behalf of a service principal. | |
delete | delete | token_id, deployment_name | Deletes 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.
| Name | Datatype | Description |
|---|---|---|
deployment_name | string | The Databricks Workspace Deployment Name (default: dbc-abcd0123-a1bc) |
token_id | string | The ID of the token to revoke. |
created_by_id | integer | User ID of the user that created the token. |
created_by_username | string | Username of the user that created the token. |
SELECT examples
- get
- list
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
;
Lists all tokens associated with the specified workspace or user.
SELECT
created_by_id,
owner_id,
token_id,
workspace_id,
comment,
created_by_username,
creation_time,
expiry_time,
last_used_day
FROM databricks_workspace.settings.token_management
WHERE deployment_name = '{{ deployment_name }}' -- required
AND created_by_id = '{{ created_by_id }}'
AND created_by_username = '{{ created_by_username }}'
;
INSERT examples
- create
- Manifest
Creates a token on behalf of a service principal.
INSERT INTO databricks_workspace.settings.token_management (
application_id,
comment,
lifetime_seconds,
deployment_name
)
SELECT
'{{ application_id }}' /* required */,
'{{ comment }}',
{{ lifetime_seconds }},
'{{ deployment_name }}'
RETURNING
token_info,
token_value
;
# Description fields are for documentation purposes
- name: token_management
props:
- name: deployment_name
value: "{{ deployment_name }}"
description: Required parameter for the token_management resource.
- name: application_id
value: "{{ application_id }}"
description: |
Application ID of the service principal.
- name: comment
value: "{{ comment }}"
description: |
Comment that describes the purpose of the token.
- name: lifetime_seconds
value: {{ lifetime_seconds }}
description: |
The number of seconds before the token expires.
DELETE examples
- delete
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
;