Fix AAD authentication in ACA environments for RedTeam#44938
Merged
slister1001 merged 1 commit intoAzure:mainfrom Feb 4, 2026
Merged
Fix AAD authentication in ACA environments for RedTeam#44938slister1001 merged 1 commit intoAzure:mainfrom
slister1001 merged 1 commit intoAzure:mainfrom
Conversation
60565c6 to
ec98609
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
Summary:
This PR fixes AAD authentication failures in Azure Container Apps (ACA) environments for RedTeam operations. The fix allows passing an explicit credential from the RedTeam instance to get_chat_target(), avoiding reliance on DefaultAzureCredential which fails when Azure CLI is not available in containerized environments.
Changes:
- Added optional
credentialparameter toget_chat_target()function for explicit credential passing - Modified RedTeam.scan() to pass
self.credentialtoget_chat_target()for use in ACA environments - Added comprehensive test coverage for credential-based authentication with different priority scenarios
- Updated AzureOpenAIModelConfiguration TypedDict to include credential field
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| azure/ai/evaluation/red_team/_utils/strategy_utils.py | Added credential parameter to get_chat_target() function with proper authentication priority handling (api_key > credential > DefaultAzureCredential). Includes code formatting improvements. |
| azure/ai/evaluation/red_team/_red_team.py | Modified scan() method to pass self.credential to get_chat_target(). Includes extensive code formatting improvements throughout the file. |
| tests/unittests/test_redteam/test_strategy_utils.py | Added three new test cases covering credential parameter usage, precedence testing, and various authentication scenarios. Includes code formatting improvements. |
sdk/evaluation/azure-ai-evaluation/tests/unittests/test_redteam/test_strategy_utils.py
Show resolved
Hide resolved
sdk/evaluation/azure-ai-evaluation/azure/ai/evaluation/red_team/_utils/strategy_utils.py
Outdated
Show resolved
Hide resolved
ec98609 to
ae92eb7
Compare
posaninagendra
approved these changes
Jan 30, 2026
When running red team scans in ACA environments, DefaultAzureCredential fails because Azure CLI is not available. This fix allows passing an explicit credential from the RedTeam instance to get_chat_target(). Changes: - Add credential parameter to get_chat_target() function - Add _create_token_provider() helper to create callable from credential - Pass self.credential from RedTeam.scan() to get_chat_target() - Add credential field to AzureOpenAIModelConfiguration TypedDict - Add tests for credential-based authentication paths Auth priority: api_key > credential > use_aad_auth (DefaultAzureCredential)
ae92eb7 to
99ee749
Compare
BryceByDesign
approved these changes
Feb 2, 2026
minthigpen
approved these changes
Feb 4, 2026
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.
When running red team scans in ACA environments, DefaultAzureCredential fails because Azure CLI is not available. This fix allows passing an explicit credential from the RedTeam instance to get_chat_target().
Changes:
Auth priority: api_key > credential > use_aad_auth (DefaultAzureCredential)
Description
Please add an informative description that covers that changes made by the pull request and link all relevant issues.
If an SDK is being regenerated based on a new API spec, a link to the pull request containing these API spec changes should be included above.
All SDK Contribution checklist:
General Guidelines and Best Practices
Testing Guidelines