fix(azure_sentinel): add AZURE_SENTINEL_AUTHORITY_HOST as a Sentinel scoped override - #36165
Conversation
…scoped override Making Sentinel follow AZURE_AUTHORITY_HOST is a breaking change for a deployment that sets that variable for Azure OpenAI or the azure_storage callback while keeping a commercial Sentinel workspace. That deployment had no opt-out, because the proxy constructs the logger with no arguments and the authority_host parameter is reachable only from the SDK. Resolve the authority from AZURE_SENTINEL_AUTHORITY_HOST before falling back to AZURE_AUTHORITY_HOST, matching how tenant id, client id and client secret already resolve in this constructor.
Greptile SummaryThe PR adds a Sentinel-scoped Azure authority override while preserving explicit-argument precedence and fallback to the shared Azure authority
Confidence Score: 5/5The PR appears safe to merge, with the scoped override correctly propagated to the existing token-request path The new environment variable has the intended precedence, preserves existing defaults and explicit arguments, and feeds the same authority and audience attributes already used by OAuth requests
|
| Filename | Overview |
|---|---|
| litellm/integrations/azure_sentinel/azure_sentinel.py | Adds the scoped authority environment variable to the existing resolution chain without changing downstream token or ingestion behavior |
| tests/test_litellm/integrations/test_azure_sentinel.py | Adds meaningful precedence and fallback regression coverage while correctly isolating both authority environment variables |
Reviews (1): Last reviewed commit: "fix(azure_sentinel): add AZURE_SENTINEL_..." | Re-trigger Greptile
|
bugbot run |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 66c00a8. Configure here.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
bd289c1
into
litellm_internal_staging
TLDR
Problem this solves:
AZURE_AUTHORITY_HOST, which is shared with Azure OpenAI and theazure_storagecallback. That is a breaking change for a deployment that sets the shared variable for one of those while keeping a commercial Sentinel workspaceAzureSentinelLogger()with no arguments atlitellm/litellm_core_utils/litellm_logging.py:3692, so theauthority_hostconstructor parameter is reachable only from the SDKHow it solves it:
AZURE_SENTINEL_AUTHORITY_HOSTbeforeAZURE_AUTHORITY_HOST, matching howtenant_id,client_idandclient_secretalready resolve three lines above in the same constructorAZURE_SENTINEL_AUTHORITY_HOST=https://login.microsoftonline.comto keep Sentinel on the commercial cloud while the rest of your Azure resources use a sovereign authorityRelevant issues
Follow-up to #36137
Linear ticket
Merge order
BerriAI/litellm-docs#813 must merge first.
tests/documentation_tests/test_env_keys.pychecks out litellm-docs at its default branch and fails any env var read underlitellm/that is not documented there, sodocumentationandcode-qualitystay red until it lands.Pre-Submission checklist
documentationandcode-qualityare red until docs(azure_sentinel): document AZURE_SENTINEL_AUTHORITY_HOST litellm-docs#813 merges, for the reason aboveScreenshots / Proof of Fix
Real proxy, real Postgres, real Gemini call driving the callback, real Microsoft Entra, and the same real Azure Monitor Data Collection Endpoint used to verify #36137. Tenant id redacted.
AZURE_AUTHORITY_HOSTAZURE_SENTINEL_AUTHORITY_HOSTlogin.microsoftonline.us, 400login.microsoftonline.us, 400Leg 1 against leg 2 is the fix: the breaking change from #36137 becomes remediable, confirmed by a real 204 from Azure Monitor. Leg 3 is the guard: with no override, the behavior shipped in #36137 is untouched.
Type
🐛 Bug Fix
Changes
litellm/integrations/azure_sentinel/azure_sentinel.pyreads one additional environment variable in the authority resolution chain. No other file changes.On the Azure Government authority alias
azure-identitygroupslogin.usgovcloudapi.netwithAZURE_GOVERNMENTin its token-cache alias set, so mapping it looked worthwhile. It was implemented and then removed. That host resolves to genuine Azure Government identity infrastructure and answers as Entra withAADSTS90038when certificate validation is disabled, but it presents no TLS certificate covering its own name, so a normal client cannot connect at all. Mapping it would advertise a configuration that cannot work, behind a unit test that would pass regardless.QA runbook
AZURE_AUTHORITY_HOSTunset, confirm Sentinel logging still reaches a commercial workspace exactly as beforeAZURE_AUTHORITY_HOSTto the Azure Government authority and confirm the token request moves tologin.microsoftonline.usAZURE_SENTINEL_AUTHORITY_HOST=https://login.microsoftonline.comand confirm Sentinel returns to the commercial authority while the shared variable stays sovereignFinal Attestation
Note
Low Risk
Narrow logging-integration config change with backward-compatible fallback order and targeted unit tests; no auth or data-path changes outside Sentinel OAuth token acquisition.
Overview
Adds
AZURE_SENTINEL_AUTHORITY_HOSTto the Entra authority resolution chain inAzureSentinelLogger, checked after theauthority_hostconstructor argument and before the sharedAZURE_AUTHORITY_HOST. Deployments can point Sentinel at a different cloud (e.g. commercial Sentinel while other Azure integrations use a sovereign authority) without changing behavior when the new variable is unset.Tests cover precedence: Sentinel-scoped env beats shared env, shared env still applies when the Sentinel var is missing, and an explicit constructor
authority_hostbeats the scoped env. The authority-host test fixture now clearsAZURE_SENTINEL_AUTHORITY_HOSTso cases stay isolated.Reviewed by Cursor Bugbot for commit 66c00a8. Bugbot is set up for automated code reviews on this repo. Configure here.