---
title: Databricks unified authentication
description: Learn about Databricks unified authentication for simplified authorization of access from tools and SDKs.
canonical_url: https://docs.databricks.com/aws/en/dev-tools/auth/unified-auth
---

# Databricks unified authentication

Databricks unified authentication provides a consistent way to configure and automate authentication as part of OAuth authorization. You define authentication once and reuse the same configuration across supported Databricks tools and SDKs. This avoids maintaining separate credentials for each tool and ensures consistent authentication behavior across environments.

When you use user-to-machine (U2M) OAuth with these tools, you can authenticate as your own user identity. You can also act as a service principal you manage with OAuth on-behalf-of (OBO), for example to run a tool with the service principal's identity without configuring a secret. See [Authenticate as a service principal using OAuth OBO](https://docs.databricks.com/aws/en/dev-tools/auth/oauth-m2m.md#oauth-obo).

## Participating tools and SDKs

Participating Databricks tools and SDKs include:

* [Databricks CLI](https://docs.databricks.com/aws/en/dev-tools/cli/index.md)
* [Databricks Terraform provider](https://docs.databricks.com/aws/en/dev-tools/terraform/index.md)
* [Databricks Connect](https://docs.databricks.com/aws/en/dev-tools/databricks-connect/index.md)
* [Databricks extension for Visual Studio Code](https://docs.databricks.com/aws/en/dev-tools/vscode-ext/index.md)
* [Databricks SDK for Python](https://docs.databricks.com/aws/en/dev-tools/sdk-python.md)
* [Databricks SDK for Java](https://docs.databricks.com/aws/en/dev-tools/sdk-java.md)
* [Databricks SDK for Go](https://docs.databricks.com/aws/en/dev-tools/sdk-go.md)

All tools and SDKs support authentication through environment variables and Databricks [configuration profiles](https://docs.databricks.com/aws/en/dev-tools/auth/config-profiles.md). The Databricks Terraform provider and the Python, Java, and Go SDKs also let you configure authentication directly in code. For details, see the tool or SDK’s [documentation](https://docs.databricks.com/aws/en/dev-tools/index.md).

## <a id="order-of-eval" />Authentication method priority

This section explains how tools and SDKs prioritize authentication methods and where they look for credentials.

### Default authentication order

Tools and SDKs attempt authentication methods in this order and stop after the first success:

1. [Personal access tokens (legacy)](https://docs.databricks.com/aws/en/dev-tools/auth/pat.md)
2. [OAuth machine-to-machine (M2M)](https://docs.databricks.com/aws/en/dev-tools/auth/oauth-m2m.md)
3. [OAuth user-to-machine (U2M)](https://docs.databricks.com/aws/en/dev-tools/auth/oauth-u2m.md)

> [!NOTE]
>
> To force an SDK to use a specific method, set the Databricks authentication type field in the `Config` API.

### Credential lookup order

For each authentication method, tools and SDKs search for credentials in this order:

1. **SDK Config fields:** Direct configuration in code (SDKs only)
2. **Environment variables:** Platform-specific variables
3. **Configuration profile:** `.databrickscfg` file `DEFAULT` profile

### Best practices

For maximum portability across environments, do the following:

1. Create a custom [configuration profile](https://docs.databricks.com/aws/en/dev-tools/auth/config-profiles.md) in your `.databrickscfg` file
2. Add required fields for your chosen authentication type
3. Set the `DATABRICKS_CONFIG_PROFILE` environment variable to your profile name

For a complete list of supported environment variables and configuration fields, see [Environment variables and fields for unified authentication](https://docs.databricks.com/aws/en/dev-tools/auth/env-vars.md).
