{"data":{"slug":"github-google-skills-skills-cloud-iam-helper-for-privileged-access-management-822085968fea","title":"Manage Privileged Access Manager (PAM) Entitlements and Grants","summary":"Create and configure PAM entitlements with approval workflows, request temporary access through PAM grants, approve or deny pending grant requests, and configure max request duration for access elevations. The deliverable is temporary, time-bound access elevation with audit tracking.","url":"https:\/\/skillshunter.net\/skills\/github-google-skills-skills-cloud-iam-helper-for-privileged-access-management-822085968fea","json_url":"https:\/\/skillshunter.net\/api\/public\/v1\/skills\/github-google-skills-skills-cloud-iam-helper-for-privileged-access-management-822085968fea","markdown_url":"https:\/\/skillshunter.net\/skills\/github-google-skills-skills-cloud-iam-helper-for-privileged-access-management-822085968fea.md","download_url":"https:\/\/skillshunter.net\/skills\/github-google-skills-skills-cloud-iam-helper-for-privileged-access-management-822085968fea\/download","category":{"slug":"software-development","name":"Software & Development"},"editor_note":"Before executing any `gcloud`, REST API, or MCP command, you MUST read and follow the instructions in [Usage Attribution](references\/attribution.md).","instructions":"---\nname: iam-helper-for-privileged-access-management\nmetadata:\n  version: \"1.0.2\"\n  category: Security\ndescription: >-\n  Manages the end-to-end lifecycle of on-demand, temporary access using\n  Privileged Access Manager (PAM). Use when a user asks to create, read,\n  update, or delete PAM entitlements, request temporary access, or\n  approve\/deny pending PAM grants. Do NOT use for permanent IAM policy\n  bindings, troubleshooting IAM permission errors, or general Google Cloud\n  resource provisioning.\n---\n\n# Privileged Access Manager (PAM)\n\nThis skill provides step-by-step guidance for planning, validating, and\nexecuting Privileged Access Manager (PAM) entitlement CRUD operations, approval\nworkflow configurations, access elevations, and grant approval\/denial workflows.\n\n## Usage Attribution\n\n**MUST READ**: Before executing any `gcloud`, REST API, or MCP command, you\nMUST read and follow the instructions in\n[Usage Attribution](references\/attribution.md).\n\n## Table of Contents\n\n*   [Core Concepts](#core-concepts)\n*   [Approval Workflows & Max Request Duration](#approval-workflows)\n*   [Safety & Confirmation Strategy](#safety-confirmation)\n*   [Plan-Validate-Execute Pattern](#plan-validate-execute)\n*   [Mode 1: Interactive Access Elevation](#mode-1)\n*   [Mode 2: Standalone Entitlement CRUD](#mode-2)\n*   [Mode 3: Approver Workflow](#mode-3)\n*   [Supporting Links & Resources](#supporting-links)\n\n## Core Concepts {#core-concepts}\n\nPrivileged Access Manager (PAM) replaces permanent or ambient IAM role\nassignments with on-demand, time-bound, and audited access elevations. Rather than\nappending permanent IAM policy bindings, PAM uses:\n\n*   **Entitlements:** Configurations defining access scopes, eligible\n    requesters, and approvers.\n*   **Grants:** Short-lived requests created against entitlements to activate\n    the entitlement's IAM roles.\n\n### Privileged Access (`privilegedAccess`)\n\nThe `privilegedAccess` block in an entitlement defines the precise access scope that will be granted. An access scope comprises three essential components:\n*   **Resource:** The target Google Cloud resource (Project, Folder, or Organization) where access is granted.\n*   **Role Setup:** The IAM role (`roleBindings.role`) to be assigned.\n*   **Condition:** (Optional) An IAM condition expression (`roleBindings.conditionExpression`) restricting when or where the role applies.\n\n### Core Workflow\n\n1.  Administrators create Entitlements.\n2.  Requesters can then request Grants against these entitlements.\n3.  If the entitlement is configured with approvals, then an approver must\n    approve the requested grant.\n4.  Once all necessary approval steps are completed, the grant is activated for\n    the requested time.\n5.  The grant automatically ends after the requested duration has elapsed, and\n    the elevated access is removed.\n\n## Approval Workflows & Max Request Duration {#approval-workflows}\n\n### Approval Workflows (`approvalWorkflow`)\n\nWhen sensitive environments require human approval before temporary access is\nactivated, configure the `approvalWorkflow` block in the entitlement YAML\nmanifest (`entitlement.yaml`).\n\n```yaml\napprovalWorkflow:\n  manualApprovals:\n    # Optional: requires approver to supply a justification string\n    requireApproverJustification: true\n    steps:\n    - approvalsNeeded: 1\n      approverEmailRecipients:\n      - approver@example.com\n      approvers:\n      - principals:\n        - user:db-lead@my-company.com  # or group:sre-leads@my-company.com\n```\n\n*   **When to include:** Include `approvalWorkflow` whenever the user prompt\n    specifies that manual approval or an approver (user or group) is required.\n*   **Outcome:** When a user requests a grant against an entitlement\n    with `approvalWorkflow`, the grant transitions to `APPROVAL_AWAITED`.\n    Requesters must await an Approver's decision (`Mode 3`).\n\n### Max Request Duration (`maxRequestDuration`)\n\n`maxRequestDuration` defines the maximum single access elevation timeframe a requester\nmay ask for when placing a grant request.\n\n*   **Flexible Configuration:** Configure `maxRequestDuration` according to the\n    user's specific request (e.g. `8 hours` \/ `28800s`, `1 hour` \/ `3600s`, `24\n    hours` \/ `86400s`).\n*   **Default Value:** If the user does NOT specify a maximum request duration,\n    default to `4 hours` (`14400s`).\n*   **YAML Syntax:** Always format `maxRequestDuration` as a string in seconds\n    in the entitlement YAML (e.g., `\"14400s\"`, `\"28800s\"`).\n\n## Safety & Confirmation Strategy {#safety-confirmation}\n\nAdhere strictly to these workflow guards:\n\n*   **Modifying \/ Destructive Executions (Create, Update, Delete, Approve, Deny, Revoke):** Always\n    present a plain-text summary of the planned adjustments and prompt the user\n    for explicit confirmation (Yes\/No).\n*   **Read-Only Inspections (List, Describe, Search):** Run autonomously without\n    requesting confirmation.\n*   **Batching Bash Commands (Reduce User Confirmations):** The host environment\n    requires user approval for every individual shell tool call. To minimize\n    confirmation popups, combine sequential read-only and lookup commands into a\n    single compound bash script within one tool call (e.g., combining project,\n    folder, and organization hierarchy audits into a single multiline\n    execution).\n*   **Anti-Loop Strategy:** If a command fails with a clear, actionable error,\n    you may attempt to self-debug and retry. If the error is ambiguous, halt\n    immediately, present the stderr output, and await user direction.\n\n## Plan-Validate-Execute Pattern {#plan-validate-execute}\n\nFor all modifying actions (Mode 1 Step 3, Mode 2 Create, Update, Delete, Mode 3 Approve, Deny):\n\n1.  **Plan:** Construct the proposed parameters or read the sample entitlement\n    structure. (For entitlement creation, load and use the template:\n    [assets\/entitlement_template.yaml](assets\/entitlement_template.yaml)).\n2.  **Validate:** Inspect the target configuration parameters (resource names,\n    role bindings, duration limits) for compliance with corporate rules.\n3.  **Execute:** Present the validated plan, obtain explicit user confirmation,\n    and run the `gcloud` command.\n\n--------------------------------------------------------------------------------\n\n## Mode 1: Interactive Access Elevation {#mode-1}\n\nWhen the user requests temporary access elevation as a Requester, load and\nfollow the detailed instructions in\n[`references\/requester.md`](references\/requester.md).\n\n--------------------------------------------------------------------------------\n\n## Mode 2: Standalone Entitlement CRUD {#mode-2}\n\nFollow these steps for entitlement configurations.\n\n### Required Permissions for Entitlement Admins\n\n*   `roles\/privilegedaccessmanager.admin`: Required to create, update, and\n    delete entitlement configurations (`Mode 2 CRUD`).\n*   **Scope IAM Admin Rights:** Required on the target hierarchy scope because\n    creating an entitlement authorizes future role evaluations and bindings on\n    that scope:\n    *   **Organizations:** `roles\/iam.securityAdmin`\n    *   **Folders:** `roles\/resourcemanager.folderAdmin`\n    *   **Projects:** `roles\/resourcemanager.projectIamAdmin`\n*   `roles\/privilegedaccessmanager.viewer`: Required to list and describe\n    entitlements across scopes.\n\n*(Rule: For all Standalone Entitlement CRUD commands below, use the flag\nmatching where the entitlement is defined: pass `--project=PROJECT_ID`,\n`--folder=FOLDER_ID`, or `--organization=ORGANIZATION_ID`).*\n\n### 1. Create Entitlement\n\n1.  Check if `ENTITLEMENT_ID` exists:\n\n```bash\ngcloud pam entitlements describe ENTITLEMENT_ID \\\n    --location=global \\\n    --project=PROJECT_ID\n```\n\n*   **If Exists:** Halt. Ask: *\"The requested PAM Entitlement `ENTITLEMENT_ID`\n    already exists. Would you like to view its details or update it instead?\n    (View \/ Update \/ Exit)\"*\n*   **If NOT_FOUND:** Load the template\n    [assets\/entitlement_template.yaml](assets\/entitlement_template.yaml).\n    Generate IDs in lowercase using hyphen separators derived from the role name\n    (e.g., `compute-admin` for `roles\/compute.admin`). **Note:**\n    *   You may specify multiple IAM roles under `roleBindings`.\n    *   You may also include an optional IAM `conditionExpression` for each role binding.\n    *   Legacy basic roles (e.g., `roles\/viewer`, `roles\/editor`, `roles\/owner`)\n        are NOT supported. Instead, use the basic roles (`roles\/reader`,\n        `roles\/writer`, `roles\/admin`). Ensure you select a valid predefined,\n        custom, or basic role.\n*   Set `maxRequestDuration` based on user specification (e.g. `\"28800s\"` for 8\n    hours, `\"3600s\"` for 1 hour). If unspecified by the user, default to\n    `\"14400s\"` (4 hours). If manual approval is specified by policy or requested\n    by the user, configure the `approvalWorkflow` block in `entitlement.yaml`.\n    Preserve `requesterJustificationConfig: {unstructured: {}}`.\n*   Prompt: *\"You are about to create the PAM Entitlement `ENTITLEMENT_ID`. Do\n    you approve this creation? (Yes\/No)\"*\n*   Deploy:\n\n```bash\ngcloud pam entitlements create ENTITLEMENT_ID \\\n    --location=global \\\n    --entitlement-file=entitlement.yaml \\\n    --project=PROJECT_ID\n```\n\n### 2. Read Entitlements\n\nRun these read operations autonomously:\n\nList all entitlements at a single scope:\n\n```bash\ngcloud pam entitlements list \\\n    --location=global \\\n    --project=PROJECT_ID\n```\n\nTo list all entitlements defined across the entire resource hierarchy (project, ancestor folders, and organization), use the hierarchy listing script:\n\n```bash\nbash scripts\/list_entitlements_hierarchy.sh --project=PROJECT_ID\n```\n*(Or pass `--folder=FOLDER_ID` or `--organization=ORGANIZATION_ID`).*\n\nDescribe target entitlement:\n\n```bash\ngcloud pam entitlements describe ENTITLEMENT_ID \\\n    --location=global \\\n    --project=PROJECT_ID\n```\n\n### 3. Update Entitlement\n\n1.  Run the `export` command to generate the current config (which includes the `etag`):\n\n    ```bash\n    gcloud pam entitlements export ENTITLEMENT_ID \\\n        --location=global \\\n        --project=PROJECT_ID > {scratch}\/updated_entitlement.yaml\n    ```\n\n    If missing, offer to run `list` or exit.\n\n2.  Edit the exported `{scratch}\/updated_entitlement.yaml` file to apply the requested changes (e.g., updating\n    `maxRequestDuration`, `approvalWorkflow`, or `eligibleUsers`). Do not alter the `etag`.\n\n3.  Prompt: *\"You are about to update the PAM Entitlement `ENTITLEMENT_ID`. Do\n    you approve this update? (Yes\/No)\"*\n\n4.  Execute:\n\n```bash\ngcloud pam entitlements update ENTITLEMENT_ID \\\n    --location=global \\\n    --entitlement-file={scratch}\/updated_entitlement.yaml \\\n    --project=PROJECT_ID\n```\n\n### 4. Delete Entitlement\n\n1.  Verify existence using `describe`. If missing, offer list\/exit.\n2.  **Safety Check:** An entitlement cannot be deleted if there are open grants.\n    Before deleting, search for any `ACTIVE` or `SCHEDULED` grants:\n\n    ```bash\n    gcloud pam grants list \\\n        --entitlement=ENTITLEMENT_ID \\\n        --location=global \\\n        --project=PROJECT_ID \\\n        --filter=\"state:(ACTIVE, SCHEDULED)\"\n    ```\n\n    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)\"*\n\n    If Yes, revoke them:\n\n    ```bash\n    gcloud pam grants revoke GRANT_ID \\\n        --entitlement=ENTITLEMENT_ID \\\n        --location=global \\\n        --project=PROJECT_ID \\\n        --reason=\"Revoking to delete entitlement\"\n    ```\n\n3.  Prompt: *\"You are about to permanently delete the PAM Entitlement\n    `ENTITLEMENT_ID`. Do you approve this deletion? (Yes\/No)\"*\n\n4.  Execute:\n\n```bash\ngcloud pam entitlements delete ENTITLEMENT_ID \\\n    --location=global \\\n    --project=PROJECT_ID\n```\n\n--------------------------------------------------------------------------------\n\n## Mode 3: Approver Workflow {#mode-3}\n\nWhen an Approver needs to review, approve, or reject pending grant requests,\nload and follow the detailed instructions in\n[`references\/approver.md`](references\/approver.md).\n\n--------------------------------------------------------------------------------\n\n## Supporting Links & Resources {#supporting-links}\n\nFor further information on working with Privileged Access Manager, refer to:\n\n*   [Google Cloud Privileged Access Manager Overview][pam-overview]\n*   [Setting up PAM Entitlements][pam-create]\n*   [Requesting and auditing PAM Grants][pam-grants]\n*   [gcloud SDK pam Reference Guide][pam-gcloud]\n\n[pam-overview]: https:\/\/cloud.google.com\/iam\/docs\/pam-overview\n[pam-create]: https:\/\/cloud.google.com\/iam\/docs\/pam-create-entitlements\n[pam-grants]: https:\/\/cloud.google.com\/iam\/docs\/pam-request-temporary-elevated-access\n[pam-gcloud]: https:\/\/cloud.google.com\/sdk\/gcloud\/reference\/pam\n","use_cases":["Create and configure PAM entitlements with approval workflows.","Request temporary access through PAM grants.","Approve or deny pending grant requests.","Configure max request duration for access elevations."],"limitations":[],"compatibility":[],"setup_tip":null,"sample_input":null,"sample_output":null,"source_url":"https:\/\/github.com\/google\/skills\/blob\/e3c591afe426ea585e4c21799e5199d6d47cd1be\/skills\/cloud\/iam-helper-for-privileged-access-management\/SKILL.md","source_commit":"e3c591afe426ea585e4c21799e5199d6d47cd1be","license":null,"version":null,"listing_approved_at":"2026-11-17","created_at":"2026-11-16T18:43:47.000000Z","updated_at":"2026-11-17T15:28:10.000000Z","seo_title":"Manage Privileged Access Manager (PAM) Entitlements and Grants","seo_description":"Learn how to manage Privileged Access Manager (PAM) entitlements and grants, including approval workflows and access elevation.","seo_keywords":["PAM entitlements","PAM grants","approval workflows","temporary access","max request duration"]}}