A DevOps engineer needs to configure a local development workstation to run Python scripts that interact programmatically with Cloud Storage APIs using short-lived credentials via Service Account Impersonation. Corporate security policy strictly prohibits downloading JSON service account keys to local workstations. Place the operational steps in the correct chronological order to configure Application Default Credentials (ADC) with service account impersonation.
- 1Authenticate the developer's human user identity to Google Cloud using `gcloud auth login`.
- 2Grant the Service Account Token Creator role (`roles/iam.serviceAccountTokenCreator`) on the target service account to the developer's user identity.
- 3Run `gcloud auth application-default login --impersonate-service-account=[SA_NAME]@[PROJECT_ID].iam.gserviceaccount.com`.
- 4Execute the application using standard Google Cloud Client Libraries without setting `GOOGLE_APPLICATION_CREDENTIALS` to a key file.
Cevap
The correct sequence for configuring service account impersonation for Application Default Credentials (ADC) is: 1) Authenticate user identity via `gcloud auth login`, 2) Grant the Service Account Token Creator role to the user identity on the target service account, 3) Generate impersonated ADC using `gcloud auth application-default login --impersonate-service-account=...`, and 4) Run the code using standard Google Cloud Client Libraries.
The sequence follows the standard IAM lifecycle for keyless developer access: first establish user identity, grant necessary IAM permissions (`roles/iam.serviceAccountTokenCreator`), configure local ADC for impersonation via the gcloud CLI flag, and finally launch the application code which seamlessly consumes ADC.
Adım Adım Çözüm
Anahtar Kavram
Service Account Impersonation with Application Default Credentials (ADC)
Tahmini Süre:1m 30s