Skip to content

Support Workload Identity Federation#2297

Open
mjcheetham wants to merge 2 commits intogit-ecosystem:mainfrom
mjcheetham:wif
Open

Support Workload Identity Federation#2297
mjcheetham wants to merge 2 commits intogit-ecosystem:mainfrom
mjcheetham:wif

Conversation

@mjcheetham
Copy link
Copy Markdown
Contributor

@mjcheetham mjcheetham commented Mar 20, 2026

Add support for Workload Identity Federation (WIF) for Azure Repos. This enables users to authenticate to Azure Repos using federated tokens from Managed Identities, GitHub Actions, or generic identity providers.

We support three scenarios:

  1. Generic
    When you have a pre-obtained client assertion token from any external identity provider. You provide the assertion directly and GCM exchanges it for an access token.

  2. Entra ID Managed Identities
    When your workload runs on an Azure resource that has a Managed Identity assigned. GCM will first request a token from the Managed Identity for the configured audience, then exchange that token for an Azure DevOps access token.

  3. GitHub Actions
    When your workload runs in a GitHub Actions workflow. GCM will automatically obtain an OIDC token from the GitHub Actions runtime and exchange it for an Azure DevOps access token.

Rendered documentation

@mjcheetham mjcheetham added auth:microsoft Specific to Microsoft AAD/MSA authentication enhancement New feature or request labels Mar 20, 2026
darasok85az-lang

This comment was marked as spam.

@cyberbossone-coder

This comment was marked as spam.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds support for Azure Repos authentication via Workload Identity Federation (WIF), enabling federated token exchange for Azure DevOps access tokens across multiple workload scenarios.

Changes:

  • Added WIF handling to the Azure Repos host provider (generic assertion, Entra ID Managed Identity, GitHub Actions OIDC).
  • Implemented WIF token acquisition flow in MicrosoftAuthentication and introduced MicrosoftWorkloadFederationOptions.
  • Documented new environment/config settings and added unit tests for the new scenarios.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
src/shared/Microsoft.AzureRepos/AzureReposHostProvider.cs Adds WIF detection/config parsing and uses MSAL to acquire Azure DevOps tokens via federated assertions.
src/shared/Microsoft.AzureRepos/AzureDevOpsConstants.cs Introduces env var and git config keys for WIF settings.
src/shared/Microsoft.AzureRepos.Tests/AzureReposHostProviderTests.cs Adds tests for WIF scenarios (generic, file assertion, managed identity, GitHub Actions).
src/shared/Core/Constants.cs Adds default WIF audience constant and GitHub Actions OIDC env var names.
src/shared/Core/Authentication/MicrosoftWorkloadFederationOptions.cs New options object + scenario enum for WIF flows.
src/shared/Core/Authentication/MicrosoftAuthentication.cs Implements federated confidential client flow + GitHub Actions OIDC token retrieval.
docs/environment.md Documents new WIF-related environment variables.
docs/configuration.md Documents new WIF-related git configuration settings.
docs/azrepos-wif.md New conceptual + usage documentation for Azure Repos WIF.

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

Copy link
Copy Markdown

@HarryGwinnell HarryGwinnell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, just one super minor thing

@mjcheetham mjcheetham force-pushed the wif branch 2 times, most recently from 2a97804 to 0ab36ac Compare April 8, 2026 12:46
Add support for Workload Identity Federation (WIF) for Azure Repos.
This enables users to authenticate to Azure Repos using federated
tokens from Managed Identities, GitHub Actions, or generic identity
providers.

We support three scenarios:

1. Generic
   When you have a pre-obtained client assertion token from any
   external identity provider. You provide the assertion directly and
   GCM exchanges it for an access token.

2. Entra ID Managed Identities
   When your workload runs on an Azure resource that has a Managed
   Identity assigned. GCM will first request a token from the Managed
   Identity for the configured audience, then exchange that token for
   an Azure DevOps access token.

3. GitHub Actions
   When your workload runs in a GitHub Actions workflow. GCM will
   automatically obtain an OIDC token from the GitHub Actions runtime
   and exchange it for an Azure DevOps access token.

Signed-off-by: Matthew John Cheetham <mjcheetham@outlook.com>
Signed-off-by: Matthew John Cheetham <mjcheetham@outlook.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

auth:microsoft Specific to Microsoft AAD/MSA authentication enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants