Generated banner for Iam Helper For Troubleshooting
Generated logo for Iam Helper For Troubleshooting

Iam Helper For Troubleshooting

GoogleOfficialPublished by Google

  • Skill
  • Tool integration
  • Security
  • Apache-2.0
  • Low risk
  • Has scripts

From the author

Diagnoses, remediates, and manages Identity and Access Management (IAM) access issues on Google Cloud. Supports two distinct operational modes: (1) Requester Flow for developers encountering access denials (capturing error context, self-service PAM JIT activations, elevated developer self-remediation, or logging structured tickets), and (2) Resolver Flow for privileged administrators (authoritative Policy Troubleshooter analysis, deny policy exemptions, least-privilege role discovery, and PAM/IAM provisioning).
— the description by Google

AutoGineer summary

Written by AutoGineer from the skill’s own files, not by the author

This skill provides a structured approach to diagnosing and resolving Google Cloud IAM access denials. It operates in two modes: a Requester Flow for developers to perform self-service diagnostics or ticket creation, and a Resolver Flow for administrators to perform authoritative policy analysis, role discovery, and access provisioning. The skill enforces strict safety guardrails, including mandatory human-in-the-loop approval for all role modifications and specific protocols for handling unknown access states or existing permissions.

What it does

  • Diagnoses Google Cloud access denial errors using Policy Troubleshooter.
  • Supports self-service PAM JIT activation for developers.
  • Facilitates authoritative policy analysis and deny policy exemption management.
  • Identifies least-privilege roles for resource access.
  • Enforces human-in-the-loop approval for all IAM role provisioning.
  • Logs structured tickets for access escalation.

When to use it

  • When a developer encounters a 403 access denial on a Google Cloud resource.
  • When an administrator needs to investigate missing permissions or troubleshoot IAM policies.
  • When evaluating candidate roles for least-privilege access.
  • When managing PAM JIT grants or deny policy exemptions.

Advantages

  • Provides distinct workflows for different user personas.
  • Ensures security through mandatory human approval for role changes.
  • Prevents infinite loops during troubleshooting.
  • Standardizes access resolution processes across teams.
  • Integrates with Google Cloud Policy Troubleshooter.

Usage examples

“I am getting a 403 error when trying to list buckets in project my-project. Can you help?”
The agent initiates the Requester Flow, captures the error context, and guides the user through self-diagnosis or ticket creation.
“Troubleshoot why [email removed] cannot access the BigQuery dataset in project-a.”
The agent enters the Resolver Flow, evaluates the relevant IAM policies, and identifies the missing permissions or applicable deny policies.

Install

  1. Download the skill as a ZIP:

    https://autogineer.com/agent-skills/google/iam-helper-for-troubleshooting/download
  2. Unzip it into the cross-client skills folder of your project:

    mkdir -p .agents/skills && unzip iam-helper-for-troubleshooting.zip -d .agents/skills

Documentation by Google

IAM Access Troubleshooter & Remediation Orchestrator on Google Cloud

You are an expert Google Cloud Security and IAM assistant. You diagnose access denial errors and orchestrate the appropriate resolution path depending on the caller's persona and privileges.

Usage Attribution

MUST READ: Before executing any gcloud, REST API, or MCP command, you MUST read and follow the instructions in Usage Attribution.

Mode Selection Guide

Identify the caller's context to select the appropriate operational mode:

ModeTarget Persona / ContextPrimary ActionsReference Guide
Mode 1: Requester FlowDeveloper, Service Account, or requester blocked by an access denialCaptures Error ID, runs self-diagnosis, self-activates PAM JIT grants, self-remediates (if elevated), or logs structured tickets.references/requester.md
Mode 2: Resolver FlowSecurity Admin, Cloud IAM Admin, or agent handling an escalated access ticketAuthoritatively evaluates allow/deny policies, creates deny exemptions, discovers minimal roles, and provisions PAM/IAM access.references/resolver.md
Routing Rules
  1. Follow Mode 1 (Requester Flow) if:

    • You are executing an end-user development task, encounter a 403 / Error ID, and need to perform self-service PAM activation or produce an internal escalation ticket for an administrator.

    • 📖 Reference Guide: Read and follow references/requester.md for detailed execution steps.

  2. Follow Mode 2 (Resolver Flow) if:

    • The user asks you to troubleshoot access, investigate a missing permission, find candidate roles, or resolve an access denial on a Google Cloud resource.

    • 📖 Reference Guide: Read and follow references/resolver.md for detailed execution steps.

  3. Default Behavior:

    • Default to Mode 2 (Resolver Flow) for troubleshooting access denials and missing permissions across Google Cloud resources. Read and follow references/resolver.md for detailed execution steps.


Safety Guardrails & Approval Policy

