An analytics team needs to grant access to an automated reporting tool's service account. The service account must execute SQL query jobs in the project `proj-analytics-prod` and read table data exclusively from a specific BigQuery dataset named `ds_finance`. Following the principle of least privilege, which combination of IAM role assignments should you configure?
- Grant `roles/bigquery.jobUser` on the project `proj-analytics-prod`, and grant `roles/bigquery.dataViewer` on the `ds_finance` dataset.Answer
- BGrant `roles/editor` on the project `proj-analytics-prod`.
- CGrant `roles/bigquery.admin` at the parent Folder level containing `proj-analytics-prod`.
- DGrant `roles/bigquery.dataViewer` on the project `proj-analytics-prod`, and grant `roles/bigquery.jobUser` on the `ds_finance` dataset.
Answer
Grant `roles/bigquery.jobUser` at the project level (`proj-analytics-prod`) and `roles/bigquery.dataViewer` at the specific dataset level (`ds_finance`).
Executing BigQuery SQL queries requires the permission to create jobs in the designated project, which is provided by the predefined role BigQuery Job User (`roles/bigquery.jobUser`) bound at the project level. To restrict data access exclusively to `ds_finance`, the BigQuery Data Viewer role (`roles/bigquery.dataViewer`) must be assigned directly on the dataset resource itself rather than the project.
Step-by-Step Solution
Key Concept
Fine-Grained BigQuery IAM Resource Scoping