configure command group
Note
This information applies to Databricks CLI versions 0.100 and higher, which are in Private Preview. To try them, reach out to your Databricks contact. To find your version of the Databricks CLI, run databricks -v
.
The configure
command group within the Databricks CLI enables you to authenticate the Databricks CLI with Databricks by using Databricks personal access tokens.
Note
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 personal access tokens for a service principal.
Note that this article covers only Databricks token authentication for enabling the calling of workspace-level commands. For additional authentication configuration options, see Set up authentication.
Important
Before you run this command, be sure to set up the Databricks CLI.
You run configure
commands by appending them to databricks configure
. To display help for the configure
command, run databricks configure -h
.
Create a configuration profile
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 DEFAULT
, DEV
, or PROD
.
To create a configuration profile, run the configure
command as follows:
databricks configure --host <workspace-url> --token
For <workspace-url>
, enter 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 <workspace-url>
:
✔ 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
:
[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> --token --profile <profile-name>
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.