> ## Documentation Index
> Fetch the complete documentation index at: https://astronomer.io/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Create a Databricks connection in Airflow

[Databricks](https://databricks.com/) is a popular unified data and analytics platform built around [Apache Spark](https://spark.apache.org/) that provides users with fully managed Apache Spark clusters and interactive workspaces.

This guide provides the basic setup for creating a Databricks connection. For a complete integration tutorial, see [Orchestrate Databricks jobs with Airflow](/docs/learn/airflow-databricks).

## Prerequisites

* An Airflow environment with the [Airflow Databricks provider](https://airflow.apache.org/docs/apache-airflow-providers-databricks/stable/index.html) (`apache-airflow-providers-databricks`) installed.
* A [Databricks account](https://www.databricks.com/try-databricks?itm_data=NavBar-TryDatabricks-Trial#account).

<Note>
  Astro users can also create connections using the [Astro Environment Manager](/docs/astro/manage-connections-variables#astro-environment-manager), which stores connections in an Astro-managed secrets backend. These connections can be shared across multiple deployed and local Airflow environments. See [Create Airflow connections in the Astro UI](/docs/astro/create-and-link-connections).
</Note>

## Connect with an OAuth connection

An OAuth connection from Airflow to Databricks requires the following information:

* **Host**: Databricks URL
* **Service Principal Client ID** / **Login**: Service Principal Client ID
* **Service Principal Client Secret** / **Password**: Service Principal Client Secret

Complete the following steps to retrieve these values:

1. In the Databricks Cloud UI, copy the URL of your Databricks workspace. It should be formatted as either `https://dbc-75fc7ab7-96a6.cloud.databricks.com/` or `https://your-org.cloud.databricks.com/`.
2. Create a service principal in Databricks and copy the Client ID and Client Secret, see [Authorize service principal access to Databricks with OAuth](https://docs.databricks.com/aws/en/dev-tools/auth/oauth-m2m).

## Connect with a personal access token

A Personal Access Token (PAT) connection from Airflow to Databricks requires the following information:

* **Host**: Databricks URL
* **Personal Access Token** / **Password**: Personal access token

Complete the following steps to retrieve these values:

1. In the Databricks Cloud UI, copy the URL of your Databricks workspace. It should be formatted as either `https://dbc-75fc7ab7-96a6.cloud.databricks.com/` or `https://your-org.cloud.databricks.com/`.
2. To use a personal access token for a user, follow the [Databricks documentation](https://docs.databricks.com/dev-tools/auth.html#databricks-personal-access-tokens-for-users) to generate a new token. To generate a personal access token for a service principal, see [Manage personal access tokens for a service principal](https://docs.databricks.com/administration-guide/users-groups/service-principals.html#manage-personal-access-tokens-for-a-service-principal). Copy the personal access token.

## See also

* [Apache Airflow Databricks provider package documentation](https://airflow.apache.org/docs/apache-airflow-providers-databricks/stable/index.html)
* [Databricks modules](https://airflow.apache.org/registry/providers/databricks/) in the Airflow Registry
