Skip to content
Least Privilege Principle

Least privilege for workload identities in Google Cloud means attached service accounts and federation with narrow bindings

Workload identities in Google Cloud are the service accounts attached to compute and the federated identities of workloads that run outside Google Cloud. Google's documentation, read 16 Nov 2026, describes Workload Identity Federation, direct access and impersonation. This guide covers the tools, steps, roles to avoid and measures.

Open the calculator ยท All guides

Workloads authenticate as attached service accounts or as federated identities

Workloads on Google Cloud compute use a service account attached to the resource, so no key is needed. Workloads outside Google Cloud, on AWS, Azure, in GitHub or GitLab pipelines, on Kubernetes clusters or on-premises, use Workload Identity Federation.

Google's documentation says federation lets you grant access to on-premises or multicloud workloads using federated identities instead of service account keys, and describes keys as powerful credentials that can present a security risk if not managed correctly.

There are two ways to grant access once the identity is federated. Direct access grants IAM roles to the federated principal itself, with principal:// bindings for one subject and principalSet:// bindings for a group or an attribute. Service account impersonation grants the federated identity permission to act as a service account.

Google recommends creating a new workload identity pool for each non-Google Cloud environment, such as development, staging or production.

Google documents attribute conditions, narrow bindings and the recommender for this identity type

Google's best practices for Workload Identity Federation say to avoid granting the roles/iam.workloadIdentityUser role to all members of a pool, to grant it to specific external identities or identities that match criteria, and to create a dedicated service account for each application.

The same page says to use attribute conditions when federating with GitHub or other multi-tenant identity providers, to use immutable attributes in attribute mappings, to use the provider URL as the audience, to use a single provider per pool to avoid subject collisions, and to manage pools in a dedicated project. It also names an organization policy constraint that can deny creation of new pool providers by default.

For the service accounts behind the workloads, the IAM recommender and the service account usage tools apply, as in the service identities guide. Policy Troubleshooter can explain why a federated principal was allowed or denied a permission.

Google's documentation lists a separate feature for managed workload identities on GKE and Compute Engine, and the Kubernetes federation page describes the cluster setup. Both rely on the same bindings.

Steps to bring workload identities to least privilege

  • Inventory workloads outside Google Cloud that use service account keys, and the service account each key belongs to.
  • Create one workload identity pool per environment in a dedicated project and one provider per pool.
  • Write attribute conditions that admit only the repositories, clusters or accounts you expect, and require the provider URL as audience.
  • Create a dedicated service account per application and grant it predefined roles at project or resource scope.
  • Bind roles/iam.workloadIdentityUser to specific subjects, never to the whole pool.
  • Where direct access is enough, bind roles to the federated principal and skip the service account.
  • Delete the service account keys that federation replaces, disabling them first.
  • Review recommender suggestions for each service account after one full release cycle.

Roles and bindings to avoid on workload identities

Role or bindingDocumented reason (Google, read 16 Nov 2026)Use instead
roles/iam.workloadIdentityUser to the whole poolGoogle says to avoid it, so a pool can grow without granting impersonation to every new identity.Bindings to specific subjects or attributes.
roles/editor on the attached service accountGoogle says default service accounts hold Editor and that sharing a powerful account is risky.A dedicated account with predefined roles.
Service account keys for external workloadsGoogle says federation removes the burden of keys, which are powerful credentials.Workload Identity Federation.
A pool with no attribute condition on GitHub or another multi-tenant providerGoogle says to use attribute conditions with multi-tenant providers.A condition that admits only your repositories or tenants.
One service account for several applicationsGoogle says to create a dedicated service account for each application.One service account per application.

Measure bindings, pools and permissions used per service account

Count workloads that still use keys against workloads that use federation or attached accounts. Count bindings of workloadIdentityUser that reference a whole pool rather than a subject. For each service account, compare the permissions in its roles with permissions used in the last 90 days from the recommender.

Audit logs record the federated subject, which is one reason Google advises a unique subject mapping, so each federated identity can be traced to exactly one external identity. The principle of least privilege explains the logic of the per-permission measure.

Related guides: AWS workload identities and Azure workload identities.

Sources

  1. Google Cloud IAM: Workload Identity Federation, read 16 Nov 2026
  2. Google Cloud IAM: Best practices for using Workload Identity Federation, read 16 Nov 2026
  3. Google Cloud IAM: Best practices for using service accounts, read 16 Nov 2026
  4. Google Cloud IAM: Best practices for managing service account keys, read 16 Nov 2026
  5. Google Cloud IAM: Role recommendations overview, read 16 Nov 2026
  6. Google Cloud IAM: Best practices for using IAM securely, read 16 Nov 2026

Last reviewed 16 Nov 2026.