A financial services company runs a batch data processing pipeline on Compute Engine virtual machines using a workload service account named [email protected]. The pipeline requires short-lived authorization to perform operations against Cloud Storage buckets in a separate data project, acting as the target service account [email protected]. Corporate governance explicitly forbids creating and downloading service account JSON keys. Which IAM role assignment adheres to the principle of least privilege to grant app-worker permission to impersonate storage-mgr?
- AGrant [email protected] the Service Account User role (roles/iam.serviceAccountUser) on [email protected].
- Grant [email protected] the Service Account Token Creator role (roles/iam.serviceAccountTokenCreator) on [email protected].Answer
- CCreate a downloadable service account JSON key for [email protected] and store it in Secret Manager for app-worker to fetch at runtime.
- DGrant [email protected] the primitive Owner role (roles/owner) on the target project proj-data.
Answer
Grant [email protected] the Service Account Token Creator role (roles/iam.serviceAccountTokenCreator) on [email protected].
To allow a principal (such as a source service account) to impersonate a target service account and generate short-lived OAuth 2.0 tokens, the principal must be granted the Service Account Token Creator role (roles/iam.serviceAccountTokenCreator) on the target service account resource. Binding this role directly on the target identity enforces the principle of least privilege while complying with keyless security mandates.
Step-by-Step Solution
Key Concept
Service Account Impersonation via Service Account Token Creator Role