honor AZURE_CLIENT_ID in mi#1038
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR adds support for User-Assigned Managed Identity authentication by introducing the AZURE_CLIENT_ID environment variable. It also refines the credential fallback behavior to prevent interactive browser prompts in production environments when explicit credentials are specified.
Key changes:
- Added
AZURE_CLIENT_IDsupport for configuring User-Assigned Managed Identity (defaults to System-Assigned if not set) - Modified credential chain logic to exclude
InteractiveBrowserCredentialfallback whenAZURE_TOKEN_CREDENTIALSis explicitly set to "prod" or a specific credential type - Updated documentation to clarify the new behavior and provide examples for both System-Assigned and User-Assigned Managed Identity scenarios
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| core/Azure.Mcp.Core/src/Services/Azure/Authentication/CustomChainedCredential.cs | Added AZURE_CLIENT_ID support in AddManagedIdentityCredential and conditional logic to exclude InteractiveBrowserCredential when explicit credentials are specified |
| core/Azure.Mcp.Core/tests/Azure.Mcp.Core.UnitTests/Services/Azure/Authentication/CustomChainedCredentialTests.cs | Added comprehensive unit tests covering User-Assigned Managed Identity scenarios, client ID handling, and credential chain behavior |
| servers/Azure.Mcp.Server/TROUBLESHOOTING.md | Updated documentation with detailed examples for User-Assigned Managed Identity configuration and clarified interactive browser fallback behavior |
| docs/Authentication.md | Added User-Assigned Managed Identity section with configuration examples |
| servers/Azure.Mcp.Server/CHANGELOG.md | Added feature entry for User-Assigned Managed Identity support |
Comments suppressed due to low confidence (1)
core/Azure.Mcp.Core/src/Services/Azure/Authentication/CustomChainedCredential.cs:207
- The switch statement at lines 154-208 handles various credential types but lacks a case for 'interactivebrowsercredential'. The documentation in TROUBLESHOOTING.md (line 431) shows 'AZURE_TOKEN_CREDENTIALS=InteractiveBrowserCredential' as a valid option, but there's no corresponding case to handle it. Add a case for 'interactivebrowsercredential' that creates only the InteractiveBrowserCredential without adding it to the chain (since it's handled separately in CreateCredential).
default:
// Unknown value, fall back to default chain
AddDefaultCredentialChain(credentials, tenantId);
break;
g2vinay
reviewed
Nov 4, 2025
g2vinay
approved these changes
Nov 4, 2025
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.
What does this PR do?
[Provide a clear, concise description of the changes]Port fix #1033 honor AZURE_CLIENT_ID in mi into 1.0.1
[Any additional context, screenshots, or information that helps reviewers]GitHub issue number?
[Link to the GitHub issue this PR addresses]Pre-merge Checklist
servers/Azure.Mcp.Server/CHANGELOG.mdand/orservers/Fabric.Mcp.Server/CHANGELOG.mdfor product changes (features, bug fixes, UI/UX, updated dependencies)servers/Azure.Mcp.Server/README.mdand/orservers/Fabric.Mcp.Server/README.mddocumentationeng/scripts/Process-PackageReadMe.ps1. See Package README/servers/Azure.Mcp.Server/docs/azmcp-commands.mdand/or/docs/fabric-commands.md.\eng\scripts\Update-AzCommandsMetadata.ps1to update tool metadata in azmcp-commands.md (required for CI)ToolDescriptionEvaluatorand obtained a score of0.4or more and a top 3 ranking for all related test prompts/servers/Azure.Mcp.Server/docs/e2eTestPrompts.mdcrypto mining, spam, data exfiltration, etc.)/azp run mcp - pullrequest - liveto run Live Test Pipeline