Add Microsoft Managed Apps host provider - #2406
Draft
alanc-msft wants to merge 1 commit into
Draft
Conversation
Adds a new GCM host provider, Microsoft.ManagedApps, that automatically authenticates against Git repositories hosted by Microsoft Managed Apps' Power Platform environment Git service, removing the need for users to hand-author a per-environment [credential "https://<host>"] generic OAuth configuration block for every environment they clone from. - Host recognition (ManagedAppsCloudEnvironment): matches hosts against a suffix table per deployment "cloud environment" (prod today; preprod, test, and future sovereign clouds are addable as single compiled-in table entries once their resource/scopes are confirmed). A cloud environment only participates in matching once it has a complete definition (host suffix + resource + scopes), so unconfigured hosts safely fall through to the existing generic OAuth provider with zero regression risk. - Authentication: reuses the existing, shared MicrosoftAuthentication (MSAL-based) component, the same one Microsoft.AzureRepos uses, instead of the generic OAuth provider's per-host OAuth2 client. Because MSAL's token cache is keyed by client/authority/account rather than hostname, a single interactive sign-in is silently reused across every Managed Apps environment. - Non-interactive auth: supports managed identity, service principal, and workload identity federation for CI/CD, mirroring Microsoft.AzureRepos. - Extensibility: new cloud environments are a single-entry addition to a compiled-in table, or addable purely via Git configuration (credential.managedAppsCloudEnvironment.<name>.*) ahead of an official release. Known open item: prod's scopes currently use the broad https://api.powerplatform.com/.default grant rather than the originally intended granular GitRepositories.* permissions, which Microsoft Entra ID rejected with AADSTS65002 (first-party preauthorization required). Reverting once that is granted is a one-line change (see the comment in ManagedAppsCloudEnvironment.CompiledInDefaults). Adds Microsoft.ManagedApps.Tests with unit coverage for host matching, config-merge behavior, all four credential-generation paths, and the account-binding manager. Registered at Normal priority alongside AzureRepos/Bitbucket/GitHub/GitLab, before the generic catch-all provider. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.
Summary
Adds a new GCM host provider,
Microsoft.ManagedApps, that automatically authenticates against Git repositories hosted by Microsoft Managed Apps' Power Platform environment Git service.Today, users must hand-author a
[credential "https://<host>"]generic OAuth configuration block for every environment subdomain they clone from (each environment gets its own opaque, per-instance hostname). This does not scale, is error-prone, and does not provide single sign-on across environments (the generic OAuth provider keys its refresh-token cache per-hostname).This PR is a draft shared for early design feedback before further polishing/upstreaming — see "Open items" below.
Design
ManagedAppsCloudEnvironment): matches hosts against a suffix table per deployment "cloud environment" (prodtoday;preprod,test, and future sovereign clouds are addable as single compiled-in table entries once their resource/scopes are confirmed). A cloud environment only participates in matching once it has a complete definition (host suffix + resource + scopes), so unconfigured hosts safely fall through to the existing generic OAuth provider with zero regression risk.MicrosoftAuthentication(MSAL-based) component — the same oneMicrosoft.AzureReposuses — instead of the generic OAuth provider's per-host OAuth2 client. Because MSAL's token cache is keyed by client/authority/account rather than hostname, a single interactive sign-in is silently reused across every Managed Apps environment.Microsoft.AzureRepos.credential.managedAppsCloudEnvironment.<name>.*) ahead of an official release.Normalpriority alongside AzureRepos/Bitbucket/GitHub/GitLab, before the generic catch-all provider.Testing
Microsoft.ManagedApps.Testsproject: unit coverage for host matching, config-merge behavior, all four credential-generation paths, and the account-binding manager.dotnet build -c WindowsDebuganddotnet testboth pass locally (923/923 tests, including the 50 new ones).Open items
prod's scopes currently use the broaderhttps://api.powerplatform.com/.defaultgrant rather than the originally intended granularGitRepositories.*permissions, which Microsoft Entra ID rejected withAADSTS65002(first-party preauthorization required). Reverting once that's granted is a one-line change (see the comment inManagedAppsCloudEnvironment.CompiledInDefaults).preprod/test/sovereign-cloud resource+scopes are not yet defined by the service; those cloud environments are recognized by host suffix only and remain unmatched (safe fallback) until completed.Id,Name, namespace) are open to feedback.Opened as a draft for early feedback — not requesting review/merge yet.