---
url: https://honeycombmaps.com/docs/connect-to-data/databricks.md
description: >-
  Connect Honeycomb Maps to Databricks with OAuth (U2M or M2M), OAuth token
  federation, programmatic access tokens, or workload identity federation.
---

# Connecting Honeycomb Maps to Databricks

Honeycomb Maps supports connecting to Databricks using multiple authentication methods.

> **Tip**
>
> If you install the Honeycomb Maps App from Databricks Marketplace, the connection to Databricks is pre-configured.

## [Databricks OAuth (U2M)](#connecting-to-databricks-using-oauth)

When setting up the connection or accessing a map with data, the user is redirected to a Databricks window (the 'Consent Screen'), asked to sign in if they aren't already, and then is asked to allow Honeycomb Maps to connect to Databricks.

Databricks serves as the Identity Provider (IdP) for an OAuth 2.0 Authentication Code Flow process. Honeycomb Maps acts as the client. Queries are run as the end user.

Databricks-provided documentation: https://docs.databricks.com/aws/en/dev-tools/auth/oauth-u2m

## Databricks OAuth (M2M)

This model uses the OAuth 2.0 M2M specification. Honeycomb Maps acts as the client, and exchanges a client ID and client secret for a short-lived access token. Honeycomb Maps then uses this access token to fetch data from Databricks.
Databricks-provided documentation: https://docs.databricks.com/aws/en/dev-tools/auth/oauth-m2m

## OAuth Token Federation (external identity provider)

The user is redirected to the external IdP (such as Okta) to log in. If they already have a session, this may be skipped. Honeycomb Maps then exchanges an identity token (JWT) issued by the IdP with Databricks, which provides a Databricks OAuth token. This Databricks OAuth token is then used to access resources.

In this model an external identity provider (IdP), such as Okta, serves as the Authorization Server. Databricks serves as the resource server. Queries are run as the end user.

Databricks-provided documentation: https://docs.databricks.com/aws/en/dev-tools/auth/oauth-federation

## Programmatic Access Tokens (PAT)

In this model, an admin creates a PAT, and saves it to Honeycomb. Honeycomb includes this token with requests to Databricks. *Where possible, Databricks recommends using OAuth instead of PATs for user account authentication because OAuth provides stronger security.*

Databricks-provided documentation:  https://docs.databricks.com/aws/en/dev-tools/auth/pat

## Workload identity federation

Honeycomb Maps retrieves a signed JWT from the cloud provider it is running on (AWS, GCP, Azure), attesting to its identity. Honeycomb Maps then exchanges this token with Databricks for a short-lived access token, using the OAuth 2.0 token exchange process. Queries are run using a service account.

> **Tip**
>
> Workload Identity Federation is only available when Honeycomb Maps is self-hosted. Contact hello@honeycombmaps.com for more information.

Databricks-provided documentation: https://docs.databricks.com/aws/en/dev-tools/auth/oauth-federation-policy#workload

## Connecting to Databricks using OAuth

### Set up a connection to Databricks

1. Click on 'Connections' on the left-hand menu
2. Click on 'Set up a new connection' on the top

