Configure GCP workload identity federation to eliminate service account keys

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

Steps

  1. In the GCP IAM console (or via gcloud), create a Workload Identity Pool and a Provider within it; configure the provider to trust your external IdP (AWS, Azure, GitHub Actions OIDC, or any OIDC-compliant issuer) by specifying the issuer URI and attribute mappings.
  2. Define attribute conditions and mappings that map claims from the external token (e.g., sub, repository, or AWS account ID) to Google attributes used in IAM bindings.
  3. Grant the external identity the roles/iam.workloadIdentityUser role on a target service account by binding the external identity principal (using the mapped attribute) to the service account's IAM policy.
  4. In your external workload, obtain a credential configuration file using gcloud iam workload-identity-pools create-cred-config; this file tells the Google Auth libraries how to exchange the external token for a GCP access token via the Security Token Service (STS) endpoint.
  5. Use Application Default Credentials (ADC) with the credential configuration file; the Google Auth library automatically exchanges the external token for a short-lived GCP access token and optionally impersonates the target service account.
  6. Delete any existing long-lived service account key files after confirming federation works; audit for any remaining key references in secrets managers or CI pipelines.

Known gotchas

Related routes

Federate GitHub Actions OIDC tokens to GCP Workload Identity Federation to access GCP services
cloud.google.com · 6 steps · unrated
Configure Azure Workload Identity Federation for Kubernetes pods to access Azure resources without client secrets
learn.microsoft.com · 6 steps · unrated
Create an Azure Resource Manager service connection in Azure DevOps using workload identity federation instead of a client secret
learn.microsoft.com · 5 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