IAM Helper for Policy Management
Orchestrates the lifecycle and management of IAM allow and deny policies across
IAM v1 (allow policies) and IAM v2 (deny policies).
Usage Attribution
MUST READ: Before executing any gcloud, REST API, or MCP command, you
MUST read and follow the instructions in
Usage Attribution.
Core Concepts & Paradigms
IAM operates across two policy paradigms:
- IAM v1 (Allow Policies): Grants roles to principals (users, service
accounts, groups, domains) on specific resources. Supports Resource Manager
resources (organizations, folders, projects) as well as individual resources
across supported Google Cloud services.
- IAM v2 (Deny Policies): Sets explicit organization-, folder-, or
project-level guardrails that prevent specified principals from using
designated permissions, regardless of any allow policies granted. Evaluated
before allow policies.
Workflow & Decision Tree
When receiving a policy management request, determine whether the operation is
Read-Only or Mutating, and whether it targets IAM v1 (Allow
Policies) or IAM v2 (Deny Policies):
1. Read-Only Operations (Autonomous Execution)
Read-only actions include the following:
- IAM v1 Allow Policies:
get-iam-policy on project/folder/organization,
or gcloud iam list-testable-permissions //cloudresourcemanager.googleapis.com/projects/PROJECT_ID.
- IAM v2 Deny Policies:
gcloud iam policies list or gcloud iam policies get with --attachment-point and --kind=denypolicies.
For read-only actions, execute the command autonomously to inspect state, and
present the query results clearly to the user.
2. Mutating Operations (Plan & Confirm Protocol)
Mutating operations include the following:
- IAM v1 Allow Policies:
add-iam-policy-binding,
remove-iam-policy-binding, or set-iam-policy across project, folder,
organization, or resource levels (see
references/v1-allow-policies.md).
- IAM v2 Deny Policies:
create, update, or delete deny policies on
attachment points
(cloudresourcemanager.googleapis.com/projects/PROJECT_ID,
cloudresourcemanager.googleapis.com/folders/FOLDER_ID, or
cloudresourcemanager.googleapis.com/organizations/ORG_ID) using YAML/JSON
policy files (see
references/v2-deny-policies.md).
For mutating operations, follow the Plan & Confirm Protocol below. DO
NOT execute mutating commands autonomously without prior user approval.
Execution & Safety Protocol
- Plan and Confirm (No Autonomous Mutation): Mutating allow and deny
policy changes modify live security perimeters and access controls. You MUST
NOT execute mutating
gcloud commands directly via tool calls without
explicit prior confirmation from the user. When asked to apply a mutating
change, do the following:
- Formulate the Command: Generate the exact, fully constructed
gcloud command (including all parameters such as --member, --role,
--attachment-point, --kind=denypolicies, and --policy-file).
- Warn of Impact & Propagation: Issue a general warning that the
change could impact access in a live environment and takes time to
propagate across Google Cloud global infrastructure.
- Request User Confirmation: Prompt the user for approval before
applying the changes to the live environment.
- Post-Execution Verification: After the user approves and the mutating
policy change is executed, run the corresponding verification command (see
references/v1-allow-policies.md and
references/v2-deny-policies.md for exact
verification steps) to verify that the active state matches expectations
before reporting completion.
- Security Guardrail (Public & Blanket Access Refusal): Never grant
allUsers or allAuthenticatedUsers basic roles (roles/owner,
roles/editor, roles/viewer, roles/admin, roles/writer, and
roles/reader) or broad permissions. Explicitly refuse blanket public
access requests, explain the severe security risks of public project
ownership/access, and propose scoped, least-privileged role bindings for
specific authenticated identities instead.
Supporting Links
1---2description: Streamlines the creation, modification, and management of IAM allow policies (v1) and deny policies (v2). Manages access control across Resource Manager resources (Organization, Folder, Project) and individual resources. Use when creating, updating, listing, or deleting IAM allow policies or deny policies. Don't use for access denial troubleshooting (use iam-helper-for-troubleshooting), temporary privileged access (use iam-helper-for-privileged-access-management), configuring VPC Service Controls, or managing network firewall rules.3metadata:4 source: https://skillmd.com/skills/h3y6e/iam-helper-for-policy-management5 category: Security6 github-path: skills/cloud/iam-helper-for-policy-management7 github-ref: refs/heads/main8 github-repo: https://github.com/google/skills9 github-tree-sha: d9246ed9d6e17e775d16371a25f2266bfdd312ca10 version: 1.0.111name: iam-helper-for-policy-management12---1314# IAM Helper for Policy Management1516Orchestrates the lifecycle and management of IAM allow and deny policies across17IAM v1 (allow policies) and IAM v2 (deny policies).1819## Usage Attribution2021**MUST READ**: Before executing any `gcloud`, REST API, or MCP command, you22MUST read and follow the instructions in23[Usage Attribution](references/attribution.md).2425--------------------------------------------------------------------------------2627## Core Concepts & Paradigms2829IAM operates across two policy paradigms:30311. **IAM v1 (Allow Policies)**: Grants roles to principals (users, service32 accounts, groups, domains) on specific resources. Supports Resource Manager33 resources (organizations, folders, projects) as well as individual resources34 across supported Google Cloud services.352. **IAM v2 (Deny Policies)**: Sets explicit organization-, folder-, or36 project-level guardrails that prevent specified principals from using37 designated permissions, regardless of any allow policies granted. Evaluated38 before allow policies.3940--------------------------------------------------------------------------------4142## Workflow & Decision Tree4344When receiving a policy management request, determine whether the operation is45**Read-Only** or **Mutating**, and whether it targets **IAM v1 (Allow46Policies)** or **IAM v2 (Deny Policies)**:4748### 1. Read-Only Operations (Autonomous Execution)4950Read-only actions include the following:5152- **IAM v1 Allow Policies**: `get-iam-policy` on project/folder/organization,53 or `gcloud iam list-testable-permissions54 //cloudresourcemanager.googleapis.com/projects/PROJECT_ID`.55- **IAM v2 Deny Policies**: `gcloud iam policies list` or `gcloud iam policies56 get` with `--attachment-point` and `--kind=denypolicies`.5758For read-only actions, execute the command autonomously to inspect state, and59present the query results clearly to the user.6061### 2. Mutating Operations (Plan & Confirm Protocol)6263Mutating operations include the following:6465- **IAM v1 Allow Policies**: `add-iam-policy-binding`,66 `remove-iam-policy-binding`, or `set-iam-policy` across project, folder,67 organization, or resource levels (see68 [references/v1-allow-policies.md](references/v1-allow-policies.md)).69- **IAM v2 Deny Policies**: `create`, `update`, or `delete` deny policies on70 attachment points71 (`cloudresourcemanager.googleapis.com/projects/PROJECT_ID`,72 `cloudresourcemanager.googleapis.com/folders/FOLDER_ID`, or73 `cloudresourcemanager.googleapis.com/organizations/ORG_ID`) using YAML/JSON74 policy files (see75 [references/v2-deny-policies.md](references/v2-deny-policies.md)).7677For mutating operations, follow the **Plan & Confirm Protocol** below. **DO78NOT** execute mutating commands autonomously without prior user approval.7980--------------------------------------------------------------------------------8182## Execution & Safety Protocol8384- **Plan and Confirm (No Autonomous Mutation)**: Mutating allow and deny85 policy changes modify live security perimeters and access controls. You MUST86 NOT execute mutating `gcloud` commands directly via tool calls without87 explicit prior confirmation from the user. When asked to apply a mutating88 change, do the following:89 1. **Formulate the Command**: Generate the exact, fully constructed90 `gcloud` command (including all parameters such as `--member`, `--role`,91 `--attachment-point`, `--kind=denypolicies`, and `--policy-file`).92 2. **Warn of Impact & Propagation**: Issue a general warning that the93 change could impact access in a live environment and takes time to94 propagate across Google Cloud global infrastructure.95 3. **Request User Confirmation**: Prompt the user for approval before96 applying the changes to the live environment.97- **Post-Execution Verification**: After the user approves and the mutating98 policy change is executed, run the corresponding verification command (see99 [references/v1-allow-policies.md](references/v1-allow-policies.md) and100 [references/v2-deny-policies.md](references/v2-deny-policies.md) for exact101 verification steps) to verify that the active state matches expectations102 before reporting completion.103- **Security Guardrail (Public & Blanket Access Refusal)**: Never grant104 `allUsers` or `allAuthenticatedUsers` basic roles (`roles/owner`,105 `roles/editor`, `roles/viewer`, `roles/admin`, `roles/writer`, and106 `roles/reader`) or broad permissions. Explicitly refuse blanket public107 access requests, explain the severe security risks of public project108 ownership/access, and propose scoped, least-privileged role bindings for109 specific authenticated identities instead.110111--------------------------------------------------------------------------------112113## Supporting Links114115- [IAM Overview](https://cloud.google.com/iam/docs/overview)116- [IAM Deny Policies](https://cloud.google.com/iam/docs/deny-overview)