🤖 feat: add Azure Entra ID keyless auth for OpenAI provider#2428
🤖 feat: add Azure Entra ID keyless auth for OpenAI provider#2428ibetitsmike wants to merge 9 commits intomainfrom
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d2e0c3b7e2
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
d2e0c3b to
9dd37e2
Compare
|
@codex review Addressed the two open review threads with PR-linked fixes only:
Also added targeted tests in |
|
Codex Review: Didn't find any major issues. More of your lovely PRs please. ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback". |
3683738 to
7f1528c
Compare
e25182b to
ec64294
Compare
Summary
Adds Azure Entra ID (Microsoft identity) keyless authentication as a new auth path for the OpenAI provider. Enterprise Azure deployments can now use
DefaultAzureCredential(viaaz login, managed identity, or workload identity) instead of distributing API keys.Background
Enterprise customers deploying Azure OpenAI often rely on Azure Entra ID for authentication rather than API keys. This enables tighter security controls (no long-lived secrets), compliance with corporate identity policies, and seamless integration with Azure managed identity on cloud workloads.
The implementation reuses the existing
openaiprovider namespace — no new provider or model migration needed. Auth priority is preserved: API key → Codex OAuth → Entra keyless → error.Implementation
Core auth flow (
providerModelFactory.ts):@azure/identity(DefaultAzureCredential+getBearerTokenProvider)Authorization: Bearer <token>and removex-api-keyheaderAbortSignalinto token acquisitionCredential resolver (
providerRequirements.ts):authMode=entra+baseUrlpresent, no API key requiredproviders.jsonc) and env vars (OPENAI_AUTH_MODE=entra+OPENAI_BASE_URL)Schema + service (
api.ts,providerService.ts):openaiAuthMode: "apiKey" | "entra"field toProviderConfigInfoSchemaUI (
ProvidersSection.tsx):updateOptimisticallypersistence patternDocs (
providers.mdx,gen_docs.ts):OPENAI_AUTH_MODEin env var tablePR-linked CI follow-ups after rebase:
flake.nixoffline cache hash to match lockfile changes introduced by this PRtests/e2e/scenarios/settings.spec.tsby targeting the API key label (avoids matching the new auth-mode option text).github/workflows/pr.yml) so Storybook tests installchromium-headless-shellalongsidechromium(matches Playwright runtime expectation)Validation
make static-check— passes locallybun test src/node/utils/providerRequirements.test.ts src/node/services/providerService.test.ts src/node/services/providerModelFactory.test.tsxvfb-run -a env MUX_E2E_LOAD_DIST=1 MUX_E2E_SKIP_BUILD=1 PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 bun x playwright test --project=electron tests/e2e/scenarios/settings.spec.ts -g "provider settings updates propagate without reload"make storybook-build && make test-storybook(with local static server, matching CI flow)Risks
@azure/identityis lazily loaded only whenauthMode=entra— no impact on non-Azure users (no startup cost, no bundle bloat for users who don't use it)DefaultAzureCredentialsurface when credentials are missing.chromium-headless-shell), increasing setup time slightly while improving determinism.Generated with
mux• Model:openai:gpt-5.3-codex• Thinking:xhigh• Cost:$4.76