IAP Agent Platform Troubleshooting

IAP Agent Platform Troubleshooting

Diagnoses why Identity-Aware Proxy denies outbound requests from Google Cloud agents through Agent Gateway, reading audit logs and policies and printing the smallest fix for the user to run.

Skill files13 files

references/

SKILL.md284 lines
1
---
2
name: iap-agent-platform-troubleshooting
3
metadata:
4
version: "1.0.0"
5
category: Security
6
description: >-
7
Diagnoses Identity-Aware Proxy (IAP) denials of outbound requests
8
from Gemini Enterprise Agent Platform agents that run on Agent Runtime and
9
send traffic through Agent Gateway. Use when an agent request fails
10
with "Egress request is not authorized", when Cloud Audit Logs show an IAP
11
egressViaIAP decision with granted false, when IAP audit entries are missing
12
while debugging agent egress, or when Access policies, IAP allow policies,
13
policy bindings, or Agent Registry entries might block agent egress. Don't
14
use for Gemini model IAM permission errors (such as
15
aiplatform.endpoints.predict), Agent Platform API errors, or Agent Runtime
16
deployment or 500 errors (use agent-platform-troubleshooting instead). Don't
17
use for setting up, creating, or connecting an Agent Gateway, or for IAP web
18
apps, IAP TCP forwarding, or SSH.
19
---
20
21
# IAP troubleshooting for Gemini Enterprise Agent Platform
22
23
Find out why Identity-Aware Proxy (IAP) denies a request from a Gemini
24
Enterprise Agent Platform agent, and print the smallest fix for the
25
user to run.
26
This skill supports Agent Runtime (Reasoning Engine) agents that use agent
27
identity and send traffic through Agent Gateway.
28
29
## Operating contract
30
31
- **Read only.** Run only the read commands in this skill and its
32
references (`describe`, `list`, `get-iam-policy`,
33
`search-target-policy-bindings`, and `logging read`), or the matching
34
read-only MCP tools (see [Tool selection](#tool-selection)). The setup
35
commands in [prerequisites.md](references/prerequisites.md) change only
36
local CLI settings.
37
- **Print fixes, never run them.** Don't run a command that creates,
38
imports, updates, binds, enables, or deletes anything, even if the user
39
asks you to. Print the remediation template for the root cause (see
40
[Report](#report)), and let the user run it. Access policies and IAP allow
41
policies apply to every agent whose traffic goes through Agent Gateway in
42
that project, so a wrong change can block or expose other agents.
43
- **Evidence first.** Copy principals, resource names, and hostnames from
44
command output. Don't build them from memory.
45
- **Stop on missing access.** If a read fails with `PERMISSION_DENIED`,
46
report the missing role instead of working around it.
47
48
## Attribution
49
50
**MUST READ**: Before executing any `gcloud`, REST API, or MCP command, you
51
MUST read [Usage Attribution](references/attribution.md). For commands executed
52
directly in the terminal (never in generated scripts, Terraform, or user code),
53
prefix `gcloud` with
54
`CLOUDSDK_METRICS_REQUEST_ATTRIBUTION="agent-skills/1.0 (skill:iap-agent-platform-troubleshooting)"`
55
and append `agent-skills/1.0 (skill:iap-agent-platform-troubleshooting)` to
56
`User-Agent` headers.
57
58
## Tool selection
59
60
Prefer the read tools of a connected Google Cloud remote MCP server over the
61
matching `gcloud` read, because remote MCP servers apply IAM, authentication,
62
and audit logging to every call. Use `gcloud` for any read that no connected
63
MCP server covers.
64
65
- **Cloud Logging:** run the log queries with `list_log_entries`. The
66
queries in the references use `gcloud` syntax, so adapt each one: set
67
`resourceNames` to `projects/{project_id}`, keep the filter, replace
68
`--freshness` with a `timestamp>=` clause in the filter, and set
69
`orderBy` to `timestamp desc` and `pageSize` to the `--limit` value.
70
Don't pass `gcloud` flags such as `--freshness` to the tool.
71
- **Agent Registry:** resolve destinations with its read tools, such as
72
`list_endpoints`, `get_endpoint`, `list_mcp_servers`, and
73
`get_mcp_server`.
74
- **Cloud CLI:** run the `gcloud` reads in this skill through
75
`run_gcloud_command`.
76
- **IAP, Agent Gateway, and authorization policies:** no remote MCP server
77
covers these, so read them with `gcloud`, directly or through the Cloud
78
CLI MCP server.
79
80
The read-only contract covers MCP tools too: never call a tool that creates,
81
updates, or deletes anything, such as `create_binding` or `delete_service`.
82
83
## Prerequisites
84
85
The Google Cloud CLI must be
86
[installed](https://docs.cloud.google.com/sdk/docs/install-sdk.md.txt) and
87
authenticated for `{project_id}`. Load
88
[prerequisites.md](references/prerequisites.md) if it isn't, or when a read
89
fails with `PERMISSION_DENIED` or a disabled API. It covers
90
`gcloud auth login`, the APIs, the read-only roles, billing, and the default
91
region (`us-central1`). The diagnosis creates no resources, so there's nothing
92
to clean up.
93
94
## Required context
95
96
Collect these values. Ask the user for any that are missing.
97
98
| Value | Source |
99
| :--- | :--- |
100
| `{project_id}`, `{project_number}` | The agent's project, and the gateway's project if it's different |
101
| `{location}` | Region of the agent and Agent Gateway |
102
| `{engine_id}` | ID of the Agent Runtime agent |
103
| `{gateway}` | The Agent Gateway that carries the agent's traffic |
104
| Destination URL | The exact URL that the agent called |
105
| Error text and time | The agent's logs or the user's report |
106
| `{org_id}` | Needed only for the optional principal access boundary check |
107
108
If the agent and Agent Gateway are in different projects, use the agent's
109
project number in principals. Use the gateway's project for the gateway, its
110
authorization policies and extension, Access policies, and policy bindings. Run
111
the IAP audit query in the gateway's project, and in the agent's project if it
112
returns nothing.
113
114
Load [topology-agent-gateway.md](references/topology-agent-gateway.md) to
115
confirm the topology, the principal format, the agent log query, and 403
116
errors during startup. If the agent doesn't run on Agent Runtime behind Agent
117
Gateway, say that the topology isn't supported yet, and stop.
118
119
## Step 0: Classify the failure
120
121
Load [audit-logs.md](references/audit-logs.md). Run the IAP decision query for
122
the time of the failure, and match the entry to the request by principal,
123
destination, and time. Use the first row that matches. An IAP entry outranks
124
the error text, because the entry records the decision itself.
125
126
| Signal | Meaning | Next |
127
| :--- | :--- | :--- |
128
| IAP entry with `granted: false`, not dry run | IAP denied the request | Step 1, then Steps 2-4 |
129
| IAP entry with `dryRun: true` or `iamEnforcementMode: DRY_RUN` | IAP logged the decision but didn't block the request. A 403 comes from the gateway or the destination | Step 1, then Steps 2-4: find the source of any 403, and whether IAP would deny the request once enforced |
130
| IAP entry with `granted: true` | IAP allowed the request | Step 2, then the destination |
131
| No IAP entry, and the error is an IAM permission error on a model or Agent Platform API call, such as `aiplatform.endpoints.predict` denied | Not an IAP egress denial | Stop, and name `agent-platform-troubleshooting` |
132
| No IAP entry for the request | Data Access audit logs are off, or the gateway denied the request before IAP | Step 1 (logs check), then Step 2 |
133
134
## Step 1: Check telemetry
135
136
1. Run the Data Access check in [audit-logs.md](references/audit-logs.md). If
137
the logs are off, explain that past requests weren't recorded, print the
138
"Enable Data Access audit logs for IAP" template, and stop until the user
139
reproduces the failure.
140
2. From the matching entry, record `principalSubject`, the destination, the
141
policy version, and the CEL evaluation details if the entry has them. Read
142
each from the field names in the fields table of
143
[audit-logs.md](references/audit-logs.md), because entries use different
144
layouts. The destination is `metadata.destination` when it's present, not
145
`authorizationInfo[].resource`, which can name the gateway.
146
3. If the entry has `metadata.destination.unregistered`, or
147
`audited_resource_name` is `unregisteredResource` or ends in
148
`unregisteredEndpoint`, the destination counts as unregistered: the hostname
149
isn't registered, or, for an MCP server, the called tool isn't in its tool
150
spec (see [agent-registry.md](references/agent-registry.md)). Keep that for
151
Step 4.
152
153
## Step 2: Check the gateway chain
154
155
Load [gateway-setup.md](references/gateway-setup.md). Read the gateway, its
156
authorization policies, and its authorization extension.
157
158
- If no authorization policy with `policyProfile: REQUEST_AUTHZ` lists the
159
gateway in `target.resources`, the extension isn't executed and no IAP
160
entry exists. That's the root cause.
161
- Read the extension that the policy names, not the one you expect. Its
162
`service` must be `iap.googleapis.com`. Record `metadata.iapPolicyVersion`,
163
`metadata.iamEnforcementMode`, and `failOpen`, because they decide which
164
policies IAP evaluates, whether it blocks, and whether a request passes
165
when the call to IAP fails or times out.
166
167
## Step 3: Check policies and bindings
168
169
Load [policy-model.md](references/policy-model.md), and use the section for the
170
version from Step 2.
171
172
- **V2 (Access policies):** read every policy bound to the project or the
173
gateway, because a deny rule in any of them wins and a policy without a
174
binding isn't enforced.
175
- **V1 (IAP allow policies):** look for `roles/iap.egressor` granted to the
176
agent's principal, or to a principal set that contains it, in the
177
registry-wide policy and in the destination's own policy. A resource
178
inherits the registry-wide grants, so a grant at either level applies.
179
- **Allowed but still denied:** check principal access boundary policies
180
(needs `{org_id}`) and principal set membership (see
181
[topology-agent-gateway.md](references/topology-agent-gateway.md)).
182
183
## Step 4: Check the rule match
184
185
Load [cel-attributes.md](references/cel-attributes.md) and
186
[agent-registry.md](references/agent-registry.md).
187
188
1. **Principal:** the rule lists the agent's exact `principal://` identifier,
189
or a `principalSet://` that contains the agent: same trust domain, and the
190
agent's project number or platform attribute, as listed in the principal set
191
table of [topology-agent-gateway.md](references/topology-agent-gateway.md).
192
If `principalSubject` holds a SPIFFE ID, build the identifier as described
193
there. A project ID in place of the project number, in either form, or a URN
194
identifier, never matches.
195
2. **Destination:** resolve the URL in Agent Registry.
196
- Registered: the condition names the registry resource with `==` or
197
`in`, exactly as the audit entry's `resource_id` or the Agent Registry
198
list output shows it.
199
- Unregistered, Access policies (V2) only: the condition matches the
200
host, the path, and the method (see
201
[cel-attributes.md](references/cel-attributes.md)). IAP allow policies
202
(V1) can't allow an unregistered destination: register it, and grant
203
`roles/iap.egressor` only if no registry-wide grant covers the agent.
204
3. **Condition:** for V2, use the CEL evaluation details from the audit entry
205
to find the clause that failed. If the entry has no evaluation details,
206
compare the entry's `resource_id` or `unregistered` values with each
207
literal in the condition yourself.
208
209
## Report
210
211
Load only the remediation reference for the root cause:
212
213
| Root cause | Load |
214
| :--- | :--- |
215
| Data Access audit logs are off, or an API is disabled | [remediation-setup.md](references/remediation-setup.md) |
216
| The authorization policy doesn't target the gateway, or calls the wrong extension | [remediation-gateway.md](references/remediation-gateway.md) |
217
| An Access policy (V2) rule doesn't match or a DENY rule matches, a binding is missing, or the organization policy constraint blocks the binding | [remediation-access-policies.md](references/remediation-access-policies.md) |
218
| An IAP allow policy (V1) grant is missing, the destination or a hostname variant isn't registered, or an MCP tool is missing from the server's tool spec | [remediation-registry.md](references/remediation-registry.md) |
219
220
Use this template:
221
222
```markdown
223
## Root cause
224
{root_cause_quoting_the_mismatched_value}
225
226
## Fix (you run this)
227
{why_smallest_change}
228
{filled_in_template}
229
Required role: {role}
230
231
## Wait time
232
{wait_time}
233
234
## Verify
235
- [ ] Reproduce the request.
236
- [ ] A new IAP audit entry shows granted: true for {principal} and {destination_url}.
237
- [ ] {read_command_that_confirms_the_change}
238
```
239
240
In dry run, IAP blocks nothing yet. Say so in the root cause, and say that its
241
logged denials are the requests that enforcement would block, because users
242
run dry run to find these requests before they enforce. If the user needs the
243
request to succeed and the policies wouldn't allow it once enforced, print
244
that fix under "Before you turn on enforcement". Verify it with a read
245
command, because a dry-run entry's `granted` value doesn't show whether a
246
policy allows the request.
247
248
If the evidence doesn't prove one root cause, list what you checked, what's
249
still unknown, and the next read command. Don't print a fix.
250
251
## Validation loop
252
253
Before you send the report, check every item. If one fails, fix the report
254
and check again.
255
256
- [ ] No command or MCP tool call that you made changed a resource. Every
257
fix is printed for the user.
258
- [ ] The fix is additive. It keeps existing bindings, rules, and clauses.
259
- [ ] If a DENY rule causes the denial, the report says that the block might
260
be deliberate and offers any change to that rule only as an option for
261
the rule's owner to approve.
262
- [ ] The principal is the agent's exact `principal://` identifier, in the
263
Agent Runtime format.
264
- [ ] Registry resource names in conditions use the project ID, copied from
265
the audit entry's `resource_id` or from Agent Registry list output.
266
- [ ] A binding fix targets the project that contains Agent Gateway.
267
- [ ] Hostnames match exactly, every variant is covered, and methods are in
268
the request's case, such as `'GET'`.
269
- [ ] The fix allows only the hosts, paths, and methods that the logs show
270
the agent calling, and keeps restrictions that the rule already has, such
271
as a method limit, because they're often deliberate. If the user asks to
272
loosen a rule, say whether the logs show that it's needed. Never print a
273
rule that's looser than the logs require.
274
- [ ] V1 fixes use `roles/iap.egressor`, never
275
`roles/iap.tunnelResourceAccessor`, which grants IAP TCP forwarding, not
276
egress.
277
- [ ] No fix turns off IAP or switches enforcement to dry run, because that
278
removes egress protection for every agent behind the gateway.
279
- [ ] Every placeholder is filled in from command output.
280
- [ ] Commands printed for the user don't include
281
`CLOUDSDK_METRICS_REQUEST_ATTRIBUTION` or the attribution `User-Agent`
282
string, because the tag is only for commands you run yourself (see
283
[attribution.md](references/attribution.md)).
284

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

@OpenSourceBuffGuy

I find openly licensed prompts and post them here.

0 followers · 14,621 prompts

More by @OpenSourceBuffGuy

See all
Sea turtle carrying floating film studio island prompt image

Sea turtle carrying floating film studio island

Draws a giant sea turtle carrying a floating island film studio through a starry sky, where fairies polish rough film strips into golden film.

image-prompt, nano-banana, 3d-render, cartoon, fantasy-world, creatures, animals, whimsical, dreamy, cinematic, dramatic-lighting, vibrant-colors, bokeh, miniature, widescreen, night-scene, illustration, concept-art, surreal, storytelling, clay-3d

Desert buggy escapes drones past industrial outpost prompt image

Desert buggy escapes drones past industrial outpost

Builds a 15-second desert chase video where a racer in an armored buggy escapes drones past an industrial outpost, using five reference images with set jobs.

video-prompt, hailuo, action, multi-shot, timed-beats, camera-movement, reference-image, character-consistency, negative-prompt, cinematic, sci-fi, cars, landscape, aerial-view, tracking-shot, photorealistic, sound-effects, structured-output, long-form, widescreen

1 view
Cozy Pixel Art Farm Island Village prompt image

Cozy Pixel Art Farm Island Village

Draws a cozy 16-bit pixel-art farming village across six small islands joined by bridges, with exact counts for buildings, animals and crops.

image-prompt, gpt-image, pixel-art, isometric, game-assets, concept-art, maps, worldbuilding, cozy, vibrant-colors, ocean, landscape, wide-shot, widescreen, game-development, video-games, structured-output, whimsical, summer, high-angle, aerial-view, animals, negative-prompt, cityscape

1 view

Reviews

Loading reviews…

Discussion

Loading comments…