Google Cloud Workforce Identity Federation lets people sign in to the Google Cloud console and the gcloud CLI with identities held in your own identity provider, so you do not have to create or synchronise Cloud Identity accounts for them. That removes a whole class of duplicate human accounts, but it moves the security boundary into a handful of settings: the pool, the provider, the attribute mapping, the attribute condition and the allow policies that reference federated principals. Get those right and offboarding becomes an IdP action plus one revocation command. Get them wrong and anyone your IdP vouches for can land in your organisation.
This guide covers workforce (human) federation only. Federation for automated workloads, such as CI pipelines and services in other clouds, is a different feature and is covered in our Workload Identity Federation Guide. Identities for AI agents on Google Cloud are covered in Google Cloud Agent Identity.
This is an independent guide from NHI Mgmt Group, based on Google Cloud's public documentation as of November 2026. It is not sponsored or reviewed by Google. Product features change, so confirm settings against Google Cloud's current documentation.
Key takeaways
- Workforce Identity Federation federates user identities from an external OIDC or SAML 2.0 identity provider. Google's documentation is explicit that automated workloads should use Workload Identity Federation instead.
- Pools are configured at the organisation level, and a pool ID must be globally unique. Treat pool and provider administration as a tier zero privilege.
- The
google.subjectmapping must be stable. Google warns that changing it removes access, and after a purge a subject ID can be reassigned to a different person. - Always write an attribute condition. It is optional for single-tenant IdPs and required for multi-tenant IdPs that share one issuer URL.
- Session duration defaults to one hour and can be set from 15 minutes to 12 hours. It governs access tokens, console sessions and gcloud sessions.
- Offboarding needs two actions: disable the user in the IdP, then run
gcloud iam workforce-pools subjects revoke-sessions. Revocation alone does not block future sign-ins.
How workforce federation works
According to Google's overview, Workforce Identity Federation lets users in an external identity provider use single sign-on to reach Google Cloud. Google Cloud stores no user accounts for them, and no synchronisation tool such as Google Cloud Directory Sync is needed. Supported protocols are OIDC and SAML 2.0.
The exchange follows RFC 8693 OAuth 2.0 Token Exchange. The Security Token Service (STS) verifies the credential issued by your IdP and returns a short-lived Google Cloud access token. Attributes from the IdP, which some IdPs call claims and others call assertions, are then used to decide what the user can reach.
Three objects matter:
- Workforce identity pool. A group of identities, for example
employeesorpartners. You can grant IAM access to a whole pool or to a subset, create several pools and federate several IdPs into one pool. Pools sit at the organisation level. - Workforce identity pool provider. The relationship between your organisation and one IdP: its issuer, its keys and how its attributes are mapped.
- Allow policies. Ordinary IAM bindings on organisations, folders, projects and resources that name federated principals using
principal://andprincipalSet://identifiers.
The security consequence is simple: your IdP becomes the authority for who a Google Cloud user is. Every control your IdP applies (MFA strength, device checks, joiner and leaver processes) now protects Google Cloud too, and every weakness carries across. Our Federation and Trust Relationships Guide covers how to assess that trust before you rely on it.
Designing pools and providers
Pool design is an access design decision, not housekeeping. Because a pool can be granted access as a whole, a pool should contain people who share a trust level. A practical pattern is one pool for employees and a separate pool for contractors or partners, so a broad binding on the employee pool never reaches external staff.
Points from Google's documentation to build into the design:
- Pool IDs must be globally unique across all workforce pools, and the
gcp-prefix is reserved for pool and provider IDs. - The issuer URI must use HTTPS. Google states this is required for security reasons.
- For OIDC, Google describes the authorisation code flow as the more secure option, and it supports larger tokens. The implicit flow is also supported but only with the
only-id-token-claimsoption. - Signing keys (JWKs) are fetched from the
jwks_uriin the IdP's/.well-known/openid-configuration, or uploaded manually. Locally uploaded JWKs work only for the programmatic flow against the STS/tokenendpoint, not for console sign-in. If you upload keys, you also own their rotation. - Pools and providers can be deleted and then undeleted within 30 days. A provider can also be switched off with the Enable provider setting in the console, which is the fastest way to cut off a compromised IdP connection without losing its configuration.
The relevant commands are gcloud iam workforce-pools create, update, delete and undelete, and for providers gcloud iam workforce-pools providers create-oidc, create-saml, update-oidc, delete and undelete. All of them take --location=global.
Attribute mapping: getting identity right
Attribute mapping uses Common Expression Language (CEL) to turn IdP claims into Google attributes. These are the mappings Google documents, with the limits that cause failures if ignored:
| Attribute | Purpose | Documented limit or note |
|---|---|---|
google.subject | Unique user ID (required) | Maximum 127 bytes; must be stable, changing it removes access |
google.groups | Group memberships used in policies | Maximum 400 groups per user or sign-in fails |
google.display_name | Name shown in the console | Maximum 100 bytes; cannot be used in allow policies or conditions |
google.email | Email for workforce OAuth client integrations such as Identity-Aware Proxy | Used by integrations, not as the identity key |
google.posix_username | SSH in browser and OS Login with workforce federation | Maximum 32 characters; Preview |
attribute.KEY | Custom attributes for allow policies | Up to 50 rules of 2,048 characters each |
The total mapping must stay under 16 KB, otherwise sign-in fails. CEL supports split and join, so an expression such as attribute.username=assertion.email.split("@")[0] is valid.
The most important choice is the source of google.subject. Map it to an immutable IdP identifier, such as the IdP's internal object ID, not to an email address or user principal name that can change when someone marries, moves department or is renamed. A mutable subject causes two problems: renamed users lose access, and a recycled value can map a new person onto an old principal and inherit their bindings. Google's deletion guidance makes the second point concrete: after a user is purged, the subject ID can be assigned to a different user and IAM treats it as a new entity. Bindings that still name that subject would then apply to the newcomer.
Keep groups lean. A user in more than 400 groups cannot sign in at all, so filter the groups claim in the IdP to the ones that are meaningful for Google Cloud. A filtered claim is also easier to review.
Attribute conditions: who may sign in at all
An attribute condition is a CEL expression evaluated before a token is issued. If it returns false, the exchange fails. Google describes two uses: limiting which identities can authenticate, and stopping credentials intended for another platform from being replayed against Google Cloud, which is a confused deputy problem.
Google documents the condition as optional for most IdPs, but required for multi-tenant IdPs that use a single issuer URL for every customer. Without one, any tenant of that IdP could present a valid token to your provider. For any IdP, treat a condition as mandatory in your own standard. A simple pattern from Google's documentation is assertion.role == 'gcp-users', which restricts sign-in to users the IdP has explicitly marked for Google Cloud. Pair this with an IdP side assignment, so a person must be both assigned to the Google Cloud application in the IdP and carry the expected claim.
Conditions are the federation equivalent of an allow list. They should be reviewed when the IdP changes tenants, when a new provider is added and at every access review cycle.
Granting access with federated principals
Federated identities appear in IAM allow policies through these identifiers:
- One person:
principal://iam.googleapis.com/locations/global/workforcePools/POOL_ID/subject/SUBJECT_ATTRIBUTE_VALUE - A group:
principalSet://iam.googleapis.com/locations/global/workforcePools/POOL_ID/group/GROUP_ID - An attribute value:
principalSet://iam.googleapis.com/locations/global/workforcePools/POOL_ID/attribute.ATTRIBUTE_NAME/ATTRIBUTE_VALUE - Everyone in the pool:
principalSet://iam.googleapis.com/locations/global/workforcePools/POOL_ID/*
Prefer group bindings. They move the joiner, mover and leaver decision into the IdP where your HR feeds already land, and they keep Google Cloud policies short. Use single subject bindings only for exceptions you can name and justify. Avoid the whole pool wildcard except for genuinely harmless roles, because every future member of the pool inherits it.
Watch the documented boundary on cross-organisation access. Google states federated principals cannot directly access resources outside their organisation, but that impersonating a service account within the organisation can get around this. If a federated group holds iam.serviceAccounts.getAccessToken or similar impersonation rights, it effectively holds every permission of that service account, wherever it is granted. Review impersonation grants with the same care as direct roles. Our Google Cloud IAM and Service Accounts Guide covers that review.
Console and gcloud access
Federated users reach a federated version of the console, which Google calls the console (federated) or the Google Cloud Workforce Identity Federation console. It gives UI access to the products that support workforce federation. Google publishes a list of supported products; check it before migrating a team, because unsupported products can push teams back towards keeping Cloud Identity accounts or service account keys.
Pools can also enable gcloud CLI and API access for federated users. Google's documentation points to a separate sign-in guide for the CLI flow. From a security point of view, the controls that matter are the same as for the console: session duration, attribute condition and revocation all apply to gcloud sessions.
Two operational requirements are easy to miss:
- A workforce pools user project is needed for quota and client based APIs. It requires
serviceusage.services.use, granted through the Service Usage Consumer role. Choose a dedicated project for this rather than a production workload project. - Essential Contacts must be configured for the Legal and Suspension categories, or All.
Session duration and token lifetime
Session duration is set with --session-duration when the pool is created, expressed in seconds such as 3600s. Google documents a default of one hour, a minimum of 900 seconds (15 minutes) and a maximum of 43,200 seconds (12 hours). The value controls the lifetime of Google Cloud access tokens, console (federated) sessions and gcloud sign-in sessions. Google's documentation notes the value can be changed later in the console.
Pick the duration per pool, according to risk. An administrator pool can use a short session so that removal in the IdP takes effect quickly, while a pool for read-only analysts can tolerate longer sessions. Long sessions widen the window in which a stolen session cookie or access token is useful, and they delay the effect of IdP group changes until the next sign-in. Revocation, covered below, closes that window on demand.
Plan for the token exchange quota as well. The sts.googleapis.com/workforce_requests quota defaults to 1,000 requests per minute per organisation and is shared across all pools, providers, users and workloads. Creating another pool does not add quota. Google recommends exponential backoff for retries. Scripts that loop on token exchange can exhaust it for everyone.
Offboarding, revocation and user deletion
Workforce federation gives you two separate tools, and they do different things.
Revoke sessions. gcloud iam workforce-pools subjects revoke-sessions SUBJECT_ID --workforce-pool=WORKFORCE_POOL_ID --location=global immediately invalidates the subject's console sessions, session cookies, short-lived OAuth 2.0 access tokens and other credentials issued for that subject. It needs iam.googleapis.com/workforcePoolSubjects.revokeSessions, included in the Workforce Pool Admin role (roles/iam.workforcePoolAdmin). Google lists suspected credential compromise, urgent offboarding or role change, and forcing re-authentication so new group memberships take effect as the common reasons. Google is also clear about what it does not do: it does not delete the user or their resources, and it does not stop the user signing in again if they are still active in the IdP.
Delete the subject. gcloud iam workforce-pools subjects delete SUBJECT_ID --workforce-pool=WORKFORCE_POOL_ID --location=global deletes the user and all data they exclusively own on Google Cloud. Deletion is soft for 30 days, during which subjects undelete is usually possible, then it is permanent. After the purge the subject ID can be reused for a different user.
A sound leaver sequence is therefore:
- Disable or deprovision the user in the IdP, so no new tokens can be issued.
- Run
revoke-sessionsto kill live sessions and tokens. - Remove any single subject bindings that name the user, and confirm group removal has propagated.
- Transfer anything the user owns that the business needs, then delete the subject if your retention policy requires it.
The broader process is described in our Joiner-Mover-Leaver Guide.
Logging and monitoring
Workforce federation activity appears in Cloud Audit Logs, and Google offers detailed audit logging, enabled on the provider, which records the attributes received from the IdP. It is valuable for troubleshooting mappings and for investigations, because it shows exactly what the IdP asserted at sign-in. Google notes it sends IdP data to Cloud Logging, which is billed, so it is optional. For most organisations the investigative value justifies turning it on for administrator pools at least. Route these logs to a sink outside the reach of the administrators being monitored; see our Google Cloud Audit Logs and Log Sinks Guide.
Signals worth alerting on include changes to pools and providers (create, update, delete, undelete and provider disable), changes to attribute mappings or conditions, new bindings to whole pool wildcards, grants of impersonation rights to federated groups and session revocations outside a known offboarding ticket.
If you use VPC Service Controls, note Google's documented limits: pool configuration APIs are not supported inside a perimeter, and STS requests need egress rules for sts.googleapis.com.
Common failure patterns
- Email as subject.
google.subjectmapped to a changeable email address, so renames break access and recycled addresses inherit old bindings. - No attribute condition. Any identity the IdP can authenticate, or any tenant of a multi-tenant IdP, can exchange tokens.
- Pool wildcard bindings. Roles granted to
workforcePools/POOL_ID/*that every future member inherits. - Revocation treated as offboarding. Sessions revoked but the user left active in the IdP, so they simply sign in again.
- Twelve hour sessions everywhere. The maximum chosen for convenience, including for administrators.
- Hidden impersonation paths. Federated groups that can impersonate powerful service accounts, bypassing the intended boundary.
- Unfiltered group claims. Users in hundreds of directory groups who hit the 400 group limit and cannot sign in, prompting rushed workarounds.
- Workforce federation used for automation. Scripts and pipelines signing in as people, instead of using workload federation and dedicated service identities.
Practitioner checklist
- Separate pools by trust level, for example employees and external staff.
- Map
google.subjectto an immutable IdP identifier and document the source claim. - Write an attribute condition for every provider, and require IdP assignment to the Google Cloud application.
- Use the OIDC authorisation code flow where the IdP supports it, with an HTTPS issuer.
- Filter the groups claim to Google Cloud relevant groups and stay well under 400.
- Bind roles to groups; record justification for every single subject binding; ban pool wildcards for anything above read only.
- Set session duration per pool, shortest for administrators.
- Restrict
roles/iam.workforcePoolAdminto a small, monitored group. - Build IdP disable plus
revoke-sessionsinto the leaver runbook. - Enable detailed audit logging at least for privileged pools and alert on pool, provider and mapping changes.
- Review service account impersonation rights held by federated groups each quarter.
Standards and references
- Google Cloud: Workforce Identity Federation overview
- Google Cloud: Manage workforce identity pools and providers
- Google Cloud: Revoke Workforce Identity Federation user sessions
- Google Cloud: Delete workforce identity federation users and their data
- IETF: RFC 8693 OAuth 2.0 Token Exchange
- NIST: SP 800-63C-4 Federation and Assertions
- OpenID Foundation: OpenID Connect Core 1.0
- CIS: Control 5 Account Management
Related NHI Mgmt Group resources: Workload Identity Federation Guide · Google Cloud Security Guide · Google Cloud IAM and Service Accounts Guide · Identity Provider and SSO Security Guide