# Databricks Databricks Authentication

Source: https://userguide.qualytics.io/source-datastore/datastore/jdbc/databricks/authentication/

Qualytics queries run on your Databricks workspace, on the SQL warehouse or cluster named in the connection. Every query carries an identity, and Databricks uses that identity's grants to decide what Qualytics may read or write (see [Permissions](https://userguide.qualytics.io/source-datastore/datastore/jdbc/databricks/permissions/)).

The **Authentication** section of the connection form is where you choose that identity. Its **Type** field has two options, and **Personal Access Token** is the default.

## Personal Access Token

With **Personal Access Token** authentication, you generate a token in your Databricks workspace and paste it into the **Personal Access Token** field. Qualytics runs every query as the user who owns the token, so that user needs the grants listed in [Permissions](https://userguide.qualytics.io/source-datastore/datastore/jdbc/databricks/permissions/). To create one, see [Generate a Personal Access Token](https://userguide.qualytics.io/source-datastore/datastore/jdbc/databricks/how-tos/setup/generate-access-token/).

This is the simplest setup. It works well when:

- You are testing Databricks or connecting a development workspace.
- A dedicated service user owns the token.

The trade-off is that the token belongs to a person and has an expiration date. When the token expires, is revoked, or its owner is deactivated, the connection stops working until you paste a new token into it.

> **Note**
>
> Databricks tokens are workspace-scoped. A token generated in workspace A cannot connect to workspace B.

## OAuth M2M

With **OAuth M2M** (machine-to-machine) authentication, Qualytics signs in as a Databricks **service principal** instead of a user. Set **Type** to **OAuth M2M**, then fill in:

| Field | Description |
| --- | --- |
| **Service Principal Application ID** | The application ID of the service principal. |
| **Service Principal OAuth Secret** | The OAuth secret generated for that service principal. |

This is the recommended option for production. It suits unattended access, since it is not tied to an individual user account that may be deactivated. Grant the [Permissions](https://userguide.qualytics.io/source-datastore/datastore/jdbc/databricks/permissions/) to the service principal itself.

> **Warning**
>
> OAuth secrets also expire. When the service principal's secret expires, the connection fails with an authentication error until you generate a new secret and update the connection.

## API values

In the API, **Type** is sent as `parameters.authentication_type`: `PAT` for Personal Access Token (the default) and `OAUTH_M2M` for OAuth M2M. See [Create via API](https://userguide.qualytics.io/source-datastore/datastore/jdbc/databricks/how-tos/datastore/api/) for full payloads.

> **Tip: Credentials from a secrets manager**
>
> Any credential field can take its value from HashiCorp Vault or another secrets manager instead of being typed in: turn on **Secrets Management** on the connection and write `${key}` in the field. See the [HashiCorp Vault](https://userguide.qualytics.io/source-datastore/datastore/deep-dive/hashicorp-vault/) pages for setup and troubleshooting.

*Last updated: November 16, 2026.*