![Honeycomb Maps Connections page with the 'Set up a new connection' button at the top](https://honeycombmaps.com/docs/images/dbx-connection-setup/honeycomb-connections-page.png)

3. Click on 'Databricks'.

4. For 'Authentication method', click on `OAUTH_U2M`. You can read more about different supported authentication methods in the Databricks documentation here: <https://databrickslabs.github.io/partner-architecture/isv-partners/lakehouse-patterns/access-auth#authentication-comparison>.

5. Now, switch to Databricks in a new tab. You will need to first set up Honeycomb Maps as an external application in Databricks, then come back and copy information into the 'Configure Connection' page in Honeycomb.

6. Go to your Databricks account console (not workspace)

7. On the left menu, click on Settings -> App connections

8. Click on 'Add connection'

![Databricks account console Settings page open to the App connections tab, showing a list of existing app connections and the 'Add connection' button](https://honeycombmaps.com/docs/images/dbx-connection-setup/databricks-app-connections-list.png)

9. Fill in the following info:

| Field | Value |
|---|---|
| Application Name | Honeycomb Maps |
| Redirect URLs | Copy this from the top of the Honeycomb Maps 'Configure Connection' screen, in the 'Redirect URI' section. |
| Scopes | Default scopes are good. `sql` and `offline_access` are the minimum required scopes. |
| Client Secret | Yes. Click the box to generate a client secret. |
| Single-Use Refresh Tokens | Yes. Click the box to enable single-use refresh tokens. |

Leave the rest of the options as-is

![Databricks 'Add connection' form with Application Name set to 'Honeycomb Maps', a Redirect URL filled in, and the list of available OAuth access scopes](https://honeycombmaps.com/docs/images/dbx-connection-setup/databricks-add-connection-form.png)

10. Click on 'Add'. A dialog will pop up that says 'Connection created', along with a Client ID and Client Secret

11. Copy the Client ID and Client Secret values into the corresponding fields in Honeycomb Maps.
    Client ID -> 'OAuth client ID'
    Client Secret -> 'OAuth client secret'

![Honeycomb Maps 'Configure Connection' page showing the OAuth client ID, OAuth client secret, OAuth authorization URL, OAuth token URL, and OAuth scopes fields](https://honeycombmaps.com/docs/images/dbx-connection-setup/honeycomb-configure-oauth-fields.png)

12. Go back to Databricks. You can close the dialog. Now go to the Databricks workspace you would like to use with Honeycomb Maps.

13. We will now give Honeycomb the information needed to connect to the right Databricks workspace. On the left-hand menu within your Databricks workspace, click on 'SQL Warehouses'.

![Databricks workspace home page, with the left-hand menu that includes the 'SQL Warehouses' option](https://honeycombmaps.com/docs/images/dbx-connection-setup/databricks-workspace-home.png)

14. Select the warehouse you want to use with Honeycomb.

15. Click on 'Connection details'

16. Copy the following information into Honeycomb Maps

| Field | Required for Databricks U2M | Details |
|---|---|---|
| Connection Name | Yes | User-facing name for the connection |
| Server hostname | Yes | Use the 'Server hostname' value from Databricks |
| HTTP Path | Yes | Use the 'HTTP Path' value from Databricks |
| OAuth authorization URL | Yes | {Databricks OAuth URL} + `/v1/authorize` |
| OAuth token URL | Yes | {Databricks OAuth URL} + `/v1/token` |

For example, `https://dbc-6c4db333-520a.cloud.databricks.com/oidc` from Databricks becomes `https://dbc-6c4db333-520a.cloud.databricks.com/oidc/v1/authorize` and `https://dbc-6c4db333-520a.cloud.databricks.com/oidc/v1/token`.

![Databricks SQL Warehouse 'Connection details' tab showing the Server hostname, Workspace ID, and HTTP path values to copy into Honeycomb Maps](https://honeycombmaps.com/docs/images/dbx-connection-setup/databricks-warehouse-connection-details.png)

17. Click on 'Save Connection'.

18. You should now see the connection details page. Notice that the Status says 'Error - You have not connected your account to this application'

![Honeycomb Maps connection details page for the Databricks connection, with the Status showing an 'Error - You have not connected your account to this application' message](https://honeycombmaps.com/docs/images/dbx-connection-setup/honeycomb-connection-status-error.png)

19. Scroll down on the connection details page, and click on 'Connect'. This will redirect you to Databricks to log into your account. Ensure you are logged into Databricks with the user account that you want to connect to Honeycomb Maps (it must be in the Databricks account used earlier).

![Bottom of the Honeycomb Maps connection details page showing the Actions section with the 'Connect' button](https://honeycombmaps.com/docs/images/dbx-connection-setup/honeycomb-connection-connect-button.png)

20. Follow the Databricks flow. Review the permissions, and select 'Authorize'.

![Databricks 'Authorize as' screen prompting you to choose the account to authorize with](https://honeycombmaps.com/docs/images/dbx-connection-setup/databricks-oauth-authorize-as.png)

![Databricks 'Permission Requested' screen listing the permissions Honeycomb Maps is requesting, with 'Cancel' and 'Authorize' buttons](https://honeycombmaps.com/docs/images/dbx-connection-setup/databricks-oauth-permission-requested.png)

21. You will be redirected back to Honeycomb Maps. If you click on the connection now, it's status should be 'Connected'. You have now connected Honeycomb Maps to your Databricks account!

![Honeycomb Maps connection details page showing the Status as 'Connected' after completing the OAuth flow](https://honeycombmaps.com/docs/images/dbx-connection-setup/honeycomb-connection-status-connected.png)

### Sharing maps with another user, or entire organization

Honeycomb Maps allows for sharing maps within an organization, or with a public sharing link.

When sharing within an organization, maps can be shared with a specific user or with the entire organization. When sharing a map, it can be shared with either 'View' permission, or with 'Edit' permission.

Connections and data sources follow the same sharing system as maps. In order to view a map that uses a data source, the map, data source, and the connection all have to be shared with the map viewer.

Connections are often shared with an entire organization. If a connection uses OAuth, each user will still access data using their own identity.

1. To configure sharing, click on the three dots on the right of a map on the homepage. Then in the drop-down menu click on 'Control sharing'. This will open a sharing dialog.

2. To share within an organization, click on the 'People' tab on the top of the sharing dialog.

3. To share with a specific person, enter their email address. Note that the user needs to have already signed into Honeycomb Maps, otherwise the application will show an error.

Maps can also be shared with 'All Users', using the button on the bottom right of the sharing dialog. This will make the map available to anyone within the organization, including users who create an account after the map has been shared.

### Fetching data from Databricks using Unity Catalog permissions

In enterprise settings, access to sensitive data is often governed by permissions defined in Unity Catalog. For example, salespeople might only be able to see prospects within their defined sales territory.

When presenting data with visualization tools, it's important that this governance model is maintained. Honeycomb Maps natively supports data governance with Unity Catalog, by accessing data with the identity of the end user.

#### Scenario: Map shared with someone without data permissions

User A creates a map in Honeycomb Maps that fetches data from Databricks (using a connection configured with U2M OAuth). User A shares the map, data source, and connection with User B from within Honeycomb Maps.

User B does not have permissions to the underlying table in Databricks.

First, User B is asked to log into Databricks. This uses a standard OAuth flow to establish the identity of User B.

Second, Honeycomb Maps attempts to load the data for the map, on behalf of User B. However, because user B does not have permissions to the underlying table, Databricks does not return any data. Honeycomb Maps shows that the data source could not be loaded.

**Result: User B cannot access any data that they could not access already.**
