Conditional and tag-based access control uses Google Cloud's resource hierarchy to make permissions dynamic and precise. The final, or effective, policy for any resource combines the rules set on it directly with all the rules it inherits from its parents (organization, folders, and projects). By using IAM Conditions and Resource Manager tags, you can create security rules that change based on what a resource is or its context, going beyond simple role assignments.
IAM Conditions are extra rules you add to a role binding that only grant the permissions when specific criteria are true. These criteria can check resource attributes like the resource's name, type, or service. For example, you could write a condition so a role only works on Compute Engine VMs whose names start with "dev-". This lets you follow the principle of least privilege across your whole cloud setup, because permissions are turned on only when needed, not given out broadly all the time. The system checks these conditions in real-time when someone tries to do something, allowing for very fine control.
Resource Manager tags are simple key-value labels you attach to resources, like VMs or storage buckets, to categorize them. A key feature is that a tag you put on a parent resource, like a folder, is automatically inherited by all the child resources inside it. You can then write IAM Conditions that check for the presence or value of these tags. For instance, you could create a condition like resource.matchTag('123456789012/environment', 'production') to make sure only certain users can access production-tagged resources. This gives you a consistent and scalable way to enforce rules based on business needs—like environment, cost center, or compliance—throughout your entire resource tree.
When you design these conditional role bindings, you must think carefully about policy inheritance. A condition you set at a high level, like the organization, will affect every resource below it unless you set a different rule lower down. You can structure conditions to be either restrictive (blocking access unless a tag is present) or permissive (allowing access only if a tag is present). You can also mix tag checks with other factors like the time of day or the user's network. To manage these bindings, you need specific IAM roles, and you must be aware of how they interact with custom roles.
To use this model well, follow these practices: use a single organization node as your root for central control, create standard naming rules for your tags, and keep shared services in separate projects from your workload projects. You should also review high-risk IAM changes using Cloud Audit Logs. For advanced control, you can use tags to apply organization policies only to resources with specific tags. This lets you manage rules from the center but still make exceptions, ensuring security and compliance controls work dynamically across complex environments.
Access control in Google Cloud works through IAM allow policies and IAM deny policies attached across the resource hierarchy. Allow policies work by adding permissions, while deny policies act as strict blocks. Each resource node (organization, folder, project) can have many deny policies. Knowing how these work together helps administrators enforce least-privilege and stop unwanted access.
Both allow and deny policies inherit down the hierarchy, from organizations to folders, projects, and child resources. When someone tries to do something, the system always checks deny policies before allow policies. Because deny policies override allow policies, if a deny rule matches, the action is blocked immediately. This means a permission granted at a lower project level cannot bypass a deny rule that came from a parent folder or organization.
Administrators write deny rules inside deny policies to create precise boundaries. These rules have specific parts to target access:
By using exceptions and tag-based conditions, you can stop bad actions on important resources without having to copy role bindings everywhere.
The Organization Policy Service adds another layer of control by applying constraints across the hierarchy. While IAM deny policies focus on what specific people can do, organization policies restrict how services and resources can behave. For example, a constraint can disable automatic permissions for default service accounts, which removes a common source of over-privileged access. Together, hierarchical deny rules and organization constraints make sure that inherited permissions cannot lead to accidental, escalated privileges.
IAM policy inheritance is how access permissions flow down Google Cloud's resource hierarchy. This hierarchy goes from the Organization at the top, to Folders, then Projects, and finally to individual Resources like VMs or buckets. When you set a policy at a higher level, it automatically applies to all the children below—this is policy inheritance. For instance, granting someone the Editor role at the Organization level gives them Editor access to every folder, project, and resource inside it, unless you stop it somewhere lower.
Permissions are additive, meaning access granted at a parent level adds to the access a user has at child levels. This creates a cumulative effect where a high-level grant can give a user wide-reaching access. Understanding this is key for least-privilege security, because giving broad access high up can accidentally give users more power than they need on specific, sensitive resources. Security teams must check if access granted at the organization or folder is truly right for all the projects and resources below it.
Deny policies are the tool to block permissions even when an allow policy would grant them. Deny policies explicitly stop principals from using certain permissions and they override allow policies. Like allow policies, deny policies can be attached to organizations, folders, or projects and are inherited downward. For example, if a user gets the Service Account Admin role at the organization level, but a deny policy at a project blocks the permission to create service accounts, the user cannot create them in that specific project—the deny wins.
To figure out a user's effective permissions on a resource, you must add up all the allow policies from every level (organization, folder, project, resource) and then subtract any permissions blocked by deny policies. Google Cloud provides tools like the Policy Simulator to help analyze this. When planning access, security teams should use these tools to verify that a grant at a parent level doesn't accidentally give too much access at a child level, ensuring users only get the minimum access they need.
Professional Cloud Security Engineer
Gauge your current knowledge
Gauge your current knowledge