Connect using Service Account Authentication

In this guide, you will use the Guardrails Create Connection wizard to connect your GCP Organization using Service Account Impersonation.

Prerequisites

Step 1: Open the Create Connection Wizard

From the Accounts page, click the Actions dropdown and select Create Connection. Select GCP from the provider grid.

GCP Connection Type selection

Choose GCP Organization (recommended). The alternative GCP Project option connects a single standalone project. See Connect a Project for that workflow.

Step 2: Configure the Service Account

The wizard opens with the service account configuration. Select Service Account Impersonation as the access mode and enter the Organization SA email.

Wizard: Configure Service Account with access mode, email, and impersonation setup

The wizard displays:

About the External ID

Guardrails auto-generates a unique External ID for your workspace (e.g., turbot_123456789012345_99999999). We recommend using this value. It prevents the confused deputy problem by ensuring only your Guardrails workspace can use the service account. You can also set a custom External ID by clicking the lock icon to unlock the field.

For more information, see What is Guardrails External ID Protection?

Wizard: Bottom of step 1 showing gcloud command and Continue button

[!IMPORTANT] For Service Account Impersonation, both the Token Creator role and the External ID label must be in place before clicking Continue. Guardrails verifies both.

Click Continue.

Step 3: Verify the Organization

Enter your GCP Organization numeric ID and click Discover Organization.

Wizard: Verify Organization with ID field and Discover button

On success, you'll see Organization Discovered with a summary of your projects, folders, organization name, and ID.

Wizard: Organization Discovered with project and folder counts

[!TIP] If discovery fails, verify that the Organization SA has the required organization-level roles and that the required APIs are enabled. See Set Up Service Account: Troubleshooting.

Click Continue.

Step 4: Configure Discovery Settings

The wizard shows your discovered folder and project hierarchy. Each node has a Discovery Level dropdown.

Wizard: Discovery settings with folder and project tree

Discovery Levels

Discovery LevelWhat Guardrails DiscoversIAM Needed in Project?
NoneNothing, the project is excludedNo
Project OnlyProject metadata and organization-level policiesNo
All ResourcesEverything in Project Only, plus individual resources (buckets, instances, etc.)Yes, the SA needs permissions in the project

Discovery levels set on a folder cascade to all its children (shown as "Inherited"). Individual projects can override.

[!TIP] Most organizations start with Project Only mode for all projects. This gives immediate visibility into your governance posture without requiring additional IAM permissions. You can upgrade individual projects to All Resources mode later.

Click Continue.

Step 5: Choose the 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.

Wizard: Destination folder selection

Click Continue.

Step 6: Review and Connect

The final step shows a summary of your configuration:

  1. Service Account: access mode, client email
  2. Organization: organization ID, name, verification status
  3. Discovered Projects: number of projects, folders, and custom level overrides
  4. Destination Folder: where the connection will be placed

Wizard: Review summary

Review the details and click Create Connection.

Step 7: Monitor Discovery Progress

After connecting, you're redirected to the Organization Overview page. A Discovering Resources banner shows real-time progress.

Organization overview with discovery progress

Click Refresh now to update the display. As discovery progresses, the tree expands to show each folder and project with its control status.

Discovery progress with expanded tree

[!NOTE] Discovery typically takes a few minutes depending on the size of your organization. You can navigate away and come back later.

Step 8: Verify the Connection

Navigate to Accounts > Organizations tab to see your newly connected GCP organization.

Organizations tab showing connected GCP org

Switch to the Accounts tab and filter by GCP Project to see the individual projects.

Accounts tab showing discovered GCP projects

Verify Controls

Check that CMDB and Discovery controls are in OK state for the organization and projects. Navigate to a project and select the Controls tab to verify. If controls are in Error state, check the Troubleshooting section below.

Next Steps

Troubleshooting

IssueSolution
Discovery fails: "Invalid form of account ID"The impersonation grant may be incorrect. Verify the Master SA has Service Account Token Creator on your Organization SA.
Discovery fails: "Permission denied"The Organization SA is missing one of the recommended org-level roles. Verify roles/browser, roles/viewer, roles/serviceusage.serviceUsageConsumer, and roles/logging.privateLogViewer are granted at the organization scope. See Set Up Service Account.
External ID verification failsThe guardrails_external_id label must be on the project where the Organization SA resides. Value must match exactly.
Zero projects discoveredThe Organization SA is missing roles/browser at the organization level.
Controls in Error after importIf GCP > Project > CMDB is in Error on specific projects, check the two API rows below first. For Project Only mode, the recommended role set covers all default-on controls. For projects upgraded to All Resources mode, additional roles may be needed. See Connect a Member Project.
Every control in Error with organizationcredentials and Cloud Resource Manager API has not been used in projectThe API is disabled in the Organization SA's project. Enable cloudresourcemanager.googleapis.com there, wait a few minutes for propagation, and rerun GCP > Organization > CMDB. See Required GCP APIs.
GCP > Project > CMDB in Error with Cloud Resource Manager API has not been used in projectThe 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 Organization SA is missing roles/serviceusage.serviceUsageConsumer at the org level. Re-grant the recommended role set. Controls self-heal on rerun.
Further assistanceOpen a Support Ticket