Tokens CLI

You run Databricks Tokens CLI subcommands by appending them to databricks tokens. These subcommands call the Token API 2.0.

databricks tokens --help
Usage: databricks tokens [OPTIONS] COMMAND [ARGS]...

  Utility to interact with Databricks tokens.

Options:
  -v, --version   [VERSION]
  --debug         Debug mode. Shows full stack trace on error.
  --profile TEXT  CLI connection profile to use. The default profile is
                  "DEFAULT".

  -h, --help      Show this message and exit.

Commands:
  create  Creates a token.
  list    Lists tokens for the calling user.
  revoke  Revokes an access token.

Create a token

To display usage documentation, run databricks tokens create --help.

databricks tokens create --lifetime-seconds 129600 --comment "My comment."
{
  "token_value": "dapi1a23b45678901cd2e3fa4bcde56f7890",
  "token_info": {
    "token_id": "1ab23cd45678e90123f4567abc8d9e012345fa67890123b45678cde90fa123b4",
    "creation_time": 1621287738473,
    "expiry_time": 1621417338473,
    "comment": "My comment."
  }
}

Important

Store the token_value value in a secure location. You will not be able to see it again.

List tokens

To display usage documentation, run databricks tokens list --help.

databricks tokens list
{
  "token_infos": [
    {
      "token_id": "1ab23cd45678e90123f4567abc8d9e012345fa67890123b45678cde90fa123b4",
      "creation_time": 1621287738473,
      "expiry_time": 1621417338473,
      "comment": "My comment."
    }
  ]
}

Revoke a token

To display usage documentation, run databricks tokens revoke --help.

databricks tokens revoke --token-id 1ab23cd45678e90123f4567abc8d9e012345fa67890123b45678cde90fa123b4
{}