Prepare and test your skills
Prepare and test your skills
Free sample question, answered and explained below. The Professional Cloud DevOps Engineer practice bank has 1,455 more like it. Try 10 free: instant score, no account.
Your enterprise organization is establishing a secure operational framework for service account usage across its development teams. You must configure IAM permissions to support two distinct operational requirements while strictly enforcing the principle of least privilege:
devops-leads@example.com) must be able to impersonate a production deployment service account (prod-deployer@project-id.iam.gserviceaccount.com) from the Google Cloud CLI to obtain short-lived OAuth 2.0 access tokens for emergency rollouts without managing static keys.app-devs@example.com) must be able to provision Compute Engine virtual machines that run workloads under a dedicated workload service account (app-runner@project-id.iam.gserviceaccount.com), but they must not be permitted to directly generate credentials or mint tokens for this workload service account from their local workstations.Which IAM role bindings should you configure?
roles/iam.serviceAccountAdmin to group:devops-leads@example.com on prod-deployer, and grant roles/iam.serviceAccountOpenIdTokenCreator to group:app-devs@example.com on app-runner.This configuration assigns administrative lifecycle management permissions to devops-leads and OpenID Connect (OIDC) token creation permissions to app-devs.
roles/iam.serviceAccountAdmin) allows principals to create, update, list, and delete service accounts. It does not include iam.serviceAccounts.getAccessToken to generate short-lived OAuth 2.0 access tokens for operational impersonation.roles/iam.serviceAccountOpenIdTokenCreator) contains iam.serviceAccounts.getOpenIdToken. It does not contain iam.serviceAccounts.actAs, which is strictly required to attach a service account to a Compute Engine instance.roles/iam.serviceAccountAdmin manages the metadata and lifecycle of the account rather than data-plane authentication.roles/iam.serviceAccountOpenIdTokenCreator creates ID tokens rather than granting permission to attach the identity to infrastructure.DevOps leads needed to manage and delete service account definitions, while application developers needed to generate OIDC JWTs for authenticating to Cloud Run services.
roles/iam.serviceAccountUser to group:devops-leads@example.com on prod-deployer, and grant roles/iam.serviceAccountTokenCreator to group:app-devs@example.com on app-runner.This configuration inverts the assignment of the Service Account User (roles/iam.serviceAccountUser) and Service Account Token Creator (roles/iam.serviceAccountTokenCreator) roles between the two target service accounts.
roles/iam.serviceAccountUser role only provides the iam.serviceAccounts.actAs permission (along with view permissions). It does not grant iam.serviceAccounts.getAccessToken. Consequently, the devops-leads group cannot generate short-lived access tokens or use gcloud impersonation commands for prod-deployer.roles/iam.serviceAccountTokenCreator to app-devs on app-runner allows them to generate access tokens and mint credentials directly from their workstations. This violates the explicit restriction against local token generation. Additionally, without iam.serviceAccounts.actAs, developers cannot attach app-runner to new Compute Engine instances.iam.serviceAccounts.actAs versus iam.serviceAccounts.getAccessToken.The DevOps leads only needed to attach prod-deployer to automated pipeline runners, and application developers required local workstation token generation for API testing.
roles/iam.serviceAccountTokenCreator and roles/iam.serviceAccountUser to both groups at the Google Cloud project level.This option grants both the Service Account Token Creator and Service Account User roles to all engineers across the entire Google Cloud project.
roles/iam.serviceAccountTokenCreator project-wide gives app-devs the authority to mint access tokens for app-runner (and all other project service accounts) from their workstations, directly violating the requirement to prohibit direct local token generation.All service accounts in the project required uniform, unrestricted access by all team members and granular isolation between workload types was not necessary.
roles/iam.serviceAccountTokenCreator to group:devops-leads@example.com on prod-deployer, and grant roles/iam.serviceAccountUser to group:app-devs@example.com on app-runner.This configuration leverages resource-level IAM role bindings to grant specific, scoped capabilities to each group on individual service accounts, avoiding broader project-level over-permissioning.
roles/iam.serviceAccountTokenCreator) contains the iam.serviceAccounts.getAccessToken permission. Granting this role directly on prod-deployer@project-id.iam.gserviceaccount.com allows devops-leads@example.com to use the --impersonate-service-account flag in gcloud or call the IAM Credentials API to generate short-lived OAuth 2.0 tokens without exposing long-lived service account keys.roles/iam.serviceAccountUser) grants the iam.serviceAccounts.actAs permission. Binding this role to app-devs@example.com on app-runner@project-id.iam.gserviceaccount.com allows developers to attach the service account to compute resources (such as Compute Engine instances). It deliberately does not include token generation permissions (iam.serviceAccounts.getAccessToken), preventing developers from minting tokens to impersonate the service account directly from their workstations.actAs) from the ability to mint credentials interactively (getAccessToken).generateAccessToken and actions utilizing iam.serviceAccounts.actAs generate Cloud Audit Logs identifying both the caller and the target service account.Granting roles at the individual service account resource level rather than the project level minimizes the blast radius. Binding roles/iam.serviceAccountTokenCreator and roles/iam.serviceAccountUser to their respective targets precisely satisfies operational needs without creating privilege escalation paths.
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