A healthcare analytics application runs on Compute Engine virtual machines inside a dedicated Google Cloud production folder. The application must run automated night jobs that query BigQuery datasets and write log entries to Cloud Logging. The security team mandates strict enforcement of least privilege while keeping administrative overhead minimal. Which IAM role configuration strategy should the Cloud Architect recommend?
- Attach a custom user-managed service account to the virtual machines, granting the service account the BigQuery Data Viewer role at the dataset scope and Logs Writer role at the project scope.Answer
- BAttach the default Compute Engine service account to the virtual machines with the primitive Editor role granted at the parent folder level.
- CGrant the application developers the Service Account Admin role across the production project so the virtual machines can automatically query BigQuery and write logs.
- DGrant BigQuery Data Viewer to all domain users at the organization level, relying strictly on IAM policies without isolating workload identities or restricting egress access.
Answer
Attach a dedicated user-managed service account to the virtual machines, granting least-privilege predefined roles (BigQuery Data Viewer on specific datasets and Logs Writer at the project level).
Attaching a user-managed service account with fine-grained predefined roles (BigQuery Data Viewer at dataset scope, Logs Writer at project scope) adheres directly to Google Cloud security best practices for workload identity and least privilege.
Step-by-Step Solution
Key Concept
Applying least privilege IAM roles to user-managed service accounts across Google Cloud resource hierarchy