Skip to content
YouTube New identity labs every week on YouTube — subscribe
AWS

Secretless Multi-Cloud Security: Workload Identity Federation with GitHub Actions, AWS STS, GCP IAM & Azure Workload ID

Secretless Multi-Cloud Security: Workload Identity Federation with GitHub Actions, AWS STS, GCP IAM & Azure Workload ID

Quick Answer

Secretless multi-cloud architecture eliminates static cloud credentials—such as AWS access keys, GCP service account JSON keys, and Azure client secrets—by using OpenID Connect (OIDC) Workload Identity Federation. External workloads exchange short-lived, cryptographically signed OIDC tokens for temporary cloud provider STS tokens, completely eliminating credential leak risks.

Advertisement

This technical guide is part of our comprehensive Entra Application & Workload Identity Hub, providing production architecture blueprints, step-by-step implementation standards, and real-world failure troubleshooting for modern enterprise identity teams.

MULTI-CLOUD DEVSECOPS • ZERO STATIC SECRETS ARCHITECTURE

Long-lived cloud credentials—such as AWS IAM Access Keys (AKIA...), Google Cloud Service Account JSON keyfiles, and Azure Client Secrets—represent the number-one vector of catastrophic cloud compromises in enterprise environments. When stored inside CI/CD runners, developer machines, or third-party pipelines, static secrets inevitably leak through build logs, code repositories, or supply-chain exploits. The modern standard of cloud security is Secretless Workload Identity Federation built upon OpenID Connect (OIDC) and RFC 8693 / RFC 7523 token exchange. By establishing trust between external identity providers (such as GitHub Actions or Kubernetes clusters) and cloud control planes (AWS STS, Google Cloud IAM, and Microsoft Entra ID), workloads exchange ephemeral, cryptographically verified JSON Web Tokens (JWTs) for short-lived cloud credentials. In this architectural guide, we construct production Terraform configurations and CI/CD pipelines to eliminate static keys across AWS, GCP, and Azure.

1. The Problem: The Danger of Long-Lived Static Cloud Keys

Workload Identity Federation is an identity protocol mechanism that enables external software workloads (such as CI/CD jobs, Kubernetes pods, or multi-cloud applications) to authenticate securely to cloud platform APIs using short-lived OpenID Connect (OIDC) identity tokens without creating or maintaining static cloud service account keys.

Managing static credentials across enterprise multi-cloud pipelines introduces severe structural risks:

  • Credential Leakage and Secret Sprawl: Storing AWS_SECRET_ACCESS_KEY or GCP service account keys in repository secrets or environment variables means any compromised dependency or misconfigured build script can exfiltrate the credentials to external endpoints.
  • Lack of Automatic Key Rotation: Because rotating static credentials across dozens of microservices risks breaking production pipelines, organizations frequently leave keys active for months or years, completely violating least privilege standards.
  • Absence of Contextual Authorization: A static AWS IAM key works from any IP address on the globe and grants identical permissions whether executed by an automated master deployment branch or a compromised test pull request.
Security Dimension Legacy Static Cloud Secrets OIDC Workload Identity Federation
Credential Lifespan Indefinite (Until manually rotated/revoked) Ephemeral (15 minutes to 1 hour max)
Storage Location CI/CD secret stores, config files, developer laptops In-memory only (Never written to disk)
Contextual Claim Enforcement None (Static identity) Strict (Branch, Repository, Environment, Workflow)
Blast Radius of Leak Total tenant/account compromise Zero (Tokens expire within minutes)
Audit & Attribution Shared key obscures individual job identity CloudTrail/Audit Logs record exact Git commit SHA

2. How OIDC Token Exchange Operates Across Clouds

