PUBLIC BETA OFFER

Save 50% off on an Eligible Learning PlanValid for 1-month plan, 3-month plan, 12-month plan · Code LPXBETA50 · Ends Dec 6, 2026

AZ-401: GitHub Actions OpenID Connect Trust for Azure

Configure exact repository and environment trust on an existing Entra app, separate GitHub token issuance from Azure exchange and resource access, and remove the owned credential.

Guide

Content version 1.0

AZ-401: GitHub Actions OpenID Connect Trust for Azure

AZ-401: GitHub Actions OpenID Connect Trust for Azure

Establish GitHub Actions OpenID Connect (OIDC) trust by selecting an existing authorized Microsoft Entra identity, matching the actual workflow issuer, subject and audience in a federated credential, and then testing exchange and resource access separately. Granting a workflow permission to request a token does not grant access to Azure resources.

This procedure uses one existing Entra application and service principal, a controlled GitHub repository/environment, and owner-approved nonproduction resources. It creates and lists one exact-match federated credential, runs bounded verification cases and removes the owned test changes. The workflow assertion is a JSON Web Token (JWT); neither raw JWTs nor access tokens belong in the evidence. No workflow or cloud operation is reported as executed here.

Select the identity and record the boundary

Use the repository access established through AZ-401: Project Repository and Team Access Boundaries. Obtain authorization from both the identity owner and the owners of the resources being tested.

For this worked route, select an existing Entra application and its service principal. An application owner or a permitted Entra administrator performs credential management. That authority is separate from permission to assign or use Azure resource roles.

Managed identities are another workload-identity choice in supported scenarios. A system-assigned identity follows its Azure resource's lifecycle; a user-assigned identity has an independent lifecycle and can be reused. Do not assume that every identity type accepts the same configuration route. The application procedure below does not create a managed identity or new infrastructure.

Agree on these inputs before changing trust:

  • The application object identifier for management, its distinct application/client identifier for login, and the intended tenant and subscription.
  • The existing repository, its actual owner/repository identifiers, creation and relevant rename/transfer history, and the selected existing environment.
  • A trusted manual workflow and an approved claim-inspection method that can record selected claims without exposing the raw JWT.
  • Existing resource role assignments, one permitted nonmutating resource operation and a second resource/operation expected to be denied.
  • The actual supported read probes, their target identifiers and expected evidence, supplied and validated by the resource owner.
  • A unique test credential name, the current credential list and the person responsible for restoration.

If an operation client or probe is not available and validated, stop at that missing input. Do not substitute a privileged operator's session, create resources to manufacture a result or guess a resource command.

Obtain the actual claims before creating trust

Configure the selected job's token-request permission and use the approved inspection method in its real repository, environment and event context. GitHub can issue an OIDC assertion before Entra trusts it; that issuance is not a successful Azure exchange.

Retain only the issuer, subject, audience and necessary run/context identifiers through the approved protected evidence channel. Compare the issuer with the admitted OIDC reference's standard issuer claim and the value from the actual authorized interface. Copy the complete actual value exactly: do not normalize case, whitespace or a trailing separator to make a mismatch disappear.

Use the subject actually produced for this job:

  • Repositories created after July 15, 2026 use the documented immutable default containing owner and repository identifiers.
  • Applicable repository renames and transfers after that date also move to the immutable format.
  • Older unchanged repositories retain the previous default unless they opt in.
  • This immutable rollout does not apply to GitHub Enterprise Server (GHES).

A remembered organization/repository-name example is therefore insufficient. A job referencing an environment has environment context in its subject. Inspect the actual value, including any encoded metadata, rather than substituting a branch example or constructing a guessed immutable environment string.

The audience must match the exchange used by the real login action. GitHub's generic owner-address default is not a universal Azure Login audience. Record the audience requested by the selected Azure Login configuration and compare it with the assertion and the credential. The documented exchange-audience literal and qualified subject illustrations are retained in the source annotations below.

Environment protection is another independent control. Review the actual environment's branch/tag restrictions, reviewers and bypass behavior. Availability depends on plan and visibility; for GitHub Free, Pro and Team, required reviewers and wait timers are limited to public repositories. An environment subject does not by itself establish a branch restriction or reviewer approval.

Create and list one exact-match federated credential

Prepare the owned credential definition

Use an existing authenticated command-line interface (Azure CLI) with the application's permitted owner/administrator account. Inspect the actual account and application before making a change. The object identifier selected for management must refer to the intended existing application.

Prepare an owned JavaScript Object Notation (JSON) credential file using the documented fields:

Field Required value for this exercise
name A unique agreed name for this one credential; it cannot be renamed later
issuer The complete actual issuer verified against the authoritative issuer locator
subject The exact actual subject of the selected repository/environment job
audiences An array containing the one intended exchange audience, matching the actual login request
description A nonsensitive ownership/purpose note

These are real operational inputs, not example placeholders to submit unchanged. Keep the JSON keys and types from the documented interface, including the audience array. The issuer/subject combination must be unique on the application, and the application must have room within the documented credential limit.

Do not use wildcards, a broad owner-only trust or a custom claim-matching expression. If the supported interface cannot express the actual exact subject and audience, stop.

Create, list and compare

