A developer needs to run a local database migration script that connects to a Google Cloud resource using a dedicated service account, `[email protected]`. To follow security policies that strictly prohibit saving service account JSON keys on local workstations, the cloud administrator wants to grant the developer permission to perform service account impersonation using the gcloud CLI.
Which IAM role must be assigned to the developer's user account on the target service account to allow short-lived identity impersonation?
- Service Account Token Creator (`roles/iam.serviceAccountTokenCreator`)Answer
- BService Account User (`roles/iam.serviceAccountUser`)
- CService Account Key Admin (`roles/iam.serviceAccountKeyAdmin`) to generate and download a JSON key file
- DViewer (`roles/viewer`) at the project resource level
Answer
Assign the Service Account Token Creator role (`roles/iam.serviceAccountTokenCreator`) to the developer's user identity on the target service account.
To impersonate a service account and mint short-lived tokens via gcloud CLI or APIs, the initiating identity requires the Service Account Token Creator role (`roles/iam.serviceAccountTokenCreator`) on the target service account. This allows keyless authorization without exporting JSON keys.
Step-by-Step Solution
Key Concept
Configuring Service Account Impersonation using Service Account Token Creator role