Skip to content

fix(models): Azure OpenAI with an Entra ID token needs no API key - #77

Draft
cryxnet wants to merge 1 commit into
mainfrom
fix/azure-entra-token-provider
Draft

cryxnet wants to merge 1 commit into
mainfrom
fix/azure-entra-token-provider

Conversation

@cryxnet

@cryxnet cryxnet commented Oct 24, 2026

Copy link
Copy Markdown
Collaborator

The keyless Azure OpenAI setup in docs/core/agents/models.md (Entra ID: extra={"azure_ad_token_provider": token}, no api_key) raised ModelSetupError: AZURE_OPENAI_API_KEY is not set, although the error's own hint says to pass a token provider instead. With a placeholder key set, a local stand-in server showed the client sends only Authorization: Bearer <token> and no api-key header, so the key check was the only problem. Found while reviewing the Azure guide.

  • resolve_model: azure_ad_token_provider, azure_ad_token or azure_ad_async_token_provider in extra counts as the credential (api_key provided) for the setup check.
  • Docs: one sentence in the keyless tab (no key needed, bearer token only). Changelog: Unreleased entry.
  • Tests: test_azure_entra_id_needs_no_api_key (token provider and token; both fail before, pass after) and test_azure_without_key_or_token_still_names_the_key. test_models.py + test_fallback.py: 204 passed. The header probe against a local server now passes with no key set. Held for the next release.

🤖 Generated with Claude Code

The keyless setup from the docs (extra={'azure_ad_token_provider': ...})
raised 'AZURE_OPENAI_API_KEY is not set' unless a key was also set, though
the request only carries the bearer token. A token provider or token in
extra now counts as the credential.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@cryxnet cryxnet mentioned this pull request Oct 27, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant