An enterprise security policy prohibits the use of downloadable JSON service account keys on developer workstations. A developer needs to run a local Python application that uses Google Cloud Client Libraries to query BigQuery tables in Project-B using a target service account (`[email protected]`).
Arrange the following operational steps in the correct chronological order to configure local credentials and execute the application using Google Cloud best practices for service account impersonation.
- 1Authenticate the developer's user identity to the Google Cloud CLI using `gcloud auth login`.
- 2Grant the developer's user identity the Service Account Token Creator role (`roles/iam.serviceAccountTokenCreator`) on `[email protected]`.
- 3Generate local Application Default Credentials (ADC) configured with impersonation using `gcloud auth application-default login --impersonate-service-account=sa-b@project-b.iam.gserviceaccount.com`.
- 4Execute the Python application utilizing the standard Google Cloud Client Library for BigQuery.
Cevap
The correct workflow starts by authenticating the developer's identity with gcloud auth login, granting the Service Account Token Creator role on the target service account, initializing Application Default Credentials (ADC) with the service account impersonation flag, and finally executing the Python SDK application.
Proper setup of programmatic GCP interaction using service account impersonation requires authenticating the user identity first, delegating token creation privileges via roles/iam.serviceAccountTokenCreator on the target service account, generating impersonated Application Default Credentials locally, and finally running the SDK code which seamlessly picks up the ADC credentials.
Adım Adım Çözüm
Anahtar Kavram
Service account impersonation and Application Default Credentials (ADC) configuration