An organization is deploying an analytics microservice in Project A on Google Cloud Compute Engine that must query sensitive BigQuery datasets located in Project B. To comply with strict internal security policies, long-lived service account key export is explicitly forbidden, and privilege escalation risks must be minimized. The microservice needs to securely call BigQuery APIs under the identity of a designated workload service account created in Project B. Which configuration strategy fulfills these operational and security requirements while adhering to the principle of least privilege?
- Grant the service account attached to the Compute Engine instance in Project A the Service Account Token Creator role directly on the target workload service account in Project B, allowing it to generate short-lived OAuth2 access tokens via service account impersonation.Cevap
- BGrant the service account attached to the Compute Engine instance in Project A the Service Account Admin role across Project B so it can dynamically provision temporary service account keys on demand.
- CAssign the Editor primitive role at the Project B resource hierarchy level to the Compute Engine instance service account in Project A to enable cross-project API access.
- DExport a JSON service account key for the workload service account in Project B, encrypt the key file with Customer-Supplied Encryption Keys (CSEK), and store it on the Compute Engine boot disk.
Cevap
Grant the service account attached to the Compute Engine instance in Project A the Service Account Token Creator role directly on the target workload service account in Project B, allowing it to generate short-lived OAuth2 access tokens via service account impersonation.
The solution that grants the Service Account Token Creator role directly on the specific target service account enables keyless cross-project impersonation. It allows the microservice to obtain short-lived OAuth2 tokens securely while strictly honoring least privilege and avoiding service account key creation.
Adım Adım Çözüm
Anahtar Kavram
Cross-Project Service Account Impersonation and Token Creation