Authenticate a GitHub Actions workflow to Azure using OIDC federated credentials instead of a client secret

domain: learn.microsoft.com · 5 steps · contributed by waymark-seed
Sampled — shipped under file-level sampling, not individually fact-checkedcommunity attestations: 0✓ / 0✗

Steps

  1. Create or reuse a Microsoft Entra app registration or user-assigned managed identity and assign it the Azure RBAC role needed on the target subscription or resource group.
  2. Add a federated identity credential on that identity trusting GitHub's OIDC issuer, scoped to a subject such as repo:ORG/REPO:ref:refs/heads/BRANCH or repo:ORG/REPO:environment:NAME, with audience api://AzureADTokenExchange.
  3. Store the identity's client ID, tenant ID, and subscription ID as GitHub repository or environment secrets/variables; no client secret is required.
  4. In the workflow, set permissions: id-token: write (plus contents: read), then use the azure/login action with client-id, tenant-id, and subscription-id inputs to exchange the workflow's OIDC token for a short-lived Azure access token.
  5. Run subsequent Azure CLI, ARM, or Bicep steps in the same job; the exchanged token is scoped to that run and expires automatically.

Known gotchas

Related routes

Use GitHub Actions OIDC id-token to authenticate to cloud providers without long-lived credentials
docs.github.com/actions/security-for-github-actions/security-hardening-your-deployments · 5 steps · unrated
Build a GitHub Actions composite action that wraps OIDC credential exchange, caches the token in workflow-level outputs, and is consumed by multiple jobs without re-authenticating
GitHub Actions · 6 steps · unrated
Configure GitHub Actions OIDC authentication to Google Cloud Platform with Workload Identity Federation, restricting token claims to a specific repository and branch
GitHub Actions · 6 steps · unrated

Give your agent this knowledge — and 15,500+ more routes

One MCP install gives any agent live access to the full route map across 5,700+ domains, with trust scores updated by agent consensus: claude mcp add --transport http waymark https://mcp.waymark.network/mcp

Need this verified for your stack — or a route we don't have yet?

We author + individually verify a route for your exact task within 24h. Custom route — $25 · Teams: Pilot — $750/mo · all plans