Fix endpoint validation to pass ArmEnvironment always#2320
Merged
alzimmermsft merged 4 commits intoApr 1, 2026
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates endpoint domain validation to always consider the configured Azure cloud (ArmEnvironment) so that sovereign cloud endpoints (China/Gov/etc.) validate correctly across tools and helpers.
Changes:
- Removed the
EndpointValidator.ValidateAzureServiceEndpoint(string endpoint, string serviceType)overload so callers must provideArmEnvironment. - Updated tool services to pass
TenantService.CloudConfiguration.ArmEnvironmentinto endpoint validation. - Updated/added unit tests and added a server changelog entry for the fix.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| tools/Azure.Mcp.Tools.Communication/src/Services/CommunicationService.cs | Passes tenant-configured ArmEnvironment into endpoint validation for Communication endpoints. |
| tools/Azure.Mcp.Tools.AppConfig/src/Services/AppConfigService.cs | Passes tenant-configured ArmEnvironment into endpoint validation for AppConfig endpoints. |
| tools/Azure.Mcp.Tools.Acr/src/Services/AcrService.cs | Passes tenant-configured ArmEnvironment into endpoint validation for ACR login server endpoints. |
| servers/Azure.Mcp.Server/changelog-entries/1775052619914.yaml | Adds changelog entry documenting the sovereign cloud endpoint validation fix. |
| core/Microsoft.Mcp.Core/tests/Microsoft.Mcp.Core.UnitTests/Helpers/EndpointValidatorTests.cs | Updates tests to use the 3-parameter validation API (but currently contains failing assertions). |
| core/Microsoft.Mcp.Core/src/Helpers/EndpointValidator.cs | Removes the 2-parameter overload so ArmEnvironment must be provided by callers. |
Comments suppressed due to low confidence (1)
core/Microsoft.Mcp.Core/src/Helpers/EndpointValidator.cs:106
- Removing the public 2-parameter overload is a breaking API change for any external consumers of Microsoft.Mcp.Core. If this library is published, consider keeping the overload and marking it
[Obsolete](forwarding to the 3-parameter method) for at least one release, or ensure versioning/changelog reflects the breaking change.
/// <summary>
/// Validates that an endpoint belongs to an allowed Azure service domain for the specified cloud environment.
/// </summary>
/// <param name="endpoint">The endpoint URL to validate.</param>
/// <param name="serviceType">The type of Azure service (e.g., "storage-blob", "keyvault").</param>
/// <param name="armEnvironment">The Azure cloud environment (Public, China, Government, etc.).</param>
public static void ValidateAzureServiceEndpoint(string endpoint, string serviceType, ArmEnvironment armEnvironment)
{
jongio
reviewed
Apr 1, 2026
xiangyan99
approved these changes
Apr 1, 2026
Member
|
You need dotnet format |
0a49b53 to
f0fb4be
Compare
xiangyan99
approved these changes
Apr 1, 2026
alzimmermsft
added a commit
to alzimmermsft/mcp
that referenced
this pull request
Apr 1, 2026
* Fix endpoint validation to pass ArmEnvironment always * Add CHANGELOG entry * Testing change revert * Fix linting
vcolin7
pushed a commit
that referenced
this pull request
Apr 1, 2026
Fix endpoint validation to pass ArmEnvironment always (#2320) * Fix endpoint validation to pass ArmEnvironment always * Add CHANGELOG entry * Testing change revert * Fix linting
colbytimm
pushed a commit
to colbytimm/microsoft-mcp
that referenced
this pull request
Apr 20, 2026
* Fix endpoint validation to pass ArmEnvironment always * Add CHANGELOG entry * Testing change revert * Fix linting
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?
Updates
EndpointValidatorto remove overload ofValidateAzureServiceEndpointthat doesn't takeArmEnvironmentand update all calling locations to use the variant that does and to pass theArmEnvironmentconfigured in theTenantService.GitHub issue number?
[Link to the GitHub issue this PR addresses]Pre-merge Checklist
servers/Azure.Mcp.Server/README.mdand/orservers/Fabric.Mcp.Server/README.mddocumentationREADME.mdchanges running the script./eng/scripts/Process-PackageReadMe.ps1. See Package READMEToolDescriptionEvaluatorand obtained a score of0.4or more and a top 3 ranking for all related test promptsconsolidated-tools.jsonbreaking-changelabelservers/Azure.Mcp.Server/docs/azmcp-commands.md./eng/scripts/Update-AzCommandsMetadata.ps1to update tool metadata inazmcp-commands.md(required for CI)servers/Azure.Mcp.Server/docs/e2eTestPrompts.mdcrypto mining, spam, data exfiltration, etc.)/azp run mcp - pullrequest - liveto run Live Test Pipeline