AAD Auth: Adds an options to override AAD audience scope through environment variable.#42228
Merged
aavasthy merged 1 commit intoAzure:mainfrom Jul 28, 2025
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR adds AAD audience scope override functionality to the Azure Cosmos DB SDK, allowing clients to override the default AAD scope using the AZURE_COSMOS_AAD_SCOPE_OVERRIDE environment variable. This enables access to applications with different scope requirements.
Key changes:
- Added environment variable constant for AAD scope override
- Modified both sync and async connection classes to check for scope override
- Added comprehensive test coverage for the new functionality
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
_constants.py |
Added new constant for the AAD scope override environment variable |
_cosmos_client_connection.py |
Implemented scope override logic in sync connection class |
_cosmos_client_connection_async.py |
Implemented scope override logic in async connection class |
test_aad.py |
Added test case for scope override functionality in sync tests |
test_aad_async.py |
Added test case for scope override functionality in async tests |
sdk/cosmos/azure-cosmos/azure/cosmos/aio/_cosmos_client_connection_async.py
Show resolved
Hide resolved
kirankumarkolli
approved these changes
Jul 25, 2025
simorenoh
approved these changes
Jul 25, 2025
1 task
6 tasks
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
Please add an informative description that covers that changes made by the pull request and link all relevant issues.
Add AAD audience scope override functionality when this environment variable is set AADScopeOverride = "AZURE_COSMOS_AAD_SCOPE_OVERRIDE". If no environment variable is et then it uses the existing default scope value.
This will help clients in accessing applications which have a different scope.
All SDK Contribution checklist:
General Guidelines and Best Practices
Testing Guidelines