Documentation Index
Fetch the complete documentation index at: https://mintlify.hoop.dev/docs/llms.txt
Use this file to discover all available pages before exploring further.
IAM Federation is currently behind the
experimental.iam_federation feature
flag. Ask your Hoop admin to enable it for your organization before
configuring the GCP side.Before you start, you need a working Hoop connection to attach
federation to. Federation layers per-user cloud credentials onto an
existing connection — it doesn’t create one for you.
- Create the connection first — for BigQuery, follow
Connect to BigQuery. Verify it
works end-to-end with
hoop connect <name>before continuing. - Complete the GCP IAM setup below to mint the admin service account.
- Wire policy + credentials onto the connection with
hoop admin federation set. - Validate end-to-end with
hoop admin federation test.
What this gives you
With IAM Federation enabled, Hoop stops sharing a single Google service-account key with every user. Instead, when Alice runshoop connect my-bq, the gateway:
- Reads the connection’s federation policy (identity template, project id, fallback rules).
- Asks Google’s
iamcredentialsAPI to mint an OAuth access token as Alice’s principal, using the admin service account it has stored for your organization. - Hands that short-lived token to the agent. Every subsequent
bq queryshows up in Cloud Logging attributed to Alice — not to the shared admin service account.
- The admin service account must be allowed to impersonate each user’s target principal. This is the
roles/iam.serviceAccountTokenCreatorgrant. - Each target principal must have whatever data-plane roles it needs (e.g.
roles/bigquery.userfor BigQuery).
Prerequisites
GenerateAccessToken call with PERMISSION_DENIED: IAM Service Account Credentials API has not been used.
Step 1 — Create the admin service account
The admin SA is the only identity Hoop’s gateway authenticates with. It never reads user data directly; it only mints tokens for the user principals.hoop-admin-sa.json to:
Step 2 — Grant Token Creator (pick one pattern)
You have two patterns depending on how granular you want your GCP audit trail.Pattern A — Per-user grant (recommended)
Create one GCP service account per Hoop user, then let the admin SA impersonate only those specific accounts. Cleanest audit trail, smallest blast radius if the admin key ever leaks.Pattern B — Project-wide grant (simpler)
Grant the admin SAserviceAccountTokenCreator at the project level once. It can then impersonate any SA in the project. Faster to set up, but a compromised admin key reaches every SA in the project.
Step 3 — Verify the grant before saving in Hoop
Before pasting the admin key into Hoop, prove the impersonation actually works from a regular shell. Hoop does exactly this call on every session-open, so a green light here means a green light in Hoop.| Output | Meaning | Fix |
|---|---|---|
A long ya29.… token | All grants correct. Ready to feed hoop-admin-sa.json to Hoop. | — |
403: The caller does not have permission | Admin SA is missing roles/iam.serviceAccountTokenCreator on the target. | Re-run step 2. |
404: Service account … does not exist | Typo in the target email or the user-SA was never created. | Re-check gcloud iam service-accounts list. |
400: Invalid form of account ID | The identity template would produce an illegal SA name (dots, plus signs, too short). | Adjust the template — see the warning under Pattern A. |
Step 4 — Test end-to-end from Hoop
Once the gcloud check passes, do the same test from inside Hoop. This both verifies impersonation and runs a realSELECT 1 through the agent — catching agent-side problems too.
Superseded Static Envs: GOOGLE_APPLICATION_CREDENTIALS is the signal that the legacy SA key file on the connection is being correctly ignored in favor of the federated token. You don’t need to manually remove it from the connection — Hoop strips it server-side on every federated session.
What you’ll see in GCP audit logs
After federation is wired up, every BigQuery query produced through Hoop generates two correlated log entries:serviceAccountDelegationInfo chain is what gives you the full picture: who ran the query (the user-SA Alice was mapped to) and through whom (the Hoop admin SA). That delegation chain is the audit story IAM federation buys you.
The two log streams live in different audit log tiers, which matters for how you enable and find them:
| Log type | Service | Event | Default? |
|---|---|---|---|
| Admin Activity | iamcredentials.googleapis.com | GenerateAccessToken — proves impersonation happened | On by default, free |
| Data Access | bigquery.googleapis.com | jobservice.insert, jobservice.jobcompleted — proves the query ran as Alice | Off by default, billed per GiB |
Enable Data Access logs first
protoPayload.serviceName: bigquery.googleapis.com entry. Data Access logs are billed at standard Cloud Logging rates — typically negligible for query metadata but worth scoping by sink filter if your project runs millions of jobs/day.
Quick verification with gcloud logging read
Right after a hoop connect my-bq + bq query session as Alice, fetch the two correlated entries:
The
-v-1H argument is the BSD date syntax used on macOS. On Linux
use --date '1 hour ago' instead:
timestamp >= "$(date -u --date='1 hour ago' +%Y-%m-%dT%H:%M:%SZ)".Browse in Cloud Logging Explorer
Console → Logging → Logs Explorer. The canonical filter for “everything that ever went through Hoop federation, regardless of which user” pivots on the delegation chain:principalEmail is the admin SA itself (with no delegation chain) are the ones that bypassed federation — alert on those if you want to enforce “all access goes through Hoop”.
Long-term audit: sink to BigQuery
For real history and analytics, route the audit logs into a BigQuery dataset and query them with SQL. This is the production-grade pattern for compliance reporting._* wildcard covers Cloud Logging’s daily-partitioned sink tables (cloudaudit_googleapis_com_data_access_20260528, ..._20260529, etc.).
Common pitfalls
I see GenerateAccessToken events but no BigQuery query entries
I see GenerateAccessToken events but no BigQuery query entries
BigQuery Data Access logs are off by default. The
GenerateAccessToken
event lives in the always-on Admin Activity tier, but the actual query
(jobservice.insert) lives in Data Access — which has to be opted into.
Enable it project-wide with the auditConfigs snippet under
Enable Data Access logs first, then
re-run a query. New entries appear in Cloud Logging within seconds.403 IAM_SERVICE_ACCOUNT_TOKEN_CREATOR after granting the role
403 IAM_SERVICE_ACCOUNT_TOKEN_CREATOR after granting the role
GCP IAM grants are eventually consistent. Wait 1–2 minutes after running
You should see your admin SA listed with
add-iam-policy-binding, then retry. If it still fails, double-check the
grant is on the target SA (the per-user one), not on the admin SA:roles/iam.serviceAccountTokenCreator.BigQuery returns Access Denied even though impersonation works
BigQuery returns Access Denied even though impersonation works
Impersonation produces the token, but the target principal also needs
BigQuery roles. Verify with:You should see
roles/bigquery.user and roles/bigquery.dataViewer (or finer-grained equivalents).warning: both HOOP_GCP_ACCESS_TOKEN and GOOGLE_APPLICATION_CREDENTIALS are set
warning: both HOOP_GCP_ACCESS_TOKEN and GOOGLE_APPLICATION_CREDENTIALS are set
Harmless on older gateway versions. On current versions the gateway
strips
GOOGLE_APPLICATION_CREDENTIALS from the federated session, so
this warning never fires from a normal session — if you see it now,
your agent is being driven by an older gateway that hasn’t been
updated yet.Identity template renders to an empty principal
Identity template renders to an empty principal
fallback_policy: deny aborts the session with a clear error. Pick
fallback_policy: readonly with a readonly_principal if you want a
safe-by-default identity for users who don’t yet have their own SA.