Skip to content

AAD Auth: Adds an options to override AAD audience scope through environment variable. - #42228

Merged
Arooshi Avasthy (aavasthy) merged 1 commit into
Azure:mainfrom
aavasthy:update-aad-scope
Jul 28, 2025
Merged

AAD Auth: Adds an options to override AAD audience scope through environment variable.#42228
Arooshi Avasthy (aavasthy) merged 1 commit into
Azure:mainfrom
aavasthy:update-aad-scope

Conversation

@aavasthy

Copy link
Copy Markdown
Contributor

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

  • Title of the pull request is clear and informative.

Testing Guidelines

  • [ X] Pull request includes test coverage for the included changes.

Copilot AI review requested due to automatic review settings July 25, 2025 19:32
@aavasthy
Arooshi Avasthy (aavasthy) requested a review from a team as a code owner July 25, 2025 19:32

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Comment thread sdk/cosmos/azure-cosmos/azure/cosmos/_cosmos_client_connection.py
Comment thread sdk/cosmos/azure-cosmos/tests/test_aad.py
Comment thread sdk/cosmos/azure-cosmos/tests/test_aad_async.py

@tvaron3 Tomas Varon (tvaron3) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM thanks

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

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

5 participants