🌐 External App Authentication

External App Authentication

How applications running OUTSIDE Databricks authenticate to call Databricks APIs. Bring your own Identity Provider - no Databricks secrets required.

OAuth Token Federation
↓ Scroll to explore token federation
The Challenge

External Apps Need Access

Your application runs outside Databricks - maybe a web app, CI/CD pipeline, or automation tool.

It needs to call Databricks APIs: query data, invoke models, access Genie, etc.

Traditional approach: Create a PAT or OAuth secret, embed it in your app, manage rotation...

Problem: Secret sprawl, rotation overhead, security risk if leaked.
The Solution

OAuth Token Federation

Bring Your Own IdP - use tokens from your existing identity provider to access Databricks APIs.

  • No Databricks secrets to manage or rotate
  • Use your existing IdP (Okta, Entra, GitHub, etc.)
  • Short-lived tokens with automatic refresh
  • Centralized identity management
Your IdP mints JWT tokens β†’ Exchange for Databricks OAuth tokens β†’ Call APIs
Federation Types

Two Federation Options

Databricks supports two types of token federation:

Account-wide Federation: All users in your Databricks account can authenticate using tokens from your corporate IdP.

Workload Identity Federation: Automated workloads (CI/CD, external apps) authenticate as a service principal using tokens from the runtime environment.

Account-wide

Account-wide Token Federation

For users authenticating from external applications.

Configure a federation policy at the account level that specifies:

  • Issuer URL - Your IdP's OIDC endpoint
  • Audiences - Expected aud claim
  • Subject claim - Maps to Databricks username
All users synced via SCIM can then use their IdP tokens to access Databricks.
Workload Identity

Workload Identity Federation

For automated workloads - CI/CD pipelines, external services.

Create a federation policy on a service principal that specifies:

  • Issuer - The workload runtime (e.g., GitHub Actions)
  • Subject - The specific workload identity
  • Audiences - Expected recipients
Your CI/CD pipeline gets a token from its runtime β†’ exchanges for Databricks token β†’ no secrets needed!
Supported IdPs

Bring Your Own IdP

Any OIDC-compliant identity provider works:

  • Corporate IdPs: Okta, Microsoft Entra, Ping, Auth0
  • CI/CD Platforms: GitHub Actions, Azure DevOps, GitLab CI, CircleCI
  • Cloud Platforms: AWS IAM, GCP Workload Identity, Kubernetes

If it can issue JWTs with iss, aud, and sub claims, it can federate with Databricks.

Token Exchange

The Exchange Flow

Step 1: Your app authenticates with your IdP and receives a JWT.

Step 2: Exchange the JWT at Databricks token endpoint:

POST /oidc/v1/token with:

  • grant_type=urn:ietf:params:oauth:grant-type:token-exchange
  • subject_token=<your-jwt>
  • subject_token_type=urn:ietf:params:oauth:token-type:jwt
Token Exchange

Get Databricks Token

Step 3: Databricks validates your JWT against the federation policy and returns a Databricks OAuth token.

Step 4: Use the Databricks token to call APIs:

Authorization: Bearer <databricks-oauth-token>

Security: Handle tokens server-side only. Never expose IdP or Databricks tokens to the browser β€” API calls should originate from your backend. Tokens are short-lived; re-exchange when needed.
Example

GitHub Actions Example

Configure a service principal federation policy:

  • Issuer: https://token.actions.githubusercontent.com
  • Audience: https://github.com/my-org
  • Subject: repo:my-org/my-repo:environment:prod

In your workflow, GitHub automatically provides a JWT via ACTIONS_ID_TOKEN_REQUEST_TOKEN.

Zero secrets in your repo. GitHub mints the token, Databricks validates it.
Azure Special Case

Native OAuth with Entra

For Azure Databricks, you can use Entra tokens directly - no exchange needed.

  • U2M: Authorization Code flow with PKCE via MSAL
  • M2M: Client Credentials flow

Request tokens with scope:

  • 2ff814a6-3304-4ab8-85cb-cd0e6f879c1d/user_impersonation (U2M)
  • 2ff814a6-3304-4ab8-85cb-cd0e6f879c1d/.default (M2M)
Configuration

Setting Up Federation

Account-wide: Account Console β†’ Settings β†’ Authentication β†’ Federation Policies

Workload Identity: Account Console β†’ User Management β†’ Service Principals β†’ Federation Policies

Or use the CLI:

databricks account federation-policy create

databricks account service-principal-federation-policy create

Summary

Key Takeaways

No secrets to manage β€” your IdP handles identity, Databricks validates it.

Account-wide for users, Workload Identity for automation.

Token exchange β€” IdP JWT β†’ Databricks OAuth token (RFC 8693).

Azure special case β€” Native Entra tokens work directly (no exchange).

Server-side only β€” tokens must be handled on your backend, never in the browser.

OAuth token federation is the recommended approach for external applications accessing Databricks.
🌐
External App
Your application
πŸ”
Your IdP
Okta, Entra, GitHub...
🎫
JWT Token
From your IdP
πŸ”„
Token Exchange
/oidc/v1/token
βœ…
Databricks OAuth
Short-lived token
⚑
Databricks APIs
Genie, Model Serving, SQL, MCP...
β†’
β†’
β†’
↓
↓
1
2
3
4
Authenticate
Issue JWT
Exchange
Call APIs
πŸ“‹
Federation Policy
Validates JWT claims
πŸ”΅
Okta
πŸ”·
Entra
🟣
Auth0
πŸ™
GitHub
🦊
GitLab
πŸ”Ά
Azure DevOps
☁️
AWS IAM
🌐
GCP
☸️
Kubernetes

Quick Reference

Account-wide Federation

For: Users authenticating from external apps

  • Configure at account level
  • Maps IdP users to Databricks users
  • Works with SCIM sync
  • Corporate IdPs (Okta, Entra)

Workload Identity Federation

For: Automated workloads, CI/CD

  • Configure on service principal
  • Maps workload to SP
  • No secrets in code
  • GitHub, GitLab, Azure DevOps

Token Exchange Flow

Steps:

  • 1. Get JWT from your IdP
  • 2. POST to /oidc/v1/token
  • 3. Receive Databricks OAuth token
  • 4. Call Databricks APIs

Azure Native OAuth

Special case: No exchange needed

  • Entra tokens work directly
  • U2M: Auth Code + PKCE
  • M2M: Client Credentials
  • Use MSAL library