Prerequisites
- GCP project with owner or admin access
gcloudCLI installed and configured- Cloudgeni account (free trial available)
- Time estimate: 3 minutes
Authentication Methods
Keyless (Recommended)
Service Account Impersonation
- No credentials stored in Cloudgeni
- Short-lived tokens generated on-demand
- Enhanced security posture
- Simple IAM binding setup
Service Account Key
Traditional JSON Key
- Upload service account key file
- Works in air-gapped environments
- Key rotation required
Option A: Keyless Authentication (Recommended)
Keyless authentication uses service account impersonation. Cloudgeni’s platform service account generates short-lived access tokens on demand - no long-lived credentials are stored.Step 1: Create Service Account
Create a dedicated service account
Create a dedicated service account
Set your project ID and create a dedicated service account for Cloudgeni:
Step 2: Assign IAM Roles
Grant read-only permissions
Grant read-only permissions
Assign the minimum required roles for Cloudgeni to scan your infrastructure:
These roles provide read-only access to your GCP resources. Cloudgeni cannot make any changes to your infrastructure.
Step 3: Allow Cloudgeni to Impersonate
Grant impersonation permission
Grant impersonation permission
Allow Cloudgeni’s platform service account to impersonate your service account:
This allows Cloudgeni to generate short-lived access tokens (valid for 1 hour) to scan your infrastructure. No long-lived credentials are stored.
Step 4: Configure Cloudgeni Integration
Add GCP integration in Cloudgeni
Add GCP integration in Cloudgeni
- Log into your Cloudgeni dashboard
- Navigate to Settings > Integrations > Cloud
- Click “Connect GCP”
- Select the “Keyless (Recommended)” tab
- Enter your configuration:
- Name:
GCP Production(or your environment name) - Project ID: Your GCP project ID
- Service Account Email:
{SA_NAME}@{PROJECT_ID}.iam.gserviceaccount.com
- Name:
- Click “Create Integration”
A scan of all your GCP resources will start automatically after creating the integration.
Option B: Service Account Key
If you prefer traditional authentication or operate in an air-gapped environment, you can use service account keys.Step 1: Create Service Account
Follow the same steps as Option A, Step 1 above.Step 2: Assign IAM Roles
Follow the same steps as Option A, Step 2 above.Step 3: Create Service Account Key
Generate JSON key file
Generate JSON key file
Create and download the service account key file:Result: You’ll have a
{SA_NAME}-key.json file in your current directory.Step 4: Configure Cloudgeni Integration
Add GCP integration in Cloudgeni
Add GCP integration in Cloudgeni
- Log into your Cloudgeni dashboard
- Navigate to Settings > Integrations > Cloud
- Click “Connect GCP”
- Select the “Service Account Key” tab
- Enter your configuration:
- Name:
GCP Production(or your environment name) - Project ID: Your GCP project ID
- Default Region: Select your primary region
- Service Account Key: Upload your service account key JSON file
- Name:
- Click “Create Integration”
A scan of all your GCP resources will start automatically after creating the integration.
Troubleshooting
Permission denied errors
Permission denied errors
If you see permission denied errors during scans:
- Verify the service account has the
roles/viewerrole - For keyless auth, verify the impersonation binding is correct:
- Ensure the
roles/serviceusage.serviceUsageConsumerrole is assigned
Token generation failed (keyless)
Token generation failed (keyless)
If token generation fails with keyless authentication:
- Verify the Cloudgeni platform SA has the
serviceAccountTokenCreatorrole - Check that the service account email is correctly formatted
- Ensure your project’s IAM API is enabled: