Skip to main content
Version: Preview

Connect Databricks

Catalog Unity Catalog on Databricks with a pipeline that signs in with Marmot's identity, so there's no personal access token or client secret to create, store or rotate. Databricks fetches your instance's public keys from your instance, and your instance connects to your workspace with a short-lived token it swaps for a Databricks one.

Before you start​

  • You hold ingestion.admin across the whole catalog in your instance.
  • You're a Databricks account admin, or can ask one to create a federation policy.
  • You have a service principal for the pipeline, or can create one. This page calls it marmot-lakehouse.
  • Your workspace accepts connections from your instance.

How it works​

Before each run and connection test, your instance gives the pipeline a 5-minute token with the pipeline as its subject and the workspace's address as the audience. The pipeline swaps it once at the workspace's /oidc/v1/token endpoint for a Databricks token of the service principal, which a federation policy allows only for this pipeline, and catalogs with that. Workload identity explains the model.

Values you'll need​

Replace <instance> and <workspace-host> with your own:

  • Issuer: https://<instance>.marmotdata.cloud. Always the marmotdata.cloud address, even with a custom domain
  • Audience: https://<workspace-host>, the workspace URL with no path
  • Subject: pipeline:lakehouse, the name you give the pipeline
  • Service principal: its numeric ID, for the policy, and its application ID, for the pipeline

The add source form shows the issuer, audience and subject, and the policy command with them filled in, as soon as you choose Marmot's identity and enter the workspace URL.

  1. Let the service principal trust the pipeline

    Create a federation policy on the service principal with the Databricks CLI, as an account admin:

    databricks account service-principal-federation-policy create <service-principal-id> --json '{
    "oidc_policy": {
    "issuer": "https://<instance>.marmotdata.cloud",
    "audiences": ["https://<workspace-host>"],
    "subject": "pipeline:lakehouse"
    }
    }'

    Name the audience explicitly: without it, the policy expects your Databricks account ID instead. Databricks fetches the keys from the issuer.

  2. Grant the service principal read access

    Add the service principal to the workspace and grant it USE CATALOG, USE SCHEMA and BROWSE on the catalogs to catalog. Grant SELECT instead of BROWSE where Marmot should also read table statistics.

  3. Add the pipeline

    1. Open Plugins and select Unity Catalog under Add a source.
    2. Choose Marmot's identity and enter the workspace URL as Host.
    3. Enter the service principal's application ID as Service principal.
    4. Name the pipeline lakehouse, select Test connection, then Create pipeline.

Check that it worked​

Open the pipeline under Plugins and select Run now. The run succeeds and your catalogs appear in Discover.

Troubleshooting​

What you seeWhat to do
the token endpoint ... refused Marmot's identityNo federation policy matched. Check the issuer, audience and subject in the policy match the values the add source form shows, character for character
signing in with Marmot's identity needs no token; remove itClear Token: the pipeline signs in with Marmot's identity instead
403 listing catalogsThe service principal signed in but can't see the catalogs. Grant it USE CATALOG

Things to know​

  • A service principal takes up to 20 federation policies, so 1 service principal serves up to 20 pipelines.
  • Renaming the pipeline changes its subject. Update the policy, or keep the name.

Next steps​