Iam Helper For Troubleshooting
GoogleOfficialPublished by Google
- Skill
- Tool integration
- Security
- Apache-2.0
- Low risk
- Has scripts
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
Download the skill as a ZIP:
https://autogineer.com/agent-skills/google/iam-helper-for-troubleshooting/downloadUnzip 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:
| Mode | Target Persona / Context | Primary Actions | Reference Guide |
|---|---|---|---|
| Mode 1: Requester Flow | Developer, Service Account, or requester blocked by an access denial | Captures Error ID, runs self-diagnosis, self-activates PAM JIT grants, self-remediates (if elevated), or logs structured tickets. | references/requester.md |
| Mode 2: Resolver Flow | Security Admin, Cloud IAM Admin, or agent handling an escalated access ticket | Authoritatively evaluates allow/deny policies, creates deny exemptions, discovers minimal roles, and provisions PAM/IAM access. | references/resolver.md |
Routing Rules
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.mdfor detailed execution steps.
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.mdfor detailed execution steps.
Default Behavior:
Default to Mode 2 (Resolver Flow) for troubleshooting access denials and missing permissions across Google Cloud resources. Read and follow
references/resolver.mdfor 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: UNKNOWNorUNKNOWN_INFO(due to missing permissions to expand group memberships likeroles/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_DENIEDon 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.mdto define their specific approval tiers and policies.
Supporting Links & Resources
Requester Flow Reference: Developer and access requester self-service & triage playbook
Resolver Flow Reference: Administrator and security resolver authoritative playbook
Guardrails & Approval Policy: Human-in-the-loop approval tiers and security boundaries
MCP Usage Reference: Using the Policy Troubleshooter remote MCP server
Files
- ATTRIBUTION.mdAdded by AutoGineer878 B
- LICENSELicence file added by AutoGineer11.1 KiB
- SKILL.md5.4 KiB
- references/attribution.md1.9 KiB
- references/guardrails.md3.4 KiB
- references/mcp-usage.md3.0 KiB
- references/requester.md6.5 KiB
- references/resolver.md13.9 KiB
- scripts/least_privileged_role.pyScript4.9 KiB
- scripts/troubleshooting_error_id.pyScript4.7 KiB
references/requester.md
Developer & Access Requester Flow
This guide details how developers and access requesters handle IAM access denials, ranging from self-service just-in-time (JIT) elevations and local project remediation to logging structured tickets.
Step 1: Capture Error Context
Extract the necessary parameters from the failed operation:
Option A (Error ID - Preferred): Extract the base64-encoded
error_info_id/ERROR_ID(for example,ZGVuaWVkX2J5X2RlbmlhbF9wb2xpY3k...) from the 403 API error response.Option B (Manual Parameters):
PRINCIPAL_EMAIL: The identity executing the task.IAM_PERMISSION: The exact missing permission (for example,bigquery.datasets.create).RESOURCE_URI: The target resource URI (for example,//cloudresourcemanager.googleapis.com/projects/PROJECT_ID).
Step 2: Diagnostic Check (Attempt Self-Diagnosis)
Attempt to verify why access was denied using available tools:
Call the Policy Troubleshooter MCP tool (
troubleshoot_accessortroubleshoot_iam_error_id) to analyze the full Resource Manager hierarchy.Fallback: If MCP tools are unavailable, use the fallback scripts or
gcloudCLI:For Error IDs:
ERROR_ID="YOUR_ERROR_ID" python3 scripts/troubleshooting_error_id.pyFor manual checks: Extract the project ID from
RESOURCE_URI(if available) and pass--billing-projectand--format=json:gcloud policy-troubleshoot iam //RESOURCE_URI \ --principal-email="PRINCIPAL_EMAIL" \ --permission="IAM_PERMISSION" \ --billing-project="PROJECT_ID" \ --format=json
If troubleshooting returns
PERMISSION_DENIED:The identity lacks the required viewer rights (for example, missing
resourcemanager.projects.getIamPolicy). Recognize that troubleshooting failed due to caller permissions. Proceed directly to Step 5 (Log Bug / Escalate to Admin) to escalate the permission error to an administrator using the captured error context.
If troubleshooting succeeds:
CASE A (
accessState: GRANTED): Access is correctly configured and granted (including via inherited organization or folder allow policies). Conclude that access is already granted and the IAM permission configuration is correct. Terminate the flow immediately. Do NOT search for roles, suggest role queries, or propose role bindings.CASE B (
accessStateorbindingStateisUNKNOWNorUNKNOWN_INFO): Access evaluation returned unknown/inconclusive information (typically due to missing permissions to expand group memberships, which requiresroles/browser). Inform the user that access could not be fully confirmed because of missing permissions to expand group memberships (roles/browser).CASE C (
accessState: NOT_GRANTED): Access is absent or blocked. CheckdenyPolicyExplanationfor explicitly blocked access, Principal Access Boundary policy evaluations, andallowPolicyExplanationfor absent allow bindings.
Step 3: Self-Service & Elevated Developer Checks
Evaluate the diagnosis against your available permissions:
Branch A: Blocked by an IAM deny policy
Modifying deny policies requires organization-level
roles/iam.denyAdmin.Developers cannot self-remediate deny policies. Advise contacting the Security or Organization Administrator and proceed directly to Step 5 (Log Bug / Escalate to Admin), including the blocking
POLICY_ID.
Branch B: Missing allow policy (No deny policy blocking)
Evaluate the following tiers in order:
Tier 1: Self-Service PAM Entitlement Grants (Pre-approved Entitlement Exists)
Check if an active PAM entitlement covers this permission (
gcloud pam entitlements list).If found, request a time-bound PAM entitlement grant:
gcloud pam grants create \ --entitlement=ENTITLEMENT_ID \ --location=global \ --project=PROJECT_ID \ --requested-duration="1h"Once the grant is active, proceed to Step 4 (Retry Troubleshooter Check).
Tier 2: Elevated Developer (Local Project IAM Admin Rights)
If no PAM entitlement exists, check if you hold
roles/resourcemanager.projectIamAdminon the target project.If permitted, explain the findings to the user and prompt the user for permission before running any role queries or discovery scripts:
"There is no allow policy granting permission 'IAM_PERMISSION', and no deny policy blocking access. Would you like me to find candidate roles granting this permission? (Yes/No)"
Only after receiving user confirmation, search for candidate roles using
gcloud iam roles list --filter="includedPermissions:IAM_PERMISSION"orscripts/least_privileged_role.py.Evaluate the returned
ROLE_NAMEagainst the guardrails inreferences/guardrails.md. Prompt the user for approval before applying the project-level IAM binding:gcloud projects add-iam-policy-binding PROJECT_ID \ --member="user:PRINCIPAL_EMAIL" \ --role="ROLE_NAME"Proceed to Step 4 (Retry Troubleshooter Check).
Tier 3: Unprivileged Developer (No PAM Entitlement & No Local Admin Rights)
Proceed to Step 5 (Log Bug / Escalate to Admin).
Step 4: Retry Troubleshooter Check
Whenever access is granted (via PAM entitlement activation or local role binding), immediately re-run the policy troubleshooter check to confirm access before advising any task retries.
Step 5: Log Bug / Escalate to Admin
When self-remediation is not possible, construct a structured escalation report or ticket:
Ticket / Escalation Template
Title: [Access Request] Missing permission <IAM_PERMISSION> on <RESOURCE_URI>
Principal: <PRINCIPAL_EMAIL>
Target Resource: <RESOURCE_URI>
Missing Permission: <IAM_PERMISSION>
Error ID: <ERROR_ID>
Diagnostic Details:
- Deny policy blocking: [Yes: <POLICY_ID> / None]
- Principal Access Boundary policy blocking: [Yes / No]
- Allow policy missing: [Yes / No]
- Suggested least-privileged role: <ROLE_NAME> (if diagnosed)
Resolution Options for Admin:
- If deny policy is blocking: Add exemption for <PRINCIPAL_EMAIL> on <POLICY_ID>.
- If allow policy is missing: Create a time-bound PAM entitlement or grant role binding <ROLE_NAME>.
- Reference: See https://docs.cloud.google.com/iam/docs/resolve-permission-errors for more comprehensive information.Agent Instruction: (In multi-agent setups, output the summary above and escalate to a human administrator).
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
- 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