When a GitHub Actions runner executes a secretless deployment job, the following 5-step cryptographic handshake occurs:

  1. OIDC Token Request: The runner requests a signed JSON Web Token (JWT) from GitHub’s internal token mint (https://token.actions.githubusercontent.com).
  2. JWT Generation: GitHub signs the token with its private key. The token payload contains immutable claims:
    • iss: https://token.actions.githubusercontent.com
    • aud: The cloud provider’s expected audience (e.g. sts.amazonaws.com)
    • sub: repo:organization/project:ref:refs/heads/main
    • repository: organization/project
  3. Token Presentation: The workflow presents this JWT to the cloud provider’s Security Token Service (STS).
  4. Cryptographic Verification: The cloud provider retrieves GitHub’s public keys from its published JWKS endpoint (/.well-known/jwks.json), verifies the signature, and evaluates the Trust Policy condition against the token claims.
  5. Credential Issuance: If the repository and branch match the policy exactly, the cloud STS returns temporary session credentials (valid for 1 hour).
Advertisement

3. AWS Architecture: GitHub Actions to AWS IAM via STS

The following Terraform module establishes an OIDC Identity Provider in AWS and creates an IAM Role that can only be assumed by the main branch of an authorized GitHub repository:

# Configure GitHub Actions OIDC Identity Provider in AWS IAM
resource "aws_iam_openid_connect_provider" "github" {
  url             = "https://token.actions.githubusercontent.com"
  client_id_list  = ["sts.amazonaws.com"]
  thumbprint_list = ["6938fd4d98bab03faadb97b34396831e3780aea1"]
}

# Define IAM Role with strict claim-bound Trust Relationship
resource "aws_iam_role" "github_deployer" {
  name = "github-actions-cloudknowledge-deployer"

  assume_role_policy = jsonencode({
    Version = "2012-10-17"
    Statement = [
      {
        Effect = "Allow"
        Principal = {
          Federated = aws_iam_openid_connect_provider.github.arn
        }
        Action = "sts:AssumeRoleWithWebIdentity"
        Condition = {
          StringEquals = {
            "token.actions.githubusercontent.com:aud" = "sts.amazonaws.com"
          }
          StringLike = {
            "token.actions.githubusercontent.com:sub" = "repo:Cloud-Knowledge/production-infra:ref:refs/heads/main"
          }
        }
      }
    ]
  })
}

Inside the GitHub Actions workflow, the deployment uses the official AWS action with zero static passwords:

jobs:
  deploy:
    runs-on: ubuntu-latest
    permissions:
      id-token: write # Mandatory to request the GitHub OIDC JWT
      contents: read
    steps:
      - name: 📥 Checkout Code
        uses: actions/checkout@v4

      - name: 🔐 Configure AWS Credentials via OIDC
        uses: aws-actions/configure-aws-credentials@v4
        with:
          role-to-assume: arn:aws:iam::123456789012:role/github-actions-cloudknowledge-deployer
          aws-region: us-east-1

      - name: 🚀 Deploy Infrastructure
        run: aws s3 ls

4. Google Cloud Architecture: Workload Identity Pools & Providers

In Google Cloud Platform (GCP), Workload Identity Federation utilizes Workload Identity Pools to translate external OIDC claims into Google IAM identities without managing service account keys.

# 1. Create a Workload Identity Pool
gcloud iam workload-identity-pools create "github-pool"     --project="cloudknowledge-prod"     --location="global"     --display-name="GitHub Actions Pool"

# 2. Create the OIDC Provider within the pool
gcloud iam workload-identity-pools providers create-oidc "github-provider"     --project="cloudknowledge-prod"     --location="global"     --workload-identity-pool="github-pool"     --display-name="GitHub Actions Provider"     --issuer-uri="https://token.actions.githubusercontent.com"     --attribute-mapping="google.subject=assertion.sub,attribute.repository=assertion.repository,attribute.ref=assertion.ref"     --attribute-condition="assertion.repository == 'Cloud-Knowledge/production-infra' && assertion.ref == 'refs/heads/main'"

# 3. Allow GitHub repository subject to impersonate GCP Service Account
gcloud iam service-accounts add-iam-policy-binding "ci-deployer@cloudknowledge-prod.iam.gserviceaccount.com"     --project="cloudknowledge-prod"     --role="roles/iam.workloadIdentityUser"     --member="principalSet://iam.googleapis.com/projects/PROJECT_NUMBER/locations/global/workloadIdentityPools/github-pool/attribute.repository/Cloud-Knowledge/production-infra"

5. Common Security Anti-Patterns & Traps

  1. Wildcarding Subject Claims (repo:org/*): Setting "token.actions.githubusercontent.com:sub": "repo:my-org/*" allows any repository created inside your GitHub organization—including public fork experiments by interns—to assume production administrator roles. Always lock the subject to the specific repository and branch.
  2. Neglecting Pull Request (PR) Isolation: If a workflow triggers on pull_request and assumes production roles, a malicious pull request from an untrusted collaborator can execute code inside your cloud environment. Never grant cloud IAM role assumption to pull_request events; restrict roles to push on protected branches or release tags.
  3. Audience (aud) Mismatch: Omitting audience validation allows tokens minted for one third-party service to be maliciously replayed against cloud APIs. Always mandate exact audience validation in the trust policy.

6. Enterprise Migration Checklist

  • [ ] Audit existing cloud tenants for active static IAM user access keys and JSON service account keys.
  • [ ] Deploy OIDC Identity Providers and Workload Identity Pools via Terraform.
  • [ ] Update CI/CD workflows to request OIDC tokens (`permissions: id-token: write`).
  • [ ] Deactivate and permanently delete static cloud access keys.
  • [ ] Monitor AWS CloudTrail and GCP Cloud Audit Logs for anomalous STS / Token Exchange events.

Frequently Asked Questions

How does Workload Identity Federation eliminate static keys in CI/CD pipelines?

Instead of saving long-lived cloud secret keys in CI/CD repository secrets, the runner requests an ephemeral, OIDC JSON Web Token (JWT) signed by the runner’s identity provider (e.g., GitHub Actions). The cloud provider verifies the JWT signature and exchanges it for a short-lived STS token.

What claims does AWS STS validate when assuming an IAM role via GitHub Actions?

AWS STS checks the trust policy conditions against the incoming JWT claims, specifically the issuer (iss: token.actions.githubusercontent.com), the audience (aud: sts.amazonaws.com), and the subject claim (sub: repo:org/repo:ref:refs/heads/main) to prevent unauthorized repositories from assuming the role.

What Entra ID license is required for Workload Identity Federation?

Configuring federated credentials on standard application registrations and user-assigned managed identities is available with Microsoft Entra ID Free / P1. Advanced risk evaluation and conditional access for workloads require Microsoft Entra Workload ID Premium.

How does Google Cloud Workload Identity Pool map external OIDC attributes?

GCP Workload Identity Pools use attribute mappings (e.g., google.subject=assertion.sub) and attribute conditions (e.g., assertion.repository_owner == ‘my-org’) to enforce granular access restrictions before allowing a workload to impersonate a service account.

What is the maximum validity lifetime of an STS session token?

AWS STS session tokens default to 1 hour and can be configured between 15 minutes and 12 hours depending on the role definition. GCP STS tokens are valid for 1 hour, and Azure Entra ID tokens typically expire after 60 to 90 minutes.

Official Architecture & Vendor References

Architect's Toolkit Recommendation

Recommended Hardware & Reference Architecture Literature

Tested tools and authoritative documentation to implement the architectures covered in this lab:

★ 4.8 • HARDWARE SECURITY
YubiKey 5 NFC Security Key
FIDO2 / Passwordless Step-Up Auth
View on Amazon (₹5,499) ↗
★ 4.9 • DISTRIBUTED SYSTEMS
Designing Data-Intensive Apps
By Martin Kleppmann (O'Reilly)
View on Amazon (₹1,250) ↗
Explore high-IOPS lab SSDs, cloud cert guides, and developer mice. Browse Full Architecture Toolkit →
TAGS: #AWS STS #Azure Managed Identities #CI/CD Security #GCP IAM #GitHub Actions #Multi-Cloud #OIDC #Secretless #Workload Identity Federation