Share via


configure command

Note

This information applies to Databricks CLI versions 0.205 and above. The Databricks CLI is in Public Preview.

Databricks CLI use is subject to the Databricks License and Databricks Privacy Notice, including any Usage Data provisions.

The configure command within the Databricks CLI enables you to authenticate the Databricks CLI with Azure Databricks using Azure Databricks personal access tokens or Microsoft Entra ID (formerly Azure Active Directory) tokens.

Note

As a security best practice, when you authenticate with automated tools, systems, scripts, and apps, Databricks recommends that you use personal access tokens belonging to service principals instead of workspace users. To create tokens for service principals, see Manage tokens for a service principal.

Note that this article covers only Azure Databricks personal access token and Microsoft Entra ID token authentication for enabling the calling of workspace-level commands. For additional authentication configuration options, see Authentication for the Databricks CLI.

databricks configure

Configure a profile in your ~/.databrickscfg file. A configuration profile is a collection of settings that contains authentication information such as an Azure Databricks workspace URL and an access token value.

A configuration profile has a programmatic name, such as DEFAULT, DEV, or PROD. Adding multiple 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 an Azure Databricks workspace that you use for development workloads and a separate connection profile named PROD connection profile that references a different Azure Databricks workspace that you use for production workloads.

To get information about existing configuration profiles, use the auth command group.

You can change the default path of the .databrickscfg file by setting the environment variable DATABRICKS_CONFIG_FILE.

If this command is invoked in non-interactive mode, it will read the token from stdin. The host must be specified with the --host flag or the DATABRICKS_HOST environment variable.

databricks configure [flags]

Options

--configure-cluster

    Prompts to configure cluster

--host string

    Databricks workspace host URL

The workspace host URL is your per-workspace URL, with the format https://adb-<workspace-id>.<random-number>.azuredatabricks.net. To get the per-workspace URL, see Per-workspace URL.

--profile string

    Name for the connection profile to configure. (default "DEFAULT")

Global flags

Examples

The following example configures authentication for the default profile:

databricks configure

The following example configures authentication for a specific profile:

databricks configure --profile my-profile

The following example configures authentication with a specific host:

databricks configure --host https://my-workspace.cloud.databricks.com

The following example configures authentication with cluster configuration:

databricks configure --configure-cluster

Global flags

--debug

  Whether to enable debug logging.

-h or --help

    Display help for the Databricks CLI or the related command group or the related command.

--log-file string

    A string representing the file to write output logs to. If this flag is not specified then the default is to write output logs to stderr.

--log-format format

    The log format type, text or json. The default value is text.

--log-level string

    A string representing the log format level. If not specified then the log format level is disabled.

-o, --output type

    The command output type, text or json. The default value is text.

-p, --profile string

    The name of the profile in the ~/.databrickscfg file to use to run the command. If this flag is not specified then if it exists, the profile named DEFAULT is used.

--progress-format format

    The format to display progress logs: default, append, inplace, or json

-t, --target string

    If applicable, the bundle target to use

Create a configuration profile

To create a configuration profile, run the configure command:

databricks configure --host <workspace-url>

The command prompts you to enter your Azure Databricks personal access token or Microsoft Entra ID (formerly Azure Active Directory) 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> --profile <profile-name>

Tip

You can press Tab after --profile or -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.