1
---
2
name: iam-helper-for-policy-management
3
description: >-
4
Streamlines the creation, modification, and management of IAM allow policies
5
(v1) and deny policies (v2). Manages access control across Resource Manager
6
resources (Organization, Folder, Project) and individual resources. Use when
7
creating, updating, listing, or deleting IAM allow policies or deny policies.
8
Don't use for access denial troubleshooting (use
9
iam-helper-for-troubleshooting), temporary privileged access (use
10
iam-helper-for-privileged-access-management), configuring VPC Service
11
Controls, or managing network firewall rules.
12
metadata:
13
version: "1.0.1"
14
category: Security
15
---
16
17
# IAM Helper for Policy Management
18
19
Orchestrates the lifecycle and management of IAM allow and deny policies across
20
IAM v1 (allow policies) and IAM v2 (deny policies).
21
22
## Usage Attribution
23
24
**MUST READ**: Before executing any `gcloud`, REST API, or MCP command, you
25
MUST read and follow the instructions in
26
[Usage Attribution](references/attribution.md).
27
28
--------------------------------------------------------------------------------
29
30
## Core Concepts & Paradigms
31
32
IAM operates across two policy paradigms:
33
34
1. **IAM v1 (Allow Policies)**: Grants roles to principals (users, service
35
accounts, groups, domains) on specific resources. Supports Resource Manager
36
resources (organizations, folders, projects) as well as individual resources
37
across supported Google Cloud services.
38
2. **IAM v2 (Deny Policies)**: Sets explicit organization-, folder-, or
39
project-level guardrails that prevent specified principals from using
40
designated permissions, regardless of any allow policies granted. Evaluated
41
before allow policies.
42
43
--------------------------------------------------------------------------------
44
45
## Workflow & Decision Tree
46
47
When receiving a policy management request, determine whether the operation is
48
**Read-Only** or **Mutating**, and whether it targets **IAM v1 (Allow
49
Policies)** or **IAM v2 (Deny Policies)**:
50
51
### 1. Read-Only Operations (Autonomous Execution)
52
53
Read-only actions include the following:
54
55
- **IAM v1 Allow Policies**: `get-iam-policy` on project/folder/organization,
56
or `gcloud iam list-testable-permissions
57
//cloudresourcemanager.googleapis.com/projects/PROJECT_ID`.
58
- **IAM v2 Deny Policies**: `gcloud iam policies list` or `gcloud iam policies
59
get` with `--attachment-point` and `--kind=denypolicies`.
60
61
For read-only actions, execute the command autonomously to inspect state, and
62
present the query results clearly to the user.
63
64
### 2. Mutating Operations (Plan & Confirm Protocol)
65
66
Mutating operations include the following:
67
68
- **IAM v1 Allow Policies**: `add-iam-policy-binding`,
69
`remove-iam-policy-binding`, or `set-iam-policy` across project, folder,
70
organization, or resource levels (see
71
[references/v1-allow-policies.md](references/v1-allow-policies.md)).
72
- **IAM v2 Deny Policies**: `create`, `update`, or `delete` deny policies on
73
attachment points
74
(`cloudresourcemanager.googleapis.com/projects/PROJECT_ID`,
75
`cloudresourcemanager.googleapis.com/folders/FOLDER_ID`, or
76
`cloudresourcemanager.googleapis.com/organizations/ORG_ID`) using YAML/JSON
77
policy files (see
78
[references/v2-deny-policies.md](references/v2-deny-policies.md)).
79
80
For mutating operations, follow the **Plan & Confirm Protocol** below. **DO
81
NOT** execute mutating commands autonomously without prior user approval.
82
83
--------------------------------------------------------------------------------
84
85
## Execution & Safety Protocol
86
87
- **Plan and Confirm (No Autonomous Mutation)**: Mutating allow and deny
88
policy changes modify live security perimeters and access controls. You MUST
89
NOT execute mutating `gcloud` commands directly via tool calls without
90
explicit prior confirmation from the user. When asked to apply a mutating
91
change, do the following:
92
1. **Formulate the Command**: Generate the exact, fully constructed
93
`gcloud` command (including all parameters such as `--member`, `--role`,
94
`--attachment-point`, `--kind=denypolicies`, and `--policy-file`).
95
2. **Warn of Impact & Propagation**: Issue a general warning that the
96
change could impact access in a live environment and takes time to
97
propagate across Google Cloud global infrastructure.
98
3. **Request User Confirmation**: Prompt the user for approval before
99
applying the changes to the live environment.
100
- **Post-Execution Verification**: After the user approves and the mutating
101
policy change is executed, run the corresponding verification command (see
102
[references/v1-allow-policies.md](references/v1-allow-policies.md) and
103
[references/v2-deny-policies.md](references/v2-deny-policies.md) for exact
104
verification steps) to verify that the active state matches expectations
105
before reporting completion.
106
- **Security Guardrail (Public & Blanket Access Refusal)**: Never grant
107
`allUsers` or `allAuthenticatedUsers` basic roles (`roles/owner`,
108
`roles/editor`, `roles/viewer`, `roles/admin`, `roles/writer`, and
109
`roles/reader`) or broad permissions. Explicitly refuse blanket public
110
access requests, explain the severe security risks of public project
111
ownership/access, and propose scoped, least-privileged role bindings for
112
specific authenticated identities instead.
113
114
--------------------------------------------------------------------------------
115
116
## Supporting Links
117
118
- [IAM Overview](https://cloud.google.com/iam/docs/overview)
119
- [IAM Deny Policies](https://cloud.google.com/iam/docs/deny-overview)
120