The admitted trust document supplies these command forms. In the illustrative shell syntax below, the owner has set the real application object identifier and the path to the reviewed JSON file:

az ad app federated-credential create --id "$APP_OBJECT_ID" --parameters "$OWNED_CREDENTIAL_FILE"
az ad app federated-credential list --id "$APP_OBJECT_ID"

Inspect the actual creation result and listed credential. Record its identifier and compare its name, issuer, subject and single audience with the reviewed input and actual workflow claims. Stop on a discrepancy; successful creation does not prove that an assertion will match.

The Entra portal also documents a GitHub Actions scenario that fills fields from repository/entity selections. Its auto-filled legacy example is not authoritative for every current repository. Inspect all resulting values. Where that form cannot express the real subject, use the documented exact-value interface above or a supported exact-subject form under Other issuer; do not accept a name-only approximation. Do not switch to a preview expression form to widen this exercise.

Request and exchange the workflow assertion

Use the existing approved environment and trusted manual workflow. The following base example uses the pinned Azure Login revision shown in the admitted reference. Owners must review action compatibility and the actual runner before adoption; a reference example is not a deployment approval.

name: Bounded Azure trust probe

on:
  workflow_dispatch:

permissions:
  contents: read

jobs:
  trust_probe:
    runs-on: ubuntu-latest
    environment: oidc-sandbox
    permissions:
      contents: read
      id-token: write
    steps:
      - name: Exchange workflow identity
        uses: azure/login@8c334a195cbb38e46038007b304988d888bf676a
        with:
          client-id: ${{ secrets.AZURE_CLIENT_ID }}
          tenant-id: ${{ secrets.AZURE_TENANT_ID }}
          subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
      - name: Observe selected Azure context
        run: az account show

Substitute the approved existing environment and configuration identifiers. The login client identifier is not the application object identifier used to manage the credential. Those identifiers select context; they are not a replacement for trust or resource authorization.

The job's ID-token write permission enables assertion requests. Azure Login then performs the exchange. Its configured audience must remain consistent with the recorded audience and federated credential. Do not add a long-lived Azure password or certificate as a fallback when exchange fails.

Record the actual workflow revision, environment admission, assertion-request result, exchange result and selected Azure identity/context. A job blocked by an environment rule has not tested token exchange. Likewise, az account show is a context observation, not proof of permission on a particular resource.

Verify allowed and denied boundaries separately

Run the resource owner's validated nonmutating probes in the same authenticated workload context. Preserve the exact operation and target identifiers supplied at the start; do not run them under the management operator's broader credentials.

The positive case must show both successful exchange and the expected permitted resource result under the existing role assignment. The negative resource case must make an actual request to the designated ungranted resource/operation and inspect its rejection. A missing item in a listing alone is not proof that a direct request was denied.

Use a controlled comparison:

Case What to change or inspect Meaningful expected evidence
Token-request permission unavailable Use the approved negative configuration without the required job permission Assertion cannot be requested; no claim of testing Azure roles
Environment not admitted Observe the applicable protection rule Job waits or is blocked before exchange
Subject not trusted by this application Use an already authorized negative test context with no other matching credential Assertion can be issued, but exchange is rejected
Matching trust and permitted resource Use the selected environment, credential and existing resource role Exchange succeeds and the actual permitted read succeeds
Matching trust but ungranted resource Keep identity/exchange constant and request the designated negative operation Resource access is denied despite successful authentication

Confirm the negative context does not match another existing credential on the application. Do not modify shared trust or invent an unauthorized repository to force a failure.

Capture the actual diagnostic at the failed boundary. A client error, expired assertion, wrong tenant or missing environment approval is not automatically a subject mismatch. Unexpected access requires investigation of effective trust, identity and resource assignments before any wider grant.

Azure role-based access control (RBAC) and service-specific permissions remain separate from credential creation. The application owner who creates the trust might not own resource authorization. Do not grant a broad subscription role merely to make a test green.

The listed observations are expected verification criteria, not fabricated run results. If a required case cannot be safely exercised with the approved inputs, record the missing evidence and stop before claiming complete verification.

Remove only the owned trust and restore the workflow

Stop new exercise runs and allow permitted in-flight work to finish. Compare the selected credential's identifier and exact properties with the creation record. If it changed unexpectedly, stop and reconcile ownership before deletion.

The documented deletion form targets one credential:

az ad app federated-credential delete --id "$APP_OBJECT_ID" --federated-credential-id "$OWNED_CREDENTIAL_ID"
az ad app federated-credential list --id "$APP_OBJECT_ID"

Verify that the owned credential is absent and unrelated records remain. Restore the original workflow permissions, environment selection and owned test settings. Existing application, service principal, resources, role assignments and shared environment protection stay under their owners' control.

Do not assume deleting trust instantly invalidates every previously issued Azure access token. Follow the owner's handling of outstanding sessions and credential lifetime, and record the actual cleanup result. Retain only nonsensitive configuration and verification evidence; remove exercise token copies through the approved protected process.

AZ-401: Azure Pipelines Workload Identity and Service Connections describes the separate Pipelines federation path. AZ-401: Key Vault Integration with Azure Pipelines and GitHub Actions uses an established identity and does not replace this trust verification.

Authoritative Sources

0 views