Add cloud-aware authority/graph endpoint resolution - #478
Add cloud-aware authority/graph endpoint resolution#478Rick Brighenti (rbrighenti) wants to merge 10 commits into
Conversation
Normalize cloud keys for environment overrides and route consent/token/Graph URL generation through cloud-aware helpers so arbitrary cloud names can be configured without code changes Make client-credential token authority cloud-aware
84723d1 to
c0d736c
Compare
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- InteractiveGraphAuthService: append /v1.0 to the cloud-specific Graph BaseUrl so overriding RequestAdapter.BaseUrl doesn't drop the API version segment and 404 every request; add regression test. - BootstrapConfigResolver: pass the caller's CancellationToken into the 'az cloud show' invocation so bootstrap can be cancelled. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 44 out of 44 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (1)
src/Microsoft.Agents.A365.DevTools.Cli/Services/Internal/MicrosoftGraphTokenProvider.cs:337
- PowerShell fallback builds
Connect-MgGraph -ScopesfromvalidatedScopes, which are now normalized to fully-qualified URIs (e.g.https://graph.microsoft.com/User.Read). In this repo, PowerShell guidance consistently uses bare scope names (e.g.User.Read,Application.Read.All), andConnect-MgGraphcommonly expects those. This risks breaking the PowerShell fallback path for commercial clouds when MSAL is unavailable/fails.
Preserve first-party CLI app behavior while routing bootstrap, validation, cleanup, authentication, and Graph calls through the configured sovereign cloud endpoints. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Use the ambient administrator identity when validating and repairing tenant-owned fallback client apps, while preserving resolved-app token checks for issued claims. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 52 out of 52 changed files in this pull request and generated no new comments.
Suppressed comments (1)
src/Microsoft.Agents.A365.DevTools.Cli/Services/Internal/MicrosoftGraphTokenProvider.cs:177
- PowerShell fallback is passed
validatedScopes, butValidateAndPrepareScopesnow normalizes bare scopes into fully-qualified URIs (e.g.https://graph.microsoft.com/User.Read).Connect-MgGraph -Scopestypically expects plain scope names, so the fallback can fail even in commercial cloud and remove the intended MSAL→PowerShell recovery path. Strip the commercial Graph base URL prefix when building the PowerShell script (fallback is already gated to commercial endpoints).
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
🟡 Changes recommended
The create-instance runner wires user-configured Graph/authority endpoints without guarding ArgumentException, so malformed endpoint values can crash the flow instead of failing cleanly with a targeted error.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review details
- Files reviewed: 60/60 changed files
- Comments generated: 1
- Review effort level: Lite
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Select the cloud-specific Observability resource and fail safely when blueprint discovery or Graph authorization is inconclusive. Refresh Graph tokens after client app permission changes and preserve the configured blueprint when duplicate display names exist. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
The latest GCC validation fixes are pushed through Completed:
Validation:
Remaining before merge:
|
There was a problem hiding this comment.
🟡 Changes recommended
The review found functional issues in updated command logic (notably query-entra instance-scopes using appId instead of service principal objectId for grants filtering) that would produce incorrect results and should be fixed before approval.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review details
- Files reviewed: 75/75 changed files
- Comments generated: 2
- Review effort level: Lite
Use service-principal IDs for direct grant queries and distinguish inherited consent from empty or unreadable results. Handle invalid endpoint and manifest values safely, and fail registration-only commands when registration fails. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
🟡 Changes recommended
There are confirmed correctness issues around token caching across authority hosts and robustness of blueprint lookup JSON parsing that should be fixed before approval.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review details
- Files reviewed: 77/77 changed files
- Comments generated: 2
- Review effort level: Lite
| foreach (var candidate in valueElement.EnumerateArray()) | ||
| { | ||
| if (string.Equals( | ||
| candidate.GetProperty("id").GetString(), | ||
| preferredObjectId, | ||
| StringComparison.OrdinalIgnoreCase)) | ||
| { | ||
| selectedMatch = candidate; | ||
| break; | ||
| } | ||
| } |
| var resolvedGraphBaseUrl = ConfigConstants.NormalizeGraphBaseUrl(graphBaseUrl); | ||
| var resolvedAuthorityHost = ConfigConstants.NormalizeAuthorityHost(authorityHost); | ||
| var validatedScopes = ValidateAndPrepareScopes(scopes, resolvedGraphBaseUrl); |
Summary
Makes Graph, OAuth authority, and Agent 365 Tools endpoints cloud-agnostic so the CLI works in sovereign/government clouds in addition to commercial.
A365_GRAPH_BASE_URL_GCC_HIGH).https://login.microsoftonline.com, standard Graph base URL) remains the default fallback.Testing
ConfigConstantsendpoint resolution/normalization and updated affected service/command tests.