# Effective Use of Google Cloud IAM Deny Policies for BigQuery Data Security

## Background

Recently, I assisted a customer who required protection for sensitive data in BigQuery, ensuring access was restricted to a small group of individuals. They wanted to prevent any accidental access by employees. To address this, I recommended using [Google Cloud IAM deny policies](https://cloud.google.com/iam/docs/deny-overview). These policies allow you to establish strict access controls on BigQuery resources by defining deny rules at the organisation level. This ensures that selected principals are prevented from using certain permissions, regardless of the roles they have been granted. I want to use a lab to show you how it works so you can apply this in your organization if you have similiar requirements.

## Lab

Grant your user `roles/iam.denyAdmin` role, or you get an error like the one below:

![](https://doitintl.zendesk.com/attachments/token/lxgv0dc0IXA49pbo17KrfOFLQ/?name=image.png align="left")

To grant the role, you need to do it at Organization level IAM:

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1759320043712/2898d7a5-43d4-4c2d-b2a2-80efdb07041c.png align="center")

Create a deny policy to block a group of users from accessing BigQuery data and creating BigQuery jobs:

![](https://doitintl.zendesk.com/attachments/token/2iexVdET8HUOUUeNY8zUMkCQH/?name=image.png align="left")

After being created, the policy looks like this:

![](https://doitintl.zendesk.com/attachments/token/ZN0c3tjVvfx3LFkrptNmpvWmk/?name=image.png align="left")

This policy means, users in `admins@googlegroups.com` cannot have these IAM permissions, therefore, they will not be able to create BigQuery jobs and view the data in the tables.

## Summary

In conclusion, securing sensitive data in BigQuery is crucial for organizations that handle confidential information. By implementing Google Cloud IAM deny policies, you can effectively restrict access to BigQuery resources, ensuring that only authorized individuals have the necessary permissions. This approach not only prevents accidental access by employees but also strengthens your organization's data security posture. By following the steps outlined in this guide, you can apply these practices to safeguard your data and maintain compliance with security standards.
