feat: support env-oidc and file-oidc auth types for workload identity federation - #1666
Open
Gerrit-K wants to merge 3 commits into
Open
feat: support env-oidc and file-oidc auth types for workload identity federation#1666Gerrit-K wants to merge 3 commits into
Gerrit-K wants to merge 3 commits into
Conversation
… federation Add explicit auth_type dispatch for env-oidc/file-oidc so profiles can authenticate via workload identity federation instead of pre-minting a PAT. Also reject both auth types up front in the kernel connection path, since the SEA kernel backend has no OIDC flow and the existing fallback check would otherwise trigger a real SDK auth attempt before raising its error.
Without an explicit client_id the credential manager fell back to the `dbt-databricks` public client, which carries no federation policy, so `dbt parse` passed and the first connection failed with an opaque 401. Reject that combination in `validate_creds` instead. Add an `oidc_token_filepath` profile config so the `file-oidc` token path can come from `profiles.yml` rather than only `DATABRICKS_OIDC_TOKEN_FILE`. Fold the kernel's OIDC rejection into the existing OAuth M2M guard, which keeps the short-circuit that stops `.config` from triggering a token exchange during argument preparation.
Gerrit-K
requested review from
jprakash-db,
saishreeeee and
sd-db
as code owners
September 7, 2026 14:27
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Adds
auth_type: env-oidcandauth_type: file-oidc, so the adapter can authenticate through Databricks workload identity federation instead of a stored secret. Both are existing credential strategies indatabricks-sdk; the adapter previously accepted onlyoauthwhen notokenwas set, so a federated identity could not be configured at all.file-oidcneeds the path of the file holding the OIDC ID token. A newoidc_token_filepathprofile config supplies it, and it is forwarded to the SDK only when set, soDATABRICKS_OIDC_TOKEN_FILEkeeps working when the profile omits it.client_idis required for both new auth types. Without it the credential manager would hand the SDK itsdbt-databrickspublic client, which carries no federation policy, sodbt parsewould pass and the first connection would fail with an opaque 401.validate_credsnow rejects that combination up front.Example profile:
The
use_kernel=Trueconnector backend has no OIDC flow, so the two new auth types are rejected there with the existing kernel error. That check reads the rawauth_typeand short-circuits beforecreds_manager.configresolves, so preparing connection arguments never triggers a token exchange.Both strategies exist in
databricks-sdk0.68.0, the current lower bound, so no dependency change is needed.Verification
Run in a CI pipeline against a live Unity Catalog workspace with a real GitLab-to-Databricks federation policy, using this branch in place of the released adapter:
dbt debugwithauth_type: env-oidcand the ID token inDATABRICKS_OIDC_TOKEN:Connection test: OK connection ok.dbt debugwithauth_type: file-oidcandoidc_token_filepathpointing at the token file:Connection test: OK connection ok.dbt compileover a ~1000 model project on the sameenv-oidctarget, which runs introspective queries, completed without an auth error.Environment:
databricks-sdk0.77.0,databricks-sql-connector4.1.5, dbt 1.11.6. Before this branch, the same pipeline had to pre-mint a PAT with the SDK and pass it to dbt through thetoken:field, because dbt could not consume the federated identity directly.Scope note
The accepted set is
("oauth", "env-oidc", "file-oidc"). Other SDK strategies such asgithub-oidcandazure-devops-oidcare still rejected, andtoken_audienceis not exposed as a profile config. Happy to widen either in this PR if you prefer.Checklist
CHANGELOG.mdand added information about my change to the "dbt-databricks next" section.dbt-databricks-pr-readyproject skill for this PR and addressed its merge-readiness feedback