turbot/databricks
steampipe plugin install databricks

Table: databricks_settings_token_management - Query Databricks Token Management Settings using SQL

Databricks Token Management is a feature within Databricks that provides control over the generation and usage of tokens. It allows users to manage the lifespan and permissions of tokens, enhancing the security of the platform. Token Management helps in maintaining the integrity of the data and operations performed in Databricks.

Table Usage Guide

The databricks_settings_token_management table provides insights into token settings within Databricks Token Management. As a security engineer, explore token-specific details through this table, including lifespan, permissions, and associated metadata. Utilize it to uncover information about tokens, such as their validity period, the operations they can perform, and the verification of their permissions.

Examples

Basic info

Explore which user-created tokens are currently active in your Databricks settings. This is useful to understand token management, including who created each token and when they will expire.

select
token_id,
comment,
created_by_username,
creation_time,
expiry_time,
account_id
from
databricks_settings_token_management;
select
token_id,
comment,
created_by_username,
creation_time,
expiry_time,
account_id
from
databricks_settings_token_management;

List tokens created in the last 30 days

Identify the tokens that have been created in the past month. This can be useful to monitor recent activity and manage security in your Databricks environment.

select
token_id,
comment,
created_by_username,
creation_time,
expiry_time,
account_id
from
databricks_settings_token_management
where
creation_time >= now() - interval '30' day;
select
token_id,
comment,
created_by_username,
creation_time,
expiry_time,
account_id
from
databricks_settings_token_management
where
creation_time >= datetime('now', '-30 day');

List all tokens expiring in the next 7 days

Determine the areas in which tokens are set to expire within the upcoming week. This is useful for preemptively managing access and maintaining security within your Databricks environment.

select
token_id,
comment,
created_by_username,
creation_time,
expiry_time,
account_id
from
databricks_settings_token_management
where
expiry_time > now()
and expiry_time < now() + interval '7' day;
select
token_id,
comment,
created_by_username,
creation_time,
expiry_time,
account_id
from
databricks_settings_token_management
where
expiry_time > datetime('now')
and expiry_time < datetime('now', '+7 day');

Get number of days each token is valid for

Determine the validity duration of each token by calculating the number of days left before expiration. This can help in managing and planning the token usage effectively.

select
token_id,
comment,
expiry_time - now() as days_remaining,
account_id
from
databricks_settings_token_management
order by
days_remaining desc;
select
token_id,
comment,
julianday(expiry_time) - julianday('now') as days_remaining,
account_id
from
databricks_settings_token_management
order by
days_remaining desc;

List the owner in order of the number of tokens

Explore which user has created the most tokens in your Databricks configuration to better understand usage patterns and potentially optimize resource allocation.

select
owner_id,
created_by_username,
count(*) as token_count
from
databricks_settings_token_management
group by
owner_id,
created_by_username
order by
token_count desc;
select
owner_id,
created_by_username,
count(*) as token_count
from
databricks_settings_token_management
group by
owner_id,
created_by_username
order by
token_count desc;

Schema for databricks_settings_token_management

NameTypeOperatorsDescription
_ctxjsonbSteampipe context in JSON form, e.g. connection_name.
account_idtextThe Databricks Account ID in which the resource is located.
commenttextComment that describes the purpose of the token, specified by the token creator.
created_by_idbigint=User id of the user that created the token.
created_by_usernametext=Username of the user that created the token.
creation_timetimestamp with time zoneTimestamp when the token was created.
expiry_timetimestamp with time zoneTimestamp when the token expires.
owner_idbigintUser id of the user that owns the token.
titletextThe title of the resource.
token_idtext=ID of the token.

Export

This table is available as a standalone Exporter CLI. Steampipe exporters are stand-alone binaries that allow you to extract data using Steampipe plugins without a database.

You can download the tarball for your platform from the Releases page, but it is simplest to install them with the steampipe_export_installer.sh script:

/bin/sh -c "$(curl -fsSL https://steampipe.io/install/export.sh)" -- databricks

You can pass the configuration to the command with the --config argument:

steampipe_export_databricks --config '<your_config>' databricks_settings_token_management