Connect using Workload Identity Federation
In this guide, you will use the Guardrails Create Connection wizard to connect your GCP Organization using Workload Identity Federation (WIF). WIF provides keyless authentication: no long-lived credentials cross the cloud boundary.
For background on permissions, attribute conditions, and how the federation round-trip works, see Set Up Workload Identity Federation.
Prerequisites
Turbot/OwnerorTurbot/Adminpermissions in Guardrails.- Your GCP Organization numeric ID. Find it with
gcloud organizations list. - A GCP service account in a project you control (the "SA host project"). The wizard's setup script can create the Workload Identity Pool and IAM bindings, but the service account itself must exist first. See Step 1 of the WIF setup guide.
- The
gcloudCLI installed and authenticated with a user that has organization admin permissions. - The required GCP APIs enabled in the SA host project and in every project you plan to import. The setup script grants IAM roles but does not enable any APIs.
- The Guardrails
@turbot/gcpmod installed in your workspace and on a version that supports WIF.
Step 1: Open the Create Connection Wizard
From the Accounts page, click Create Connection. The wizard opens on the Select a Provider screen.

Click GCP.
Step 2: Choose Connection Type
Choose GCP Organization. The GCP Project option is for standalone projects without an org and is documented separately at Connect a Project.

Step 3: Configure Service Account
The wizard opens on the Configure Service Account step. Workload Identity Federation is shown as an access mode option marked Recommended.

Select Workload Identity Federation if it isn't already selected.
Enter Your GCP Details
The wizard's first section, Your GCP Details, asks for the organization and service account you set up. Fill these fields:
| Field | Description |
|---|---|
| Organization ID | Your GCP organization's numeric ID. Find it with gcloud organizations list. |
| Service Account Email | The full email of the service account Guardrails will use, e.g. turbot-guardrails@<SA_HOST_PROJECT_ID>.iam.gserviceaccount.com. |
| External ID Label Key | Defaults to guardrails_external_id. Leave it alone unless you have a strong reason to change it. |
| External ID Label Value | Auto-generated by Guardrails, disabled by default. Use Copy to clipboard to copy it; the value is also baked into the setup script so you usually don't need it manually. |
[!NOTE] The External ID is not a credential. It's an identifier that prevents the confused deputy problem by ensuring only your Guardrails workspace can use the service account. We recommend keeping the auto-generated value rather than substituting your own.
[!TIP] If you ever need to rotate the External ID, click Generate new External ID. After rotating, re-apply the new label to your SA host project. Re-running the setup script handles this for you.
Download and Run the Setup Script
The wizard's second section, Configure WIF in GCP, holds the setup script. Once Organization ID and Service Account Email are filled, the Download setup-wif.sh button becomes active. The script is pre-filled with your values and automatically looks up the project number. By default it grants read-only access for Project Only discovery, with commented hints for adding more roles later.

- Click Download setup-wif.sh.
- Run it against the SA host project with
gcloudauthenticated as a user with organization admin permissions. The script:- Creates a Workload Identity Pool and an AWS provider with an attribute condition pinned to the Guardrails WIF transit role.
- Grants the pool the
iam.workloadIdentityUserrole on your service account. - Sets the
guardrails_external_idlabel on the SA host project with the wizard's value. - Grants the recommended org-level read-only roles (
roles/browser,roles/viewer,roles/serviceusage.serviceUsageConsumer,roles/logging.privateLogViewer). Additional roles for All Resources / remediation are commented out for you to enable as needed. - Does not enable any Google Cloud APIs. Make sure the required GCP APIs are enabled in the SA host project and in every project you plan to import.
- The script's last command prints the Pool Provider Resource Name. Paste it into the Pool Provider Resource Name field.
- Click Continue.
Step 4: Verify the Organization
Click Discover Organization. Guardrails performs the full WIF round-trip: assumes the WIF transit role, federates to GCP via the Workload Identity Pool, impersonates your service account, then calls Cloud Resource Manager to enumerate folders and projects.
On success, you see Organization Discovered with a summary of the org name, ID, folders, and projects found.

