A data analyst needs to execute SQL queries in BigQuery and read table contents within a specific dataset named `sales_data` inside the `corp-analytics-prod` project. Following Google Cloud best practices for least privilege, the analyst must not be able to modify any data or access other datasets within the project. Which IAM role assignment strategy should be implemented?
- Grant the BigQuery Job User role (roles/bigquery.jobUser) at the project level and the BigQuery Data Viewer role (roles/bigquery.dataViewer) at the dataset level.Answer
- BGrant the Editor primitive role (roles/editor) at the project level.
- CGrant the BigQuery Admin role (roles/bigquery.admin) at the project level and explicitly deny access to all other datasets.
- DGrant the Billing Account User role (roles/billing.user) at the billing account level to authorize query computation.
Answer
Grant the BigQuery Job User role (roles/bigquery.jobUser) at the project level and the BigQuery Data Viewer role (roles/bigquery.dataViewer) at the dataset level.
To execute BigQuery queries, a user needs the project-level permission `bigquery.jobs.create`, provided by `roles/bigquery.jobUser`. To read data strictly within a specific dataset without accessing others in the project, `roles/bigquery.dataViewer` must be granted at the dataset level. This combination satisfies least-privilege requirements.
Step-by-Step Solution
Key Concept
Applying Least-Privilege IAM Roles for BigQuery Access Across Resource Hierarchy Levels