IAM Helper for Privileged Access Management

IAM Helper for Privileged Access Management

Manages on-demand temporary access in Google Cloud Privileged Access Manager: creating entitlements, requesting elevation and approving grants, with a plan-validate-execute flow.

Skill files7 files

assets/

references/

scripts/

SKILL.md323 lines
1
---
2
name: iam-helper-for-privileged-access-management
3
metadata:
4
version: "1.0.2"
5
category: Security
6
description: >-
7
Manages the end-to-end lifecycle of on-demand, temporary access using
8
Privileged Access Manager (PAM). Use when a user asks to create, read,
9
update, or delete PAM entitlements, request temporary access, or
10
approve/deny pending PAM grants. Do NOT use for permanent IAM policy
11
bindings, troubleshooting IAM permission errors, or general Google Cloud
12
resource provisioning.
13
---
14
15
# Privileged Access Manager (PAM)
16
17
This skill provides step-by-step guidance for planning, validating, and
18
executing Privileged Access Manager (PAM) entitlement CRUD operations, approval
19
workflow configurations, access elevations, and grant approval/denial workflows.
20
21
## Usage Attribution
22
23
**MUST READ**: Before executing any `gcloud`, REST API, or MCP command, you
24
MUST read and follow the instructions in
25
[Usage Attribution](references/attribution.md).
26
27
## Table of Contents
28
29
* [Core Concepts](#core-concepts)
30
* [Approval Workflows & Max Request Duration](#approval-workflows)
31
* [Safety & Confirmation Strategy](#safety-confirmation)
32
* [Plan-Validate-Execute Pattern](#plan-validate-execute)
33
* [Mode 1: Interactive Access Elevation](#mode-1)
34
* [Mode 2: Standalone Entitlement CRUD](#mode-2)
35
* [Mode 3: Approver Workflow](#mode-3)
36
* [Supporting Links & Resources](#supporting-links)
37
38
## Core Concepts {#core-concepts}
39
40
Privileged Access Manager (PAM) replaces permanent or ambient IAM role
41
assignments with on-demand, time-bound, and audited access elevations. Rather than
42
appending permanent IAM policy bindings, PAM uses:
43
44
* **Entitlements:** Configurations defining access scopes, eligible
45
requesters, and approvers.
46
* **Grants:** Short-lived requests created against entitlements to activate
47
the entitlement's IAM roles.
48
49
### Privileged Access (`privilegedAccess`)
50
51
The `privilegedAccess` block in an entitlement defines the precise access scope that will be granted. An access scope comprises three essential components:
52
* **Resource:** The target Google Cloud resource (Project, Folder, or Organization) where access is granted.
53
* **Role Setup:** The IAM role (`roleBindings.role`) to be assigned.
54
* **Condition:** (Optional) An IAM condition expression (`roleBindings.conditionExpression`) restricting when or where the role applies.
55
56
### Core Workflow
57
58
1. Administrators create Entitlements.
59
2. Requesters can then request Grants against these entitlements.
60
3. If the entitlement is configured with approvals, then an approver must
61
approve the requested grant.
62
4. Once all necessary approval steps are completed, the grant is activated for
63
the requested time.
64
5. The grant automatically ends after the requested duration has elapsed, and
65
the elevated access is removed.
66
67
## Approval Workflows & Max Request Duration {#approval-workflows}
68
69
### Approval Workflows (`approvalWorkflow`)
70
71
When sensitive environments require human approval before temporary access is
72
activated, configure the `approvalWorkflow` block in the entitlement YAML
73
manifest (`entitlement.yaml`).
74
75
```yaml
76
approvalWorkflow:
77
manualApprovals:
78
# Optional: requires approver to supply a justification string
79
requireApproverJustification: true
80
steps:
81
- approvalsNeeded: 1
82
approverEmailRecipients:
83
- approver@example.com
84
approvers:
85
- principals:
86
- user:db-lead@my-company.com # or group:sre-leads@my-company.com
87
```
88
89
* **When to include:** Include `approvalWorkflow` whenever the user prompt
90
specifies that manual approval or an approver (user or group) is required.
91
* **Outcome:** When a user requests a grant against an entitlement
92
with `approvalWorkflow`, the grant transitions to `APPROVAL_AWAITED`.
93
Requesters must await an Approver's decision (`Mode 3`).
94
95
### Max Request Duration (`maxRequestDuration`)
96
97
`maxRequestDuration` defines the maximum single access elevation timeframe a requester
98
may ask for when placing a grant request.
99
100
* **Flexible Configuration:** Configure `maxRequestDuration` according to the
101
user's specific request (e.g. `8 hours` / `28800s`, `1 hour` / `3600s`, `24
102
hours` / `86400s`).
103
* **Default Value:** If the user does NOT specify a maximum request duration,
104
default to `4 hours` (`14400s`).
105
* **YAML Syntax:** Always format `maxRequestDuration` as a string in seconds
106
in the entitlement YAML (e.g., `"14400s"`, `"28800s"`).
107
108
## Safety & Confirmation Strategy {#safety-confirmation}
109
110
Adhere strictly to these workflow guards:
111
112
* **Modifying / Destructive Executions (Create, Update, Delete, Approve, Deny, Revoke):** Always
113
present a plain-text summary of the planned adjustments and prompt the user
114
for explicit confirmation (Yes/No).
115
* **Read-Only Inspections (List, Describe, Search):** Run autonomously without
116
requesting confirmation.
117
* **Batching Bash Commands (Reduce User Confirmations):** The host environment
118
requires user approval for every individual shell tool call. To minimize
119
confirmation popups, combine sequential read-only and lookup commands into a
120
single compound bash script within one tool call (e.g., combining project,
121
folder, and organization hierarchy audits into a single multiline
122
execution).
123
* **Anti-Loop Strategy:** If a command fails with a clear, actionable error,
124
you may attempt to self-debug and retry. If the error is ambiguous, halt
125
immediately, present the stderr output, and await user direction.
126
127
## Plan-Validate-Execute Pattern {#plan-validate-execute}
128
129
For all modifying actions (Mode 1 Step 3, Mode 2 Create, Update, Delete, Mode 3 Approve, Deny):
130
131
1. **Plan:** Construct the proposed parameters or read the sample entitlement
132
structure. (For entitlement creation, load and use the template:
133
[assets/entitlement_template.yaml](assets/entitlement_template.yaml)).
134
2. **Validate:** Inspect the target configuration parameters (resource names,
135
role bindings, duration limits) for compliance with corporate rules.
136
3. **Execute:** Present the validated plan, obtain explicit user confirmation,
137
and run the `gcloud` command.
138
139
--------------------------------------------------------------------------------
140
141
## Mode 1: Interactive Access Elevation {#mode-1}
142
143
When the user requests temporary access elevation as a Requester, load and
144
follow the detailed instructions in
145
[`references/requester.md`](references/requester.md).
146
147
--------------------------------------------------------------------------------
148
149
## Mode 2: Standalone Entitlement CRUD {#mode-2}
150
151
Follow these steps for entitlement configurations.
152
153
### Required Permissions for Entitlement Admins
154
155
* `roles/privilegedaccessmanager.admin`: Required to create, update, and
156
delete entitlement configurations (`Mode 2 CRUD`).
157
* **Scope IAM Admin Rights:** Required on the target hierarchy scope because
158
creating an entitlement authorizes future role evaluations and bindings on
159
that scope:
160
* **Organizations:** `roles/iam.securityAdmin`
161
* **Folders:** `roles/resourcemanager.folderAdmin`
162
* **Projects:** `roles/resourcemanager.projectIamAdmin`
163
* `roles/privilegedaccessmanager.viewer`: Required to list and describe
164
entitlements across scopes.
165
166
*(Rule: For all Standalone Entitlement CRUD commands below, use the flag
167
matching where the entitlement is defined: pass `--project=PROJECT_ID`,
168
`--folder=FOLDER_ID`, or `--organization=ORGANIZATION_ID`).*
169
170
### 1. Create Entitlement
171
172
1. Check if `ENTITLEMENT_ID` exists:
173
174
```bash
175
gcloud pam entitlements describe ENTITLEMENT_ID \
176
--location=global \
177
--project=PROJECT_ID
178
```
179
180
* **If Exists:** Halt. Ask: *"The requested PAM Entitlement `ENTITLEMENT_ID`
181
already exists. Would you like to view its details or update it instead?
182
(View / Update / Exit)"*
183
* **If NOT_FOUND:** Load the template
184
[assets/entitlement_template.yaml](assets/entitlement_template.yaml).
185
Generate IDs in lowercase using hyphen separators derived from the role name
186
(e.g., `compute-admin` for `roles/compute.admin`). **Note:**
187
* You may specify multiple IAM roles under `roleBindings`.
188
* You may also include an optional IAM `conditionExpression` for each role binding.
189
* Legacy basic roles (e.g., `roles/viewer`, `roles/editor`, `roles/owner`)
190
are NOT supported. Instead, use the basic roles (`roles/reader`,
191
`roles/writer`, `roles/admin`). Ensure you select a valid predefined,
192
custom, or basic role.
193
* Set `maxRequestDuration` based on user specification (e.g. `"28800s"` for 8
194
hours, `"3600s"` for 1 hour). If unspecified by the user, default to
195
`"14400s"` (4 hours). If manual approval is specified by policy or requested
196
by the user, configure the `approvalWorkflow` block in `entitlement.yaml`.
197
Preserve `requesterJustificationConfig: {unstructured: {}}`.
198
* Prompt: *"You are about to create the PAM Entitlement `ENTITLEMENT_ID`. Do
199
you approve this creation? (Yes/No)"*
200
* Deploy:
201
202
```bash
203
gcloud pam entitlements create ENTITLEMENT_ID \
204
--location=global \
205
--entitlement-file=entitlement.yaml \
206
--project=PROJECT_ID
207
```
208
209
### 2. Read Entitlements
210
211
Run these read operations autonomously:
212
213
List all entitlements at a single scope:
214
215
```bash
216
gcloud pam entitlements list \
217
--location=global \
218
--project=PROJECT_ID
219
```
220
221
To list all entitlements defined across the entire resource hierarchy (project, ancestor folders, and organization), use the hierarchy listing script:
222
223
```bash
224
bash scripts/list_entitlements_hierarchy.sh --project=PROJECT_ID
225
```
226
*(Or pass `--folder=FOLDER_ID` or `--organization=ORGANIZATION_ID`).*
227
228
Describe target entitlement:
229
230
```bash
231
gcloud pam entitlements describe ENTITLEMENT_ID \
232
--location=global \
233
--project=PROJECT_ID
234
```
235
236
### 3. Update Entitlement
237
238
1. Run the `export` command to generate the current config (which includes the `etag`):
239
240
```bash
241
gcloud pam entitlements export ENTITLEMENT_ID \
242
--location=global \
243
--project=PROJECT_ID > {scratch}/updated_entitlement.yaml
244
```
245
246
If missing, offer to run `list` or exit.
247
248
2. Edit the exported `{scratch}/updated_entitlement.yaml` file to apply the requested changes (e.g., updating
249
`maxRequestDuration`, `approvalWorkflow`, or `eligibleUsers`). Do not alter the `etag`.
250
251
3. Prompt: *"You are about to update the PAM Entitlement `ENTITLEMENT_ID`. Do
252
you approve this update? (Yes/No)"*
253
254
4. Execute:
255
256
```bash
257
gcloud pam entitlements update ENTITLEMENT_ID \
258
--location=global \
259
--entitlement-file={scratch}/updated_entitlement.yaml \
260
--project=PROJECT_ID
261
```
262
263
### 4. Delete Entitlement
264
265
1. Verify existence using `describe`. If missing, offer list/exit.
266
2. **Safety Check:** An entitlement cannot be deleted if there are open grants.
267
Before deleting, search for any `ACTIVE` or `SCHEDULED` grants:
268
269
```bash
270
gcloud pam grants list \
271
--entitlement=ENTITLEMENT_ID \
272
--location=global \
273
--project=PROJECT_ID \
274
--filter="state:(ACTIVE, SCHEDULED)"
275
```
276
277
If any open grants are found, prompt the user for permission to revoke them: *"There are active or scheduled grants on this entitlement. Do you authorize me to revoke them so the entitlement can be deleted? (Yes/No)"*
278
279
If Yes, revoke them:
280
281
```bash
282
gcloud pam grants revoke GRANT_ID \
283
--entitlement=ENTITLEMENT_ID \
284
--location=global \
285
--project=PROJECT_ID \
286
--reason="Revoking to delete entitlement"
287
```
288
289
3. Prompt: *"You are about to permanently delete the PAM Entitlement
290
`ENTITLEMENT_ID`. Do you approve this deletion? (Yes/No)"*
291
292
4. Execute:
293
294
```bash
295
gcloud pam entitlements delete ENTITLEMENT_ID \
296
--location=global \
297
--project=PROJECT_ID
298
```
299
300
--------------------------------------------------------------------------------
301
302
## Mode 3: Approver Workflow {#mode-3}
303
304
When an Approver needs to review, approve, or reject pending grant requests,
305
load and follow the detailed instructions in
306
[`references/approver.md`](references/approver.md).
307
308
--------------------------------------------------------------------------------
309
310
## Supporting Links & Resources {#supporting-links}
311
312
For further information on working with Privileged Access Manager, refer to:
313
314
* [Google Cloud Privileged Access Manager Overview][pam-overview]
315
* [Setting up PAM Entitlements][pam-create]
316
* [Requesting and auditing PAM Grants][pam-grants]
317
* [gcloud SDK pam Reference Guide][pam-gcloud]
318
319
[pam-overview]: https://cloud.google.com/iam/docs/pam-overview
320
[pam-create]: https://cloud.google.com/iam/docs/pam-create-entitlements
321
[pam-grants]: https://cloud.google.com/iam/docs/pam-request-temporary-elevated-access
322
[pam-gcloud]: https://cloud.google.com/sdk/gcloud/reference/pam
323

© Google LLC · Apache 2.0 · source · posted by @OpenSourceBuffGuy on promptparty.com

@OpenSourceBuffGuy

I find openly licensed prompts and post them here.

0 followers · 6,373 prompts

More by @OpenSourceBuffGuy

See all
Website Clone Architect prompt image

Website Clone Architect

Reverse-engineers a website section by section, writes component specs, and hands them to parallel builder agents in git worktrees to rebuild it.

agent-skill, orchestrator, parallel-agents, multi-agent, plan-then-execute, web-development, frontend, codebase-analysis, scaffolding, css, html, nextjs, typescript, git, mcp, claude-code, for-developers, for-designers, long-form, advanced, technical-spec, task-decomposition, structured-output, design-systems, ui-ux, tool-use, checklist, report, vibe-coding

Italian Terrace Cafe Candid Portrait prompt image

Italian Terrace Cafe Candid Portrait

Generates a photorealistic candid shot of a woman in a white corset dress laughing at a sunny hotel terrace cafe, written as detailed JSON.

image-prompt, json-prompt, structured-output, photorealistic, portrait, woman, candid, fashion, cottagecore, natural-light, golden-hour, bokeh, summer, travel, cityscape, mountains, medium-shot, vibrant-colors, for-photographers, nano-banana, fashion-shoot, luxury

Night Street Photo With Leashed Cat prompt image

Night Street Photo With Leashed Cat

Generates a flash-lit night street photo of a blonde woman in a retro track jacket walking a hissing tabby cat on a leash.

image-prompt, json-prompt, nano-banana, structured-output, portrait, woman, animals, pet-portrait, night-scene, street-photography, candid, editorial, fashion, dramatic-lighting, photorealistic, vertical-format, medium-shot, graffiti, for-photographers, for-content-creators

1 view

Reviews

Loading reviews…

Discussion

Loading comments…