A DevOps engineer needs to grant a third-party monitoring service account access to inspect Cloud Pub/Sub topic and subscription configurations within project `proj-telemetry-prod`. The service account must not be granted permissions to publish or acknowledge message content, nor should it have access to unrelated resources in the project. Which IAM role assignment adheres to the principle of least privilege?
- Grant the Cloud Pub/Sub Viewer (`roles/pubsub.viewer`) role on project `proj-telemetry-prod`.Cevap
- BGrant the Viewer (`roles/viewer`) primitive role on project `proj-telemetry-prod`.
- CGrant the Cloud Pub/Sub Viewer (`roles/pubsub.viewer`) role at the Organization level.
- DGrant the Editor (`roles/editor`) primitive role on project `proj-telemetry-prod`.
Cevap
Granting the Cloud Pub/Sub Viewer (`roles/pubsub.viewer`) role on project `proj-telemetry-prod` adheres to the principle of least privilege by scope-limiting access to the target project and granting only necessary resource metadata read permissions.
The Cloud Pub/Sub Viewer (`roles/pubsub.viewer`) role provides permissions to inspect topics and subscriptions without allowing message data payload access or permissions on other GCP services, perfectly matching the project-scoped least-privilege requirement.
Adım Adım Çözüm
Anahtar Kavram
Principle of Least Privilege and Resource Hierarchy Scope in IAM