Question

Difficulty: MediumManaging IAM Roles and Permissions

A cloud administrator needs to grant a development team access to view Pub/Sub topic details and inspect Cloud Monitoring metrics within a single Google Cloud project named `pubsub-prod-data`. The team must not have permission to publish messages, modify resources, or access other projects within the parent folder. To comply with the principle of least privilege, which TWO IAM role assignments should you configure? (Select TWO.)

  1. Assign the Pub/Sub Viewer (`roles/pubsub.viewer`) role to the development group on the `pubsub-prod-data` project.Answer
  2. Assign the Monitoring Viewer (`roles/monitoring.viewer`) role to the development group on the `pubsub-prod-data` project.Answer
  3. C
    Assign the Editor (`roles/editor`) role to the development group on the `pubsub-prod-data` project.
  4. D
    Assign the Pub/Sub Viewer (`roles/pubsub.viewer`) role to the development group at the parent Folder level.

Answer

Assign the Pub/Sub Viewer (`roles/pubsub.viewer`) role and the Monitoring Viewer (`roles/monitoring.viewer`) role to the development group directly on the `pubsub-prod-data` project.
The principle of least privilege requires assigning fine-grained predefined roles at the lowest necessary level of the resource hierarchy. Assigning Pub/Sub Viewer and Monitoring Viewer directly on the specific project grants exactly the required read-only permissions for Pub/Sub resources and Monitoring metrics without exposing other projects in the folder or enabling resource modification.

Step-by-Step Solution

1
Identify the required permissions and target scope
Target scope is strictly the `pubsub-prod-data` project. Required capabilities are viewing Pub/Sub resources and inspecting Cloud Monitoring metrics.
Applying roles directly at the project level prevents inherited permissions on other projects within the parent folder.
2
Select predefined roles according to the principle of least privilege
Select `roles/pubsub.viewer` for Pub/Sub read access and `roles/monitoring.viewer` for metrics inspection.
Predefined roles grant only the specific permissions needed for tasks, whereas primitive roles (like Editor) grant overly broad permissions.

Key Concept

Applying principle of least privilege using predefined roles at the appropriate resource hierarchy scope
Rate this question