Prepare and test your skills
Prepare and test your skills
Programmatic user lifecycle management is the automation of creating, updating, suspending, and deleting user accounts as people join, move within, and leave an organization. Automation connects to an authoritative identity source, with Cloud Identity (opens in a new tab) managing users and Google Groups (opens in a new tab) carrying access, while Identity and Access Management (IAM) (opens in a new tab) enforces permissions on resources. Access stays consistent because changes to group membership, not manual edits to policies, determine who can do what.
The authoritative identity source is the system where user accounts are created and where suspension and deletion must originate so Google Cloud access follows automatically. Automation must propagate suspension and deletion events from this source to Google Cloud, so disabling a user in the source also removes Google Cloud access without extra steps. The choice determines whether Google or an external provider owns the account lifecycle.
| Option | Where users are managed | How users reach Google Cloud |
|---|---|---|
| Cloud Identity or Google Workspace | Users and groups are created and managed directly in Cloud Identity or Google Workspace, with later synchronization to an external provider if needed | Users authenticate with managed Google accounts and receive access through group membership |
| External identity provider with Workforce Identity Federation | Users and groups are created and managed in Microsoft Entra ID, Okta, or another OIDC or SAML provider | Users sign in with their existing external account through a workforce identity pool, with no second Google account |
Choose Cloud Identity management when Google must centrally provision administrators and administrative groups for a verified domain. Choose Workforce Identity Federation when human resources (HR) or an external provider must remain the single source of truth and users should keep only one external account.
Group-based lifecycle automation binds IAM roles to Google Groups once, then adds, moves, or removes users as HR join, move, and leave events occur. Data flows from the HR system or identity provider to Cloud Identity, from Cloud Identity to group membership, and from group membership to IAM allow policies on organizations, folders, and projects. This removes the need to update IAM policies for each individual user change.
A complete lifecycle workflow runs in order:
Because access follows the group, moving a user between groups both grants and revokes access in one action.
Consistent access control means IAM roles are granted to groups of users according to job role, never to individual user accounts. Identity and Access Management (IAM) evaluates the group as the principal, so every member inherits the same collection of permissions and removal from the group removes all of those permissions at once. This implements role-based access control (RBAC) and the principle of least privilege by giving users only the minimum permissions their group requires.
Foundational administrative groups separate duties at organization level:
gcp-organization-admins administers all organization resources and is assigned only to the most trusted users.gcp-billing-admins sets up billing accounts and monitors usage.gcp-network-admins creates Virtual Private Cloud networks, subnets, and firewall rules.gcp-security-admins establishes organization security, access management, and organization constraint policies.gcp-developers and gcp-devops separate application coding and testing from pipeline, delivery, and provisioning work.Automation should create one group per function, bind least-privilege roles at the organization level, and require more than one user in each critical group to avoid single-person dependency.
Suspension and deletion only enforce consistent policy when dependent sessions, keys, and data paths are also revoked. When the authoritative source suspends or deletes a user, federation must propagate that state so existing Google Cloud sessions lose access, and project design must tie secondary credentials to the Google identity. Without this linkage, a disabled user could retain access through long-lived keys or database passwords.
Three controls connect credential lifecycle to identity lifecycle. OS Login links VM SSH authorized keys to the Google identity, so removing the user automatically revokes VM access instead of leaving metadata-based SSH keys behind. Authentication proxies for Cloud SQL and AlloyDB link database credentials to the Google identity, so suspending the Cloud Identity or Google Workspace account revokes database access. The iam.allowedPolicyMemberDomains organization constraint restricts identities by domain, which prevents external consumer accounts that the organization cannot suspend or delete from receiving project access.
Exam tip: Grant IAM roles to a Google Group, not to an individual user or to an email alias, because a grant to an alias applies to the primary email and reveals that primary address.
Lifecycle verification proves that provisioned access matches actual use and that changes are traceable for compliance. Policy Intelligence with IAM recommender uses machine learning to identify unused roles and abandoned service accounts, which helps rightsize bindings and maintain least privilege after moves and departures. Cloud Audit Logs exported to Cloud Logging record who changed IAM policies and who changed group membership, so join, move, and leave actions remain auditable.
At enterprise scale, automation exports IAM recommender findings to BigQuery with the BigQuery Data Transfer Service and queries for REMOVE_ROLE recommendations from google.iam.policy.Recommender to find bindings to remove. Reviewers then apply or dismiss each recommendation, remove orphaned accounts, and rotate project-level secrets such as service account keys and OAuth client secrets without disruption.
Auditing programmatic changes to users and groups means creating a verifiable record of every identity lifecycle event, detecting unauthorized activity quickly, and proving that access still follows policy. In Google Cloud, Cloud Audit Logs (opens in a new tab) records who did what, where, and when for IAM policy changes and service account operations, while Google Workspace Activity logs record Google group membership changes. Long-term retention through log sinks, real-time alerting in Cloud Logging (opens in a new tab), and periodic review with Policy Analyzer (opens in a new tab) turn those raw events into security monitoring and compliance evidence.
Identity lifecycle events are the programmatic user and group operations that change who can access Google Cloud resources. Cloud Audit Logs helps administrators look back at historical data for forensics, breach analysis, and troubleshooting production issues caused by an IAM policy change. Two scenarios make this review especially important: analyzing permissions and access during a data breach, and verifying which user or automated process made a change that broke production. Because programmatic tools can make many changes quickly, each event must tie an action to an actor and a timestamp.
Cloud Audit Logs classifies audit logs into four categories that flow from Google Cloud services into Cloud Logging:
For identity and access administrative logging, Admin Activity audit logs and Policy Denied audit logs are recommended. Admin Activity audit logs store changes to resources such as projects, Compute Engine instances, and service accounts, including service account creation, IAM policy changes, and service account key downloads. Policy Denied audit logs record when a user or service account is denied access to a Google Cloud service because of a security policy violation.
| Log type | What it records | Use it when |
|---|---|---|
| Admin Activity audit logs | Resource mutations such as SetIamPolicy, service account creation, and key downloads | Tracing who changed permissions or created credentials |
| Policy Denied audit logs | Denied access caused by a security policy violation | Detecting attempted unauthorized access or overly restrictive policy |
Admin Activity audit logs are always written and cannot be configured, excluded, or disabled, even if the Cloud Logging API is disabled. That guarantee makes Admin Activity logs the authoritative source for programmatic IAM changes, while Policy Denied logs show the attempts that policy blocked.
Cloud Logging retains each audit log only for its default retention period, so organizations that need longer history must export logs before they expire. A log sink routes copies of log entries from Cloud Logging to a destination such as BigQuery or another sink destination for long-term storage. Exporting to BigQuery lets analysts select a subset of columns, view data over time, and run aggregate analysis for security and access analytics. Without a sink, forensic review and compliance reporting are limited to whatever remains inside the default retention window.
A Logs Explorer query in Cloud Logging isolates programmatic IAM operations from general project activity by filtering on log name, resource type, and API method. The query targets the activity log for a specific project and looks for policy writes and credential creation, so routine reads do not hide high-risk writes. The three method names to monitor are SetIamPolicy for IAM policy changes, google.iam.admin.v1.CreateServiceAccount for new service accounts, and google.iam.admin.v1.CreateServiceAccountKey for new service account keys.
To view changes to IAM policies in the Google Cloud console:
logName to projects/<PROJECT>/logs/cloudaudit.googleapis.com%2Factivity so only Admin Activity entries are returned.resource.type of project or service_account and resource.labels.project_id equal to <PROJECT>.protoPayload.methodName equal to SetIamPolicy, google.iam.admin.v1.CreateServiceAccount, or google.iam.admin.v1.CreateServiceAccountKey, then run the query.The same entries can also be listed programmatically through the Cloud Logging API or the gcloud command-line interface when automation or repeatable evidence collection is needed. Replacing <PROJECT> with the actual project ID keeps the query scoped to one trust boundary, which prevents cross-project results from confusing the investigation.
Exam tip: Query SetIamPolicy and service account creation methods in the Cloud Audit Logs activity log, but check Google group membership changes in Workspace Activity logs, not in the same IAM policy query.
Changes to Google group membership are tracked in Activity logs rather than in IAM policy audit entries. Cloud Identity groups control access at scale because an IAM role granted to the group applies to every current member, so adding or removing a member immediately changes effective access without editing the IAM policy. Monitoring group logs is therefore required when IAM policies are assigned to groups, with a specific control to ensure that non-corporate accounts are not added. Group log events map to detective controls for account management and auditing, which supports compliance reporting on join, move, and leave events.
Log-based alerting in Cloud Logging turns stored audit events into real-time detection for suspicious programmatic activity. Organizations should define policies and procedures to monitor administrator activity and generate actions or alerts that match enterprise access policies. Useful alert conditions include unauthorized virtual machine creation, IAM privilege escalation, unusual service account key downloads, and unexpected spikes in service account usage. Because Admin Activity logs are always generated, an alert that fires from those logs will still trigger even when other logging is reduced, which closes a common evasion path.
Policy Analyzer supports access certification by verifying on a set or periodic basis that users have only the appropriate access to Google Cloud resources. Certification answers which users can access which resource and in what capacity, which auditors need for compliance reviews. Combined evidence strengthens the report: exported BigQuery history proves what changed over time, group membership logs prove who was in privileged groups, Policy Denied logs prove that policy enforced boundaries, and IAM Recommender insights on unused roles and service accounts show progress toward least privilege. Together, retained logs plus periodic analyzer checks demonstrate both that programmatic changes were monitored and that remaining access still adheres to security policy.
Automate Group Membership and Access Policy Enforcement is the practice of granting Identity and Access Management (IAM) roles to Google Groups (opens in a new tab) and then driving access by changing group membership instead of editing IAM policies. A group is a named collection of Google Accounts and service accounts with a unique email address, such as gcp-billing-admins@example.com, and every member inherits all IAM roles granted to that group. This model keeps join, move, and leave events cheap and consistent because access flows from the identity source to the group to the Google Cloud resource.
Google Groups managed by Cloud Identity (opens in a new tab) provide the enforcement point for role-based access control (RBAC) and the principle of least privilege. Administrators grant IAM roles once to the group at the organization, folder, or project level, and users gain or lose those permissions only when they are added to or removed from the group. Permissions are assigned to groups according to job role, and roles are never added to individual user accounts, so a single membership change updates access everywhere the group is used. The trust boundary sits between group management and resource policy: group owners control who is in the group, while IAM controls what the group can do.
Exam tip: A member inherits all IAM roles granted to a Google group regardless of their Google Groups role, such as owner, manager, or member.
The identity source determines where users and groups are created and how changes propagate to Google Cloud. Cloud Identity is an identity as a service (IDaaS) solution that centrally provisions users and groups, while an external identity provider (IdP) such as Microsoft Entra ID or Okta remains the system of record and connects through federation and synchronization. The source choice controls whether users authenticate with Google-managed accounts or with existing external accounts.
| Identity source | Where users and groups are managed | How users reach Google Cloud |
|---|---|---|
| Google Workspace or Cloud Identity | Users and groups are created in Cloud Identity or Google Workspace by a super administrator, with later synchronization to an external IdP if needed | Users authenticate with managed Cloud Identity or Google Workspace accounts |
| External IdP with Workforce Identity Federation | Users and groups are created in the external IdP and mapped to Google Cloud through a workforce identity pool | Users sign in with their existing external account through single sign-on, without a second Google-managed password |
Choose Cloud Identity management when Google is the authoritative directory. Choose federation when the external IdP must remain authoritative, using either directory synchronization with Google Cloud Directory Sync (GCDS) where each user has both an external and a Google account, or Workforce Identity Federation where each user keeps only the external account and the pool trusts the provider to assert identity.
The join-move-leave lifecycle stays accurate when membership updates originate in the authoritative directory and flow automatically to IAM. When an employee joins, moves teams, or leaves, an administrator adds or removes the user from the corresponding group rather than rewriting IAM allow policies on every project, bucket, or virtual machine. This dependency means the IAM policy depends on the group, and the group depends on the identity source, so stale access is removed by removing membership.
Connecting an external provider to Google Cloud follows an ordered setup that establishes that dependency:
Only after the pool, provider trust, and group mapping exist does sign-in and role inheritance work end to end.
Least-privilege role assignment means each administrative group receives only the minimum IAM roles needed for its function at the organization level, giving central visibility and control over all resources. The assignment must be performed by a super administrator or a user with the Organization Administrator role (roles/resourcemanager.organizationAdmin), and default assignments can be customized by adding roles, removing roles, or deleting unused groups. Group management permissions themselves are controlled by Google Workspace, not IAM, while viewing groups in the console requires Organization Viewer (roles/resourcemanager.organizationViewer).
gcp-organization-admins administers all organization resources and is assigned sparingly because it controls every resource in the organization.gcp-billing-admins sets up billing accounts and monitors usage with billing administration and organization viewing roles.gcp-network-admins creates Virtual Private Cloud networks, subnets, firewall rules, Cloud Router, Cloud VPN, and load balancers.gcp-security-admins establishes organization security policies, including access management and organization constraint policies.gcp-logging-monitoring-admins uses all Cloud Logging and Cloud Monitoring features, while gcp-logging-monitoring-viewers has read-only access to a subset of logs.gcp-developers designs, codes, and tests applications, while gcp-devops builds continuous integration and delivery pipelines and provisioning.Deleting a group is irreversible and immediately removes its role inheritance path, so all IAM roles must first be revoked from the group and deletion delayed at least 7 days to catch unexpected access changes. Service agents cannot be added to groups unless the external members option is turned on.
Automated membership still requires continuous governance to remove orphaned accounts and unused permissions when people change roles or leave. Policy Intelligence with the IAM recommender uses machine learning to identify accounts that no longer need access and to support least privilege, including REMOVE_ROLE recommendations and insights about unused permissions and abandoned service accounts. At enterprise scale, recommendations are exported through the BigQuery Data Transfer Service to a BigQuery dataset and queried for recommender = "google.iam.policy.Recommender" to rightsize role bindings across the organization. For accountability, Cloud Logging records identity lifecycle events, and Google Workspace audit logs for user creation and group membership changes appear in Cloud Logging when data sharing is enabled, with membership change history viewable by holders of Logs Viewer (roles/logging.viewer).
Choose Cloud Identity management when Google must centrally provision administrators and administrative groups for a verified domain, and choose Workforce Identity Federation when human resources or an external provider must remain the single source of truth and users should keep only one external account. In the Cloud Identity model users authenticate with managed Google accounts and receive access through group membership, while in the federation model users sign in with their existing external account through a workforce identity pool with no second Google account.
Identity and Access Management roles should be granted to Google Groups according to job role, never to individual user accounts, so adding or removing group membership grants and revokes access everywhere the group is used. Identity and Access Management evaluates the group as the principal so every member inherits the same permissions and removal from the group removes all of those permissions at once, which implements role-based access control and least privilege.
OS Login links virtual machine SSH authorized keys to the Google identity so removing the user automatically revokes virtual machine access instead of leaving metadata-based SSH keys behind, and authentication proxies for Cloud SQL and AlloyDB link database credentials to the Google identity so suspending the Cloud Identity or Google Workspace account revokes database access. Without this linkage a disabled user could retain access through long-lived keys or database passwords.
Identity and Access Management policy changes such as SetIamPolicy and service account creation are recorded in Admin Activity audit logs in Cloud Logging, which are always written and cannot be disabled, while Google group membership changes are recorded in Workspace Activity logs, not in the same IAM policy query. Exporting logs with a log sink to BigQuery enables long-term analysis, and Policy Analyzer and IAM recommender support periodic access certification and least-privilege reviews.
An enterprise integrates an external Identity Provider (IdP) with Google Cloud Identity for Single Sign-On (SSO) and enforces OS Login organization-wide for all Compute Engine instances. A security audit discovers that when departing employees are disabled in the external IdP, they can still establish SSH sessions to Linux VMs via OS Login.
How should the security team automate user lifecycle management to immediately revoke both Google Cloud console and OS Login SSH access upon employee departure?
Last updated