An application deployed on a Compute Engine virtual machine in a Google Cloud project named `payments-service-prod` requires access to database credentials stored in Secret Manager. The application's service account must be able to read secret payload values at runtime to establish database connections. To meet strict enterprise security guidelines, the service account must not be granted permissions to modify secrets, create new secrets, or access resources in any other projects. Which IAM role binding strategy adheres to the principle of least privilege while fulfilling these requirements?
- Grant the service account the Secret Manager Secret Accessor role (roles/secretmanager.secretAccessor) resource binding on the payments-service-prod project.Answer
- BGrant the service account the primitive Viewer role (roles/viewer) resource binding on the payments-service-prod project.
- CGrant the service account the Secret Manager Secret Accessor role (roles/secretmanager.secretAccessor) resource binding at the parent Folder level containing payments-service-prod.
- DGrant the service account the Secret Manager Admin role (roles/secretmanager.admin) resource binding on the payments-service-prod project.
Answer
Grant the application service account the predefined Secret Manager Secret Accessor role (`roles/secretmanager.secretAccessor`) bound specifically at the project level (`payments-service-prod`).
The Secret Manager Secret Accessor role (`roles/secretmanager.secretAccessor`) provides the exact permission (`secretmanager.versions.access`) required to retrieve secret payload values. Binding this role specifically at the project resource level ensures access is limited to secrets inside `payments-service-prod` without over-granting permissions or broad inheritance across sibling projects.
Step-by-Step Solution
Key Concept
Principle of Least Privilege with Predefined IAM Roles and Hierarchy Scoping
Estimated Time:2m 0s