This information applies to Databricks CLI versions 0.205 and above, which are in Public Preview. To find your version of the Databricks CLI, run
As a security best practice when you authenticate with automated tools, systems, scripts, and apps, Databricks recommends that you use OAuth tokens or personal access tokens belonging to service principals instead of workspace users. To create tokens for service principals, see Manage tokens for a service principal.
This article covers only Databricks token authentication for enabling the calling of workspace-level commands. For additional authentication configuration options, see Authentication for the Databricks CLI.
Before you run this command, be sure to set up the Databricks CLI.
configure commands by appending them to
databricks configure. To display help for the
configure command, run
databricks configure -h.
A configuration profile is a collection of settings that contains authentication information such as a Databricks workspace URL and an access token value. A configuration profile has a programmatic name, such as
To create a configuration profile, run the
configure command as follows:
databricks configure --host <workspace-url>
https:// followed by your instance name, for example
https://<prefix>.cloud.databricks.com. To get your instance name, see Workspace instance names, URLs, and IDs.
The command prompts you to enter your Databricks personal access token that maps to the specified
✔ Databricks Token:
After you enter your access token, your access token is stored in the file
~/.databrickscfg on Linux or macOS, or
%USERPROFILE%\.databrickscfg on Windows by default. The file contains a default connection profile entry named
[DEFAULT] host = <workspace-url> token = <access-token>
To use a different name for your connection profile instead of
DEFAULT, add the
--profile option to the
configure command, for example:
databricks configure --host <workspace-url> --profile <profile-name>
You can press
-p to display a list of existing available configuration profiles to choose from, instead of entering the configuration profile name manually.
Any existing host and token information within the specified connection profile is overwritten with the new host and token information.
Adding multiple connection profiles to the
.databrickscfg file enables you to quickly run commands across various workspaces by specifying the target connection profile’s name in the command’s
--profile option. If you do not specify the
--profile option in a command that supports this option, the command will use the
DEFAULT connection profile by default.
For example, you could have a connection profile named
DEV that references a Databricks workspace that you use for development workloads and a separate connection profile named
PROD connection profile that references a different Databricks workspace that you use for production workloads.
You can change the default path of this
.databrickscfg file by setting the environment variable
DATABRICKS_CONFIG_FILE. To learn how to set environment variables, see your operating system’s documentation.
To get information about existing configuration profiles, use the auth command group.