All access modifications and role provisioning operations are governed by the approval tiers and safety boundaries defined in references/guardrails.md:

  • Human-in-the-Loop (HITL): All role provisioning operations (read-only, mutating, and administrative roles) require explicit human approval before execution. High-risk administrative roles require an explicit high-risk warning.

  • Access Already Granted Rule: When policy evaluation determines accessState: GRANTED (or access is already granted via inherited allow policies), inform the user that the IAM permission configuration is correct and terminate the troubleshooting flow immediately. Do NOT search for roles, suggest role queries, or propose role bindings.

  • Role Discovery Gating: Always ask the user for confirmation before executing queries to list or search candidate roles. Only list roles after receiving user confirmation in a subsequent turn.

  • Unknown Access State / Group Expansion Rule: When policy evaluation returns accessState: UNKNOWN or UNKNOWN_INFO (due to missing permissions to expand group memberships like roles/browser), explain that access is unknown due to missing group expansion permissions (roles/browser), and terminate the troubleshooting flow immediately. Do NOT run secondary queries or probe alternative policies.

  • Anti-Loop & Permission Denied: If troubleshooting commands encounter PERMISSION_DENIED on the caller's identity (HTTP 403), stop immediately without querying roles or running alternative commands. If the user requested replying with "Permission Denied" or the role name, reply immediately with "Permission Denied".

[!NOTE] Organizations cloning this skill should customize references/guardrails.md to define their specific approval tiers and policies.


Files

references/resolver.md

Administrator & Security Resolver Flow

This guide details how privileged administrators and security agents intake access requests, resolve blocking deny policies, and provision least-privileged access.

Prerequisites & Required Roles

To successfully troubleshoot and remediate access, the caller must possess the following roles:

  • Troubleshooting: roles/policyintelligence.policyTroubleshooterViewer (or roles/iam.securityReviewer), roles/iam.principalAccessBoundaryViewer (to view PAB policies), and roles/serviceusage.serviceUsageConsumer (to run gcloud commands).

  • Expanding Memberships: Expanding group memberships requires Google Workspace Admin access. Expanding group memberships for service account principal sets requires roles/browser.

  • Remediation: roles/resourcemanager.projectIamAdmin (for local bindings) or roles/iam.denyAdmin (for deny policies).

  • Note: Basic roles like roles/owner or roles/editor inherently provide most of these permissions.


Step 1: Intake & Authoritative Diagnosis

  1. Retrieve the ERROR_ID (for example, an alphanumeric base64-encoded string like ZGVuaWVkX2J5X2RlbmlhbF9wb2xpY3k...) or (PRINCIPAL_EMAIL, IAM_PERMISSION, RESOURCE_URI) from the ticket or escalation payload.

  2. Invoke the Policy Troubleshooter MCP tool (troubleshoot_access or troubleshoot_iam_error_id) to analyze the full CRM hierarchy (Organization -> Folder -> Project).

    • Fallback: If MCP tools are unavailable, use the fallback scripts or gcloud CLI:

      • For Error IDs: ERROR_ID="YOUR_ERROR_ID" python3 scripts/troubleshooting_error_id.py

      • For manual checks: Always use gcloud policy-troubleshoot iam with --format=json and pass --billing-project (extracting PROJECT_ID from RESOURCE_URI if present):

      gcloud policy-troubleshoot iam //RESOURCE_URI \
          --principal-email="PRINCIPAL_EMAIL" \
          --permission="IAM_PERMISSION" \
          --billing-project="PROJECT_ID" \
          --format=json
  3. Evaluate the results:

    • CASE A (accessState: GRANTED or Inherited Org/Folder Allow Policy): Access is correctly configured and already granted (including via inherited organization or folder allow policies, or domain-wide/group bindings). When checking access on a resource where parent organization policy (organizations/... in explainedPolicies) grants an allow binding such as roles/viewer or roles/resourcemanager.organizationViewer, conclude and state that access is GRANTED via an allow policy inherited at the Organization level and the IAM permission configuration is correct. Terminate the flow immediately. Do NOT search for roles, do NOT suggest querying roles, and do NOT propose or apply any role bindings.

    • CASE B (accessState or bindingState is UNKNOWN or UNKNOWN_INFO): Access evaluation returned unknown/inconclusive information (typically due to missing permissions to expand group memberships, which requires roles/browser or directory viewer permissions, or missing resourcemanager.projects.getIamPolicy on ancestors). Conclude and inform the user that access could not be fully confirmed because of missing permissions to expand group memberships (roles/browser). Terminate the troubleshooting flow immediately. Do NOT run secondary queries (such as get-iam-policy or iam policies list), do NOT query groups, and do NOT diagnose as a definitive missing allow binding.

    • CASE C (accessState: NOT_GRANTED): Access is absent or blocked:

      • If denyPolicyExplanation shows access is blocked by an explicit IAM deny policy, explain that an explicit IAM deny policy blocks access, advise contacting the Security/Organization Administrator, and proceed to Step 2.

      • If pabPolicyExplanation indicates a Principal Access Boundary policy block, proceed to Step 3.

      • If allowPolicyExplanation shows no allow policy grants the permission and no deny policies block access, proceed to Step 4.

    • Caller Permission Denied / Anti-Loop Rule: If invoking the Policy Troubleshooter tool/API or gcloud policy-troubleshoot returns PERMISSION_DENIED (HTTP 403 / insufficient caller permissions to troubleshoot the resource), the caller lacks the necessary diagnostic permissions (roles/policyintelligence.policyTroubleshooterViewer or roles/iam.securityReviewer). Halt immediately and do NOT search for roles, do NOT query project IAM policies, and do NOT retry alternative commands. If the user asked for "Permission Denied" or the role name, reply immediately with "Permission Denied".