[!TIP] If discovery fails right after running the setup script, wait 1 to 2 minutes for GCP IAM propagation and retry. See WIF Troubleshooting for specific error patterns.
Click Continue.
Step 5: Configure Discovery Settings
The wizard shows your discovered folder and project hierarchy. Each node has a Discovery Level dropdown.

| Discovery Level | What Guardrails Discovers | IAM Needed in Project? |
|---|---|---|
| None | Nothing: the project is excluded | No |
| Project Only | Project metadata and organization-level policies | No |
| All Resources | Everything in Project Only, plus individual resources (buckets, instances, IAM policies, etc.) | Yes, the SA needs additional roles in the project |
Discovery levels set on a folder cascade to all its children (shown as Inherited). Individual projects can override the inherited value.
[!TIP] Most organizations start with Project Only for all projects using just the read-only roles that the setup script grants. You can upgrade individual projects to All Resources mode later.
Click Continue.
Step 6: Choose Destination Folder
Choose where to place this connection in your Guardrails resource hierarchy. Select an existing folder or click Create Folder to create a new one.

Click Continue.
Step 7: Review and Connect
The final wizard step shows a summary of your configuration:
- Service Account: Access mode (Workload Identity Federation), service account email, pool provider.
- Organization: Organization ID, name, verification status.
- Discovered Projects: Number of projects, folders, and custom level overrides.
- Destination Folder: Where the connection will be placed.

Review the details and click Create Connection.
Step 8: Monitor Discovery Progress
After connecting, you are redirected to the organization overview page. A Discovering Resources banner shows real-time progress while Guardrails enumerates your folders and projects; click Refresh now to update the tree, or wait for automatic updates. Discovery typically takes a few minutes depending on the size of your organization.
Switch to the Hierarchy tab once discovery completes to see the discovered folder and project structure.

Step 9: Verify the Connection
Navigate to Accounts and click the GCP filter chip to scope the list to your newly connected projects. Verify that CMDB and Discovery controls are in OK state on each project.

The Organizations tab shows your new GCP organization alongside any other imported organizations.

Next Steps
- Connect a Member Project: Upgrade projects to All Resources mode.
- Enable GCP Services: Control which GCP services Guardrails manages.
- Configure Real-Time Events: Set up event handlers for near-instant change detection.
- Configure Permissions: Manage GCP IAM permissions through Guardrails.
Troubleshooting
| Issue | Solution |
|---|---|
| WIF radio is greyed out | The installed GCP mod doesn't support WIF. Upgrade @turbot/gcp to a version that includes the workloadIdentityPoolProvider policy type. |
| Download setup-wif.sh button is disabled | Fill in both Organization ID and Service Account Email. The button activates once those are present. |
| Setup script fails: service account not found | The script does not create the service account. Create it first per Step 1 of the WIF setup guide. |
| Discover Organization fails: "Authentication failed" | Verify the Pool Provider Resource Name matches what the script printed and that GCP IAM has had 1 to 2 minutes to propagate. See WIF Troubleshooting. |
| External ID verification fails | The guardrails_external_id label must be on the SA's host project and exactly match the wizard value. Re-run the setup script (it sets the label) or set it manually with gcloud alpha projects update. |
| Zero projects discovered | The service account is missing one of the recommended org-level roles, most commonly roles/browser. The setup script grants the read-only role set; re-run it if you skipped that section. |
Every control in Error with organizationcredentials and Cloud Resource Manager API has not been used in project | The API is disabled in the SA host project. Enable cloudresourcemanager.googleapis.com there, wait a few minutes, and rerun GCP > Organization > CMDB. See Required GCP APIs. |
GCP > Project > CMDB in Error with Cloud Resource Manager API has not been used in project | The API is disabled in that project (the project number is in the message). Enable it there, or set GCP > Cloud Resource Manager > API Enabled to Enforce: Enabled, then rerun the control. See Required GCP APIs. |
| Quota exceeded (Read requests per minute) | The service account is missing roles/serviceusage.serviceUsageConsumer at the org level. Re-run the setup script. Controls self-heal on rerun. |
| Further assistance | Open a Support Ticket. |