How to Configure Bigquery Restrict Access to Dataset

Published
Length
3 min read

Luis Felipe Dias

All posts

You can set up a bigquery restrict access to dataset rule using cloud identity roles. This setup controls which users and apps can read or write tables inside one dataset. Cloud teams often assign broad project roles during early development phases. Those broad roles let any member read every table across the whole cloud project. Moving permissions down to the dataset level stops wide data exposure across your team. How to set up bigquery restrict access to dataset rules Cloud permissions wo

Your coding agents run with your access.

Claude Code reaches prod with a developer's credentials, and approval prompts get clicked through. hoop.dev checks every query, masks sensitive data, and holds risky changes for a human.

You can set up a bigquery restrict access to dataset rule using cloud identity roles. This setup controls which users and apps can read or write tables inside one dataset.

Cloud teams often assign broad project roles during early development phases. Those broad roles let any member read every table across the whole cloud project. Moving permissions down to the dataset level stops wide data exposure across your team.

How to set up bigquery restrict access to dataset rules

Cloud permissions work from the top down in a strict tree structure. Roles set at the folder or project level flow down to every dataset inside. To limit a user to one dataset, you must remove their project-wide data roles first.

Start by listing all users, groups, and service accounts with project-level read or admin rights. Remove general data viewer or editor roles from the main project level. Leave only basic job runner roles at the project level so users can run queries. Running a query takes compute rights at the project level plus read rights on the dataset.

Next, grant data viewer or data editor roles directly on the target dataset itself. Always assign these dataset roles to team groups instead of single user emails. Group assignments make it easy to add or remove staff as roles change.

You can also use authorized views when teams only need part of a dataset. Put the view in a separate dataset and share only that new dataset with the group. The source dataset trusts the view to read raw tables without exposing them to the user. Safe defaults mean every new dataset starts with zero wide group permissions attached.

How to check permissions and audit open sessions

After you update dataset roles, you must check that the new rules work right. Test the setup with a test account that belongs to the restricted team group. Try to query the allowed dataset first to confirm that normal work still runs fine. Then try to query a blocked dataset in the same project to confirm it fails.

Customer Support Access to Production + BigQuery IAM: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

You should also check cloud audit logs to see who reads each dataset each day. Audit logs show the user identity, the query text, and the target tables read. Reviewing these logs helps you find unused permissions that you can remove safely.

Still, static dataset roles leave major gaps once a user logs into an active session. If a dataset holds emails, phone numbers, or card numbers, a viewer gets every raw value. Static dataset rules apply the same way to human tools, scripts, and AI agents.

A valid role lets a user run a huge export query at any hour. Dataset roles also remain active forever unless an admin remembers to revoke them by hand. Teams often need runtime controls that inspect queries and rewrite sensitive fields in results.

Managing service accounts and automated apps

Automated apps and data pipelines also need tight dataset permissions to stay safe. Many teams share one service account key across several different apps and scripts. If that single key leaks, an attacker can read every dataset tied to that account.

Create one unique service account for each app or pipeline in your project. Grant each service account access only to the exact dataset it needs for its job. If an app only reads data, never give its account write or admin rights. Rotate credentials often and remove old accounts when you shut down legacy apps.

Govern statements and responses across databases and APIs

Good config and scoped roles are needed setup. They do not check single queries in flight or mask sensitive fields in returned rows. Across Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes APIs, SSH, and internal HTTP endpoints, hoop.dev runs beside each supported service as an open-source proxy, a sidecar for your database or API.

First, hoop.dev guardrails block banned queries before they run. Then hoop.dev data masking rewrites matched sensitive values in responses in memory. The audit trail records every statement and verdict per resource. Furthermore, hoop.dev holds SOC 2 Type II and is open source on GitHub.

Frequently asked questions

Why can a user still read a dataset after I remove them from it?

The user likely holds a broader role at the project or folder level. Cloud permissions flow downward, so project roles override missing dataset roles until you remove them.

How do users run queries if they only have dataset viewer roles?

Dataset viewer roles only let a user read table data inside that specific dataset. You must also grant a basic job user role on the project to run queries.

Can I restrict access to specific sensitive columns inside an allowed dataset?

Dataset roles apply to every table and column inside that dataset at once. To protect specific fields like national IDs, you need column tags or runtime masking rules.

The query runs. The emails stay hidden.