Step 2: Remediate Blocking Deny Policies

If one or more IAM v2 deny policies block access, then do the following:

  1. For each blocking policy (POLICY_ID), present the admin with the following options to avoid dangerous permission escalations (Require a HITL prompt before execution):

    • Option A: Add the principal to exceptionPrincipals (exempt principal).

      • Update the deny rule definition file to add principal://goog/subject/PRINCIPAL_EMAIL under denialRule.exceptionPrincipals, then run the following command:

      gcloud iam deny-policies update POLICY_ID \
          --attachment-point=ATTACHMENT_POINT \
          --rules-file=policy.json
    • Option B: Remove the permission from the deny rule.

      • Update the deny rule definition file to remove IAM_PERMISSION from denialRule.deniedPermissions (or add it under denialRule.exceptionPermissions), then run the following command:

      gcloud iam deny-policies update POLICY_ID \
          --attachment-point=ATTACHMENT_POINT \
          --rules-file=policy.json
    • Option C: Exclude the resource from the deny policy scope.

      • Update the deny rule condition in the policy file (for example, adding !resource.matchTag(...) or narrowing the rule scope so the target RESOURCE_URI is excluded), then run the following command:

      gcloud iam deny-policies update POLICY_ID \
          --attachment-point=ATTACHMENT_POINT \
          --rules-file=policy.json
  2. If human approval is granted for the chosen option, apply the policy update.

  3. Wait 60 seconds for policy changes to propagate.

  4. If the troubleshooting response also indicated a missing allow policy, proceed to Step 4. Otherwise, proceed to Step 6.


Step 3: Remediate Blocking Principal Access Boundary (PAB) Policies

If pabPolicyExplanation indicates access is blocked by a Principal Access Boundary policy, then do the following:

  1. Present the admin with remediation options (Require HITL approval before execution):

    • Option A: Update the PAB Policy Resources. Add the target resource or its parent folder/project to the list of allowed resources defined in the PAB policy:

      gcloud iam principal-access-boundary-policies update PAB_POLICY_ID \
          --location=global \
          --organization=ORGANIZATION_ID \
          --rules-file=pab_policy.json
    • Option B: Modify Principal Sets. Update the PAB binding or modify user group membership so the principal is no longer subject to the restrictive boundary. For example, to remove a restrictive PAB binding, run the following command:

      gcloud iam principal-access-boundary-policy-bindings delete BINDING_ID \
          --location=global \
          --organization=ORGANIZATION_ID

      For more specific steps on modifying bindings, refer to the Principal Access Boundary documentation.

  2. Wait 60 seconds for policy changes to propagate, then re-evaluate access.


Step 4: Discover Least-Privileged Role

If access is missing due to an absent allow policy, then do the following:

  1. First, explain the diagnostic findings: confirm that no allow policy grants IAM_PERMISSION and there are no blocking deny policies.

  2. Prompt User for Confirmation Before Querying Roles (Turn Control): If the user has not already confirmed finding candidate roles, ask the user whether they want to find candidate roles granting the permission: > "There is no allow policy granting permission 'IAM_PERMISSION', and no deny policy blocking access. Would you like me to find candidate roles (including predefined and project custom roles) that provide this permission? (Yes/No)"

  3. Execute Role Query (After Receiving User Confirmation): Run the automated least-privileged role finder script (preferred, as it evaluates both predefined and project custom roles and returns a single optimal role, avoiding long lists):

    IAM_PERMISSION="YOUR_IAM_PERMISSION" \
    TARGET_PROJECT_ID="YOUR_PROJECT_ID" \
    python3 scripts/least_privileged_role.py

    Fallback (Manual CLI queries): If the script cannot be executed, search for matching predefined and project custom roles using gcloud iam roles list:

    # Predefined roles matching permission:
    gcloud iam roles list --filter="includedPermissions:IAM_PERMISSION" --format="table(name,title)"
    
    # Project custom roles matching permission:
    gcloud iam roles list --project=TARGET_PROJECT_ID --filter="includedPermissions:IAM_PERMISSION" --format="table(name,title)"

    Select the role returned with the least privilege (ROLE_NAME). Never assign broad basic roles such as roles/owner, roles/editor, roles/viewer, roles/admin, or roles/writer.

  4. Proceed to Step 5 to prompt the user for approval before provisioning access.


Step 5: Provision Access (Subject to Guardrails)

When prompting the human for HITL approval, explicitly state the target resource (e.g., the RESOURCE_URI or, if that resource does not accept allow policies, the resource's parent project) where the role would be granted.

If creating a new role grant, evaluate ROLE_NAME against the approval tiers defined in the organization's customized guardrails:

  • Standard Roles (HITL Protocol): If ROLE_NAME is a standard role granting read/view or write/mutating permissions (for example, roles/*.viewer, roles/*.editor, roles/writer), follow HITL protocol and prompt for user confirmation, stating the target resource.

  • Admin / Destructive Roles (HITL): If ROLE_NAME grants destructive, deletion, or administrative privileges (for example, roles/*.admin, roles/owner, roles/resourcemanager.*Admin, roles/iam.*), follow HITL protocol with an explicit high-risk warning, stating the target resource.

Prompt the user to choose between temporary PAM access (Path A) and permanent bindings (Path B).

Provisioning Paths:
Path A: Privileged Access Manager (PAM Entitlement - Preferred)

Ask the user if PAM is enabled, or check for existing PAM entitlements using gcloud pam entitlements list. If the organization uses PAM for time-bound, audited access, delegate the provisioning to @skill:iam-helper-for-privileged-access-management:

  1. If an entitlement already exists for ROLE_NAME covering PRINCIPAL_EMAIL: Delegate to @skill:iam-helper-for-privileged-access-management to request a grant against the existing entitlement.

  2. If an entitlement does not exist: Delegate to @skill:iam-helper-for-privileged-access-management to create a new standing PAM entitlement for ROLE_NAME allowing PRINCIPAL_EMAIL to request access, and then request the grant.

Path B: Permanent IAM Role Binding (Direct Grant)

If permanent standing access is approved, then run one of the following commands, based on the resource that they need access on:

  • For Projects:

    gcloud projects add-iam-policy-binding PROJECT_ID \
        --member="user:PRINCIPAL_EMAIL" \
        --role="ROLE_NAME"
  • For Folders:

    gcloud resource-manager folders add-iam-policy-binding FOLDER_ID \
        --member="user:PRINCIPAL_EMAIL" \
        --role="ROLE_NAME"
  • For Organizations:

    gcloud organizations add-iam-policy-binding ORGANIZATION_ID \
        --member="user:PRINCIPAL_EMAIL" \
        --role="ROLE_NAME"

Step 6: Verification & Handoff

  1. Verify that the binding or PAM grant is active by re-running the policy troubleshooter check.

  2. Provide a structured resolution summary:

    • Root Cause: Deny policy / PAB policy / Missing allow policy.

    • Remediation Applied: Added deny exemption for POLICY_ID / Updated PAB policy PAB_POLICY_ID / Granted role ROLE_NAME via PAM entitlement ENTITLEMENT_ID / Granted permanent role ROLE_NAME.

    • Target Principal: PRINCIPAL_EMAIL

  3. Notify Developer / Transfer Back:

    • Inform the requester that the permission barrier is resolved.

    • Instruct the admin to direct the original developer to retry their underlying task.

Requirements and compatibility

Works with: Claude Code, Claude apps, OpenAI Codex, GitHub Copilot, Cursor, Gemini CLI, Kiro, OpenCode, Goose, Amp, Roo Code, JetBrains Junie, Factory Droid, Devin (ex-Windsurf), Mistral Vibe, OpenHands, Letta

“Works with” means the tool reads the open Agent Skills format; a skill written for one tool may use features others lack.

Needs: Needs an MCP server, Needs Python

Security

What our scanner noticed· Low risk

  • Scripts that your agent may run

This skill includes scripts that your agent may run. Read them before you use it.

A static scan is not a guarantee. Skills are third-party content: review a skill before you let an agent use it.

Attribution and licence

Published by
Google
Publisher
Google (Official)
Source
google/skills · skills/cloud/iam-helper-for-troubleshooting · commit 2194d3b
Licence
Apache License 2.0 (redistribution allowed)
  • LICENSE (added by AutoGineer from LICENSE)
  • ATTRIBUTION.md (written by AutoGineer)
Synced

AutoGineer is not affiliated with or endorsed by Google or Google.

Download ZIP

The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download iam-helper-for-troubleshooting.zip