Prepare and test your skills
Prepare and test your skills
Free sample question, answered and explained below. The Professional Cloud Security Engineer practice bank has 1,343 more like it. Try 10 free: instant score, no account.
A security engineer needs to configure access for an engineer (developer@example.com) who must generate short-lived OAuth 2.0 access tokens to impersonate a specific deployment service account (deploy-prod@example-proj.iam.gserviceaccount.com) from their local environment. The project contains multiple sensitive service accounts used by critical infrastructure.
To uphold the principle of least privilege and prevent unintentional privilege escalation, how should the security engineer grant the necessary access?
roles/iam.serviceAccountUser) to developer@example.com directly on the deploy-prod@example-proj.iam.gserviceaccount.com service account resource.The Service Account User role (roles/iam.serviceAccountUser) allows a principal to attach a service account to managed compute resources (such as Compute Engine instances, Cloud Run services, Cloud Functions, or Dataflow jobs) so that the resource executes workloads under that service account identity.
roles/iam.serviceAccountUser alone does not grant permissions (iam.serviceAccounts.getAccessToken or iam.serviceAccounts.signJwt) to generate short-lived OAuth 2.0 access tokens via the IAM Credentials API.roles/iam.serviceAccountUser): Authorizes a principal to configure workloads to run as the service account (indirect execution).roles/iam.serviceAccountTokenCreator): Authorizes a principal to directly generate tokens and impersonate the service account via API calls.The requirement was to allow the engineer to launch a Compute Engine virtual machine or submit a Dataflow pipeline configured to run as deploy-prod@example-proj.iam.gserviceaccount.com.
roles/iam.serviceAccountTokenCreator) to developer@example.com at the project level.Granting roles/iam.serviceAccountTokenCreator at the project level creates an IAM allow policy binding on the project resource itself. Because IAM permissions are inherited hierarchically by all child resources, this grants the user the ability to generate short-lived tokens for every service account in that project.
roles/owner or roles/resourcemanager.organizationAdmin), the engineer would automatically gain the ability to impersonate that account, resulting in unintended privilege escalation.The organization intended for a centralized identity broker or senior security administrator to have universal authority to impersonate and mint credentials for every service account throughout the entire project.
roles/iam.serviceAccountUser) to developer@example.com at the project level.Granting the Service Account User role (roles/iam.serviceAccountUser) at the project level allows a principal to attach any service account within the project to Google Cloud resources, such as Compute Engine instances or Cloud Run services.
roles/iam.serviceAccountUser does not include the ability to generate OAuth 2.0 access tokens or mint OIDC tokens for direct API impersonation.A developer required broad administrative privileges across a development sandbox to attach any project service account to virtual machines, Dataflow pipelines, and compute resources.
roles/iam.serviceAccountTokenCreator) to developer@example.com directly on the deploy-prod@example-proj.iam.gserviceaccount.com service account resource.The Service Account Token Creator role (roles/iam.serviceAccountTokenCreator) grants principals the permissions necessary to generate short-lived credentials for a service account, including OAuth 2.0 access tokens, OIDC ID tokens, and signed JSON Web Tokens (JWTs). This enables direct credential generation and service account impersonation without relying on long-lived service account private keys.
roles/iam.serviceAccountTokenCreator, the engineer can programmatically request short-lived access tokens to authenticate API calls and run deployment workflows as the service account.deploy-prod@example-proj.iam.gserviceaccount.com) restricts impersonation capabilities strictly to that single identity. It prevents the principal from impersonating other sensitive or higher-privileged service accounts within the same project.Applying the role at the resource level (on the specific service account allow policy) rather than at the project level ensures strict isolation. It enables the engineer to execute their deployment duties without risking unauthorized privilege escalation across other service accounts residing in the project.
Answer them yourself and get your score the moment you finish. No account needed.
Full access includes
Keep the momentum going with these hand-picked practice scenarios
Last updated Validated