Question

Difficulty: MediumConfiguring Service Account Impersonation and Workload Identity

An organization enforces a strict security directive prohibiting the creation and export of static service account JSON keys. A automated pipeline executing under a source service account `[email protected]` in Project-A must deploy compute resources into Project-B by impersonating a target service account `[email protected]`. Which two IAM configuration actions must be performed to enable this secure impersonation workflow following Google Cloud security best practices? (Select TWO.)

  1. Grant the Service Account Token Creator role (roles/iam.serviceAccountTokenCreator) to [email protected] on the [email protected] service account resource.Answer
  2. Grant the target service account [email protected] the necessary compute deployment permissions within Project-B.Answer
  3. C
    Generate and download a private JSON key for [email protected] and mount it directly into the Project-A deployment pipeline.
  4. D
    Grant the primitive Owner role (roles/owner) to [email protected] across Project-A and Project-B.

Answer

Granting the Service Account Token Creator role (roles/iam.serviceAccountTokenCreator) to the source service account on the target service account resource, and granting the target service account the necessary resource deployment permissions within Project-B.
To establish keyless cross-project impersonation, the calling service account must be given the Service Account Token Creator role (roles/iam.serviceAccountTokenCreator) directly on the target service account resource. Additionally, the target service account must be assigned specific predefined IAM roles in the destination project so it can perform the intended deployment tasks upon being impersonated.

Step-by-Step Solution

1
Configure impersonation permissions on the target service account.
The source service account `[email protected]` is granted `roles/iam.serviceAccountTokenCreator` binding on `[email protected]`.
This permission allows the source service account to generate short-lived credentials for the target identity without needing private keys.
2
Configure deployment authorization in the destination project.
The target service account `[email protected]` receives predefined compute deployment roles in Project-B.
Operations executed via impersonation inherit the IAM permissions of the target service account inside the destination environment.

Key Concept

Service Account Impersonation requires granting the Service Account Token Creator role to the caller on the target service account resource.
Rate this question