---
title: Databricks configuration profiles
description: Learn how to create, configure, and use Databricks configuration profiles to manage authentication settings across multiple workspaces and environments.
canonical_url: https://docs.databricks.com/aws/en/dev-tools/auth/config-profiles
---

# Databricks configuration profiles

A Databricks configuration profile stores authentication settings in the `.databrickscfg` file. Configuration profiles make it easy to switch between different workspaces, environments, or authentication methods without changing your code.

Tools, SDKs, scripts, and apps can reference configuration profiles to authenticate with Databricks. All tools and SDKs that implement [unified authentication](https://docs.databricks.com/aws/en/dev-tools/auth/unified-auth.md) support configuration profiles.

## <a id="what-is-profile" />What is a configuration profile?

A configuration profile is a named section in the `.databrickscfg` file that contains the following:

* Authentication credentials, such as tokens or service principal credentials
* The Databricks workspace or account URL
* Optional settings specific to your authentication method

Create multiple profiles in a single `.databrickscfg` file to manage connections to different workspaces or environments like development, staging, and production.

## <a id="create-profile" />Create a configuration profile

Create a configuration profile using the [Databricks CLI](https://docs.databricks.com/aws/en/dev-tools/cli/index.md) or by manually editing the `.databrickscfg` file.

### <a id="create-cli" />Create a profile with the CLI

The easiest way to create a configuration profile for interactive user authentication is with the Databricks CLI:

```bash
databricks auth login --host <workspace-url>
```

The CLI opens your web browser to complete the authentication flow. After you sign in, the CLI saves the credentials as a configuration profile.

### <a id="create-manual" />Create a profile manually

To create a configuration profile manually:

1. Create a file named `.databrickscfg` in your home directory:
   * **Unix, Linux, macOS:** `~/.databrickscfg`
   * **Windows:** `%USERPROFILE%\.databrickscfg`

2. Add a profile with the following format:

   ```
   [<profile-name>]
   <field-name> = <field-value>
   ```

   Replace the placeholders:

   * `<profile-name>`: A unique name like `DEFAULT`, `DEVELOPMENT`, or `PRODUCTION`
   * `<field-name>` and `<field-value>`: The authentication fields for your authentication method

For example, for [OAuth machine-to-machine (M2M) authentication](https://docs.databricks.com/aws/en/dev-tools/auth/oauth-m2m.md), the `.databrickscfg` file looks like this:

```
[DEFAULT]
host          = https://<workspace-url>
client_id     = <client-id>
client_secret = <client-secret>
```

## <a id="multiple-profiles" />Create multiple profiles

Define multiple profiles in the same `.databrickscfg` file to manage different workspaces or environments. Each profile must have a unique name.

```
[DEFAULT]
host          = https://production-workspace-url
client_id     = <production-client-id>
client_secret = <production-client-secret>

[DEVELOPMENT]
host          = https://dev-workspace-url
client_id     = <dev-client-id>
client_secret = <dev-client-secret>

[STAGING]
host          = https://staging-workspace-url
client_id     = <staging-client-id>
client_secret = <staging-client-secret>
```

## <a id="different-auth-types" />Combine authentication types

Define multiple authentication methods in separate profiles within your configuration file. This is useful when you want to use different credentials for different workflows or tools. For example, you might use cloud-native authentication for interactive use and OAuth credentials for automation:

```
[DEFAULT]
host = https://<workspace-url>

[SERVICE_PRINCIPAL]
host          = https://<workspace-url>
client_id     = <client-id>
client_secret = <client-secret>
```

For more information about authentication types and their required fields, see [Databricks unified authentication](https://docs.databricks.com/aws/en/dev-tools/auth/unified-auth.md).

## <a id="use-profile" />Use a configuration profile

After you create a configuration profile, reference it in your tools and code. If you don't specify a profile name, Databricks tools and SDKs automatically use the `DEFAULT` profile.

To use a profile other than `DEFAULT`, specify the profile name:

**With the Databricks CLI:**

```bash
databricks workspace list --profile DEVELOPMENT
```

**With environment variable:**

```bash
export DATABRICKS_CONFIG_PROFILE=DEVELOPMENT
databricks workspace list
```

**With the Python SDK:**

```python
from databricks.sdk import WorkspaceClient

# Specify profile in code
w = WorkspaceClient(profile="DEVELOPMENT")

# Or use environment variable DATABRICKS_CONFIG_PROFILE
```

> [!TIP]
>
> To list available profiles, run:
>
> ```bash
> databricks auth profiles -o text
> ```

## <a id="best-practices" />Best practices

* Use the DEFAULT profile for your most common workspace to minimize the need to specify profile names.
* Use descriptive profile names like `PRODUCTION`, `DEVELOPMENT`, or `STAGING` instead of generic names.
* Protect your `.databrickscfg` file by setting restricted file permissions (readable only by your user).
* Don't commit `.databrickscfg` to version control. Add it to your `.gitignore` file.
* Use service principals for production workloads instead of personal access tokens.
* Rotate credentials regularly and update your profiles accordingly.

## <a id="troubleshooting" />Troubleshooting

If the profile can't be found, verify the following:

* The `.databrickscfg` file is in your home directory.
* You use the exact profile name.
* The file isn't named `.databrickscfg.txt` or something similar.

If authentication fails, verify the following:

* Your credentials are current and haven't expired.
* The `host` URL is correct.
* You have the required permissions for the operations that you're attempting.

Test your configuration profiles using the Databricks CLI:

```bash
# Inspect a specific profile
databricks auth env --profile DEVELOPMENT

# List all profiles
databricks auth profiles
```

For more information, see [Test your configuration profiles](https://docs.databricks.com/aws/en/dev-tools/cli/profiles.md#test).

## <a id="additional-resources" /> Additional resources

* [Databricks CLI](https://docs.databricks.com/aws/en/dev-tools/cli/index.md)
* [Unified authentication](https://docs.databricks.com/aws/en/dev-tools/auth/unified-auth.md)
* [Databricks SDKs](https://docs.databricks.com/aws/en/dev-tools/sdks.md)
