An enterprise security policy mandates that an automated CI/CD pipeline executing on an external server must deploy Cloud Functions without using long-lived downloadable service account keys. The deployment script runs under an identity service account named [email protected]. A dedicated deployment service account named [email protected] has already been provisioned with the necessary Cloud Developer permissions. Which IAM configuration should the cloud engineer implement on func-deployer to allow cicd-runner to mint short-lived credential tokens under the principle of least privilege?
- Grant the Service Account Token Creator role (roles/iam.serviceAccountTokenCreator) to serviceAccount:[email protected] on the func-deployer service account resource.Cevap
- BGenerate a new JSON service account key for [email protected] and encode it into the CI/CD pipeline secrets repository.
- CGrant the Owner primitive role (roles/owner) to serviceAccount:[email protected] at the project resource level.
- DGrant the Service Account User role (roles/iam.serviceAccountUser) to serviceAccount:[email protected] across the entire Google Cloud organization.
Cevap
Grant the Service Account Token Creator role (roles/iam.serviceAccountTokenCreator) to serviceAccount:[email protected] on the func-deployer service account resource.
To allow one identity to generate short-lived tokens on behalf of another service account securely, Google Cloud IAM requires granting the Service Account Token Creator role (roles/iam.serviceAccountTokenCreator) on the specific target service account resource to the calling principal identity. This satisfies least-privilege access and avoids creating static JSON service account keys.
Adım Adım Çözüm
Anahtar Kavram
Service Account Impersonation and Short-Lived Credentials