Skip to content

populate MicrosoftGraphUrl when ARM metadata omits trailing slash#453

Open
MaddyMicrosoft wants to merge 1 commit into
Azure:mainfrom
MaddyMicrosoft:fix/harden-maparmtoazureenvironment-graphurl
Open

populate MicrosoftGraphUrl when ARM metadata omits trailing slash#453
MaddyMicrosoft wants to merge 1 commit into
Azure:mainfrom
MaddyMicrosoft:fix/harden-maparmtoazureenvironment-graphurl

Conversation

@MaddyMicrosoft

Copy link
Copy Markdown
Member

Call TrimEnd('/') unconditionally so MicrosoftGraphUrl is derived whenever MicrosoftGraphResourceId is present. Behavior is unchanged for endpoints that already include a trailing slash.

Added test fixtures and unit tests covering both shapes:

  • ArmResponseMicrosoftGraphNoTrailingSlash.json
  • ArmResponseMicrosoftGraphWithTrailingSlash.json

Fixes ICM 787125398
Related: Azure/CLIPS#179

Call TrimEnd('/') unconditionally so MicrosoftGraphUrl is derived whenever
MicrosoftGraphResourceId is present. Behavior is unchanged for endpoints
that already include a trailing slash.

Added test fixtures and unit tests covering both shapes:
  - ArmResponseMicrosoftGraphNoTrailingSlash.json
  - ArmResponseMicrosoftGraphWithTrailingSlash.json

Fixes ICM 787125398
Related: Azure/CLIPS#179
@MaddyMicrosoft MaddyMicrosoft marked this pull request as ready for review June 9, 2026 02:11
Copilot AI review requested due to automatic review settings June 9, 2026 02:11

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 pull request updates ARM-metadata-to-AzureEnvironment mapping so MicrosoftGraphUrl is consistently populated whenever MicrosoftGraphResourceId is present, even when the ARM metadata omits a trailing /. This aligns discovered environment behavior with the built-in environment constants (resource ID commonly ends with /, URL commonly does not).

Changes:

  • Always derive ExtendedEndpoint.MicrosoftGraphUrl from MicrosoftGraphResourceId.TrimEnd('/') (no longer gated on EndsWith("/")).
  • Add new ARM metadata JSON fixtures covering both trailing-slash and no-trailing-slash shapes.
  • Add unit tests validating both shapes map to the expected MicrosoftGraphEndpointResourceId and MicrosoftGraphUrl properties.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
src/Authentication.Abstractions/AzureEnvironment.cs Unconditionally derives MicrosoftGraphUrl from MicrosoftGraphResourceId by trimming trailing slashes.
src/Authentication.Abstractions.Test/TestData/ArmResponseMicrosoftGraphWithTrailingSlash.json Adds ARM metadata fixture where microsoftGraphResourceId includes a trailing /.
src/Authentication.Abstractions.Test/TestData/ArmResponseMicrosoftGraphNoTrailingSlash.json Adds ARM metadata fixture where microsoftGraphResourceId does not include a trailing /.
src/Authentication.Abstractions.Test/AzureEnvironmentTests.cs Adds tests validating MicrosoftGraphUrl population for both ARM metadata shapes.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@isra-fel isra-fel 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!

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants