Add Workload Identity authentication to OpenAI provider#69069
Merged
Conversation
Raise the openai[datalib] floor to >=2.37.0 so the provider builds against the current 2.x SDK line, and refresh stale default models (gpt-3.5-turbo -> gpt-4o-mini, text-embedding-ada-002 -> text-embedding-3-small).
Authenticate OpenAI connections with short-lived identity tokens instead of a long-lived API key, selected with a new auth_type key in the connection extra (defaults to api_key, so existing connections are unchanged). Supports Kubernetes, Azure managed identity, GCP, and a custom token provider.
This was referenced Jun 27, 2026
vikramkoka
approved these changes
Jun 27, 2026
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.
Add Workload Identity authentication to the OpenAI provider, so connections can authenticate with short-lived identity tokens instead of a long-lived API key. The mechanism is selected with a new
auth_typekey in the connectionextra; it defaults toapi_key, so existing connections are unchanged.Why first-class wiring instead of the existing passthrough
The connection already forwards
openai_client_kwargsto the OpenAI client, but Workload Identity needs a token-provider callable, which can't be expressed in a JSON connectionextra. Soget_connbuilds the provider from declarative config keys instead.Usage
Set
auth_typetoworkload_identityand choose a token source withworkload_identity_provider:kubernetes-- service account token fromtoken_file_path(defaults to the in-cluster path)azure-- Azure managed identity (optionalresource,client_id,object_id,msi_res_id,api_version)gcp-- GCP ID token foraudiencecustom-- importtoken_provider(a dotted path to aCallable[[], str]);token_typeisjwt(default) orididentity_provider_idandservice_account_idare required;refresh_buffer_secondsis optional.Example (Kubernetes pod):
{ "auth_type": "workload_identity", "workload_identity_provider": "kubernetes", "identity_provider_id": "idp-123", "service_account_id": "sa-456" }Notes
api_keyis popped fromopenai_client_kwargsfor every path so it is never forwarded alongsideworkload_identity(the client rejects both being set).customsource imports and calls the named callable in the process running the hook, so point it only at trusted code. Connectionextrais an operator/admin surface, consistent with how other providers resolve callables from config.workload_identity_providerto mirror OpenAI's own "workload identity provider" terminology.Related:
Was generative AI tooling used to co-author this PR?
{pr_number}.significant.rst, in airflow-core/newsfragments. You can add this file in a follow-up commit after the PR is created so you know the PR number.