Documentation
ReferenceConnectorsGoogle Workspace Connector

Google Workspace Connector

Complete reference for collecting SOC 2 evidence from Google Workspace using the evidence SDK.

Overview

Controls supported:

  • CC6.1 - Logical Access Controls (2-Step Verification enforcement)
  • CC6.6 - Access Removal/Modification (admin roles, user lifecycle)

What it collects:

  • 2-Step Verification (2SV) enforcement status
  • Admin role assignments
  • User lifecycle events (suspensions, deletions)
  • Domain security settings

What it does NOT collect:

  • ❌ User email content (Gmail messages)
  • ❌ Google Drive file contents
  • ❌ Calendar events or details
  • ❌ Chat/Meet conversation content
  • ❌ User passwords
  • ❌ OAuth tokens

Configuration Schema

Required Fields

FieldTypeDescriptionExample
modeenumAuthentication mode (currently only service_account)service_account
credentials_envstringEnvironment variable with service account JSON pathGOOGLE_APPLICATION_CREDENTIALS
customer_idstringGoogle Workspace customer IDC0xxxxxxx
admin_emailstringAdmin email for domain-wide delegationadmin@acme.com

Optional Fields

FieldTypeDefaultDescription
domainsarray[]Additional domains to collect from
controlsarray(all)Limit which controls to collect for
timeout_secondsnumber60Request timeout in seconds

Basic Configuration

Single Domain

framework: soc2_type1
controls:
  - CC6.1
  - CC6.6
sources:
  google_workspace:
    mode: service_account
    credentials_env: GOOGLE_APPLICATION_CREDENTIALS
    customer_id: C0xxxxxxx
    admin_email: admin@acme.com

Collects from:

  • Primary domain
  • All users in domain
  • Admin role assignments

Environment variable:

export GOOGLE_APPLICATION_CREDENTIALS=/path/to/service-account.json

Multiple Domains

sources:
  google_workspace:
    mode: service_account
    credentials_env: GOOGLE_APPLICATION_CREDENTIALS
    customer_id: C0xxxxxxx
    admin_email: admin@acme.com
    domains:
      - acme.com
      - subsidiary.acme.com

Use case: Organizations with multiple domains


Service Account Setup

Step 1: Create Service Account

  1. Go to Google Cloud Console
  2. Create or select a project
  3. Navigate to "IAM & Admin" → "Service Accounts"
  4. Click "Create Service Account"
  5. Name: evidence-collector
  6. Click "Create and Continue"
  7. Skip "Grant this service account access to project" (not needed)
  8. Click "Done"

Step 2: Create Service Account Key

  1. Click on the service account you created
  2. Go to "Keys" tab
  3. Click "Add Key" → "Create new key"
  4. Select "JSON" format
  5. Click "Create"
  6. Save the downloaded JSON file securely

File format:

{
  "type": "service_account",
  "project_id": "your-project",
  "private_key_id": "...",
  "private_key": "-----BEGIN PRIVATE KEY-----\n...",
  "client_email": "evidence-collector@your-project.iam.gserviceaccount.com",
  "client_id": "...",
  "auth_uri": "https://accounts.google.com/o/oauth2/auth",
  "token_uri": "https://oauth2.googleapis.com/token",
  "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
  "client_x509_cert_url": "..."
}

Step 3: Enable Domain-Wide Delegation

  1. In service account details, click "Show Advanced Settings"
  2. Under "Domain-wide Delegation", copy the "Client ID"
  3. Go to Google Admin Console
  4. Navigate to "Security" → "Access and data control" → "API controls"
  5. Click "Manage Domain Wide Delegation"
  6. Click "Add new"
  7. Paste the Client ID
  8. Add OAuth scopes (see Required Scopes section)
  9. Click "Authorize"

Artifacts Collected

FilenameAPI EndpointControlsDescription
2sv_enforcement.jsonAdmin SDK - SettingsCC6.12-Step Verification enforcement status
admin_roles.jsonAdmin SDK - DirectoryCC6.6Admin role assignments and privileges
user_lifecycle.jsonAdmin SDK - ReportsCC6.6User suspension, deletion, recovery events
domain_security.jsonAdmin SDK - SettingsCC6.1Domain-wide security settings

Artifact Details

2SV Enforcement (2sv_enforcement.json)

Purpose: Verify 2-Step Verification is enforced for all users

Sample artifact:

{
  "enforceStrongAuthentication": true,
  "allowStrongAuthentication": true,
  "enforcementDate": "2025-06-01T00:00:00Z",
  "remindersEnabled": true,
  "securityDefaults": {
    "enabled": true
  }
}

Control mapping:

  • CC6.1: 2SV enforcement prevents unauthorized access

Pass criteria:

  • enforceStrongAuthentication: true
  • enforcementDate in the past (enforcement active)
  • ✅ Applied to all users (no exemptions)

Remediation if failing:

  1. Go to Google Admin Console → Security → Authentication → 2-Step Verification
  2. Click "Enforce 2-Step Verification"
  3. Set enforcement date (recommended: immediate)
  4. Enable reminders for users
  5. Remove exemptions for regular users (admins may have temporary exemptions during rollout)

Admin Roles (admin_roles.json)

Purpose: Verify admin role assignments are appropriate

Sample artifact:

{
  "roles": [
    {
      "roleId": "1234567890",
      "roleName": "Super Admin",
      "roleDescription": "Full administrative access",
      "isSuperAdminRole": true,
      "rolePrivileges": [
        {
          "privilegeName": "ADMIN_CONSOLE",
          "serviceId": "00uc3kw0akzqdm8bpo3"
        }
      ],
      "assignments": [
        {
          "assignedTo": "admin@acme.com",
          "assigneeType": "user",
          "assignedAt": "2025-01-15T10:00:00Z"
        },
        {
          "assignedTo": "security-lead@acme.com",
          "assigneeType": "user",
          "assignedAt": "2025-02-01T12:00:00Z"
        }
      ]
    },
    {
      "roleId": "0987654321",
      "roleName": "User Management Admin",
      "roleDescription": "Manage users and groups",
      "isSuperAdminRole": false,
      "rolePrivileges": [
        {
          "privilegeName": "USER_MANAGEMENT",
          "serviceId": "00uc3kw0akzqdm8bpo3"
        }
      ],
      "assignments": [
        {
          "assignedTo": "hr-lead@acme.com",
          "assigneeType": "user",
          "assignedAt": "2025-03-10T14:30:00Z"
        }
      ]
    }
  ]
}

Control mapping:

  • CC6.6: Admin role assignments should follow least privilege principle

Pass criteria:

  • ✅ Super Admin role assigned to 2-5 people maximum
  • ✅ Role assignments documented and justified
  • ✅ No overly broad role assignments
  • ✅ Roles reviewed periodically

Remediation if failing:

  1. Go to Google Admin Console → Admin roles
  2. Review each role assignment
  3. Remove unnecessary Super Admin assignments
  4. Use more specific roles (User Management Admin, Groups Admin, etc.)
  5. Document each admin assignment with justification

User Lifecycle (user_lifecycle.json)

Purpose: Track user suspensions, deletions, and recoveries

Sample artifact:

{
  "events": [
    {
      "eventType": "USER_SUSPEND",
      "timestamp": "2026-01-05T16:20:00Z",
      "actor": "admin@acme.com",
      "targetUser": "former-employee@acme.com",
      "reason": "Employment terminated"
    },
    {
      "eventType": "USER_DELETE",
      "timestamp": "2026-01-09T10:00:00Z",
      "actor": "admin@acme.com",
      "targetUser": "contractor@acme.com",
      "reason": "Contract ended"
    },
    {
      "eventType": "USER_RECOVER",
      "timestamp": "2026-01-08T14:15:00Z",
      "actor": "admin@acme.com",
      "targetUser": "returning-employee@acme.com",
      "reason": "Rehire"
    }
  ],
  "period": {
    "start": "2026-01-01T00:00:00Z",
    "end": "2026-01-09T23:59:59Z"
  }
}

Control mapping:

  • CC6.6: User access is removed when no longer authorized

Pass criteria:

  • ✅ Suspended users exist (shows active lifecycle management)
  • ✅ Deletions happen after appropriate retention period
  • ✅ All actions have documented actors
  • ✅ No unexplained recoveries

Remediation if failing:

  1. Implement offboarding process:
    • Suspend user immediately upon termination
    • Transfer data ownership
    • Delete user after retention period (30-90 days)
  2. Document all lifecycle actions
  3. Regularly audit suspended accounts

Domain Security (domain_security.json)

Purpose: Verify domain-wide security settings

Sample artifact:

{
  "allowExternalSharing": false,
  "allowPublicSharing": false,
  "passwordMinimumLength": 12,
  "passwordRequireSymbol": true,
  "passwordRequireNumber": true,
  "passwordRequireLowercase": true,
  "passwordRequireUppercase": true,
  "sessionDuration": 14400,
  "idleTimeout": 3600
}

Control mapping:

  • CC6.1: Password complexity and session management

Pass criteria:

  • passwordMinimumLength ≥ 12
  • ✅ All password complexity requirements enabled
  • sessionDuration ≤ 24 hours
  • ✅ External sharing restricted appropriately

Required Scopes

Domain-Wide Delegation Scopes

Add these OAuth scopes when setting up domain-wide delegation:

https://www.googleapis.com/auth/admin.directory.user.readonly
https://www.googleapis.com/auth/admin.directory.rolemanagement.readonly
https://www.googleapis.com/auth/admin.reports.audit.readonly

Scope descriptions:

  • admin.directory.user.readonly - Read user information, suspensions
  • admin.directory.rolemanagement.readonly - Read admin role assignments
  • admin.reports.audit.readonly - Read audit logs for user lifecycle events

Never use:

  • admin.directory.user (write access)
  • admin.directory.rolemanagement (write access)
  • ❌ Read-write scopes

Environment Variables

Standard Configuration

export GOOGLE_APPLICATION_CREDENTIALS=/path/to/service-account.json

File permissions:

chmod 600 /path/to/service-account.json
chown $USER:$USER /path/to/service-account.json

CI/CD Secrets

GitHub Actions:

- name: Set up service account
  run: |
    echo '${{ secrets.GOOGLE_SERVICE_ACCOUNT_JSON }}' > /tmp/sa.json
    export GOOGLE_APPLICATION_CREDENTIALS=/tmp/sa.json

GitLab CI:

before_script:
  - echo "$GOOGLE_SERVICE_ACCOUNT_JSON" > /tmp/sa.json
  - export GOOGLE_APPLICATION_CREDENTIALS=/tmp/sa.json

Customer ID

Find Your Customer ID

  1. Go to Google Admin Console
  2. Click "Account" → "Account settings"
  3. Look for "Customer ID"
  4. Format: C0xxxxxxx (9 characters)

Example: C01234567


Collection Process

Step 1: Authenticate with Service Account

Authenticating with Google Workspace...
  → Service account: evidence-collector@project.iam.gserviceaccount.com
  → Impersonating: admin@acme.com
  ✓ Domain-wide delegation authorized
  ✓ Customer ID: C01234567

Step 2: Fetch 2SV Enforcement

Fetching 2-Step Verification settings...
  → Admin SDK: Security Settings
  ✓ 2SV enforcement: enabled
  ✓ Enforcement date: 2025-06-01
  ✓ Reminders enabled

Step 3: Fetch Admin Roles

Fetching admin role assignments...
  → Admin SDK: Directory - Roles
  ✓ Found 5 roles
  ✓ Super Admin: 2 users
  ✓ User Management Admin: 1 user
  ✓ Groups Admin: 1 user
  ✓ Help Desk Admin: 3 users

Step 4: Fetch User Lifecycle Events

Fetching user lifecycle events (last 90 days)...
  → Admin SDK: Reports - Audit
  ✓ Suspensions: 3
  ✓ Deletions: 1
  ✓ Recoveries: 0

✓ Collection complete (4 artifacts)

Common Patterns

Basic Configuration

sources:
  google_workspace:
    mode: service_account
    credentials_env: GOOGLE_APPLICATION_CREDENTIALS
    customer_id: C01234567
    admin_email: admin@acme.com

Use case: Single domain, standard setup


Multi-Domain Organization

sources:
  google_workspace:
    mode: service_account
    credentials_env: GOOGLE_APPLICATION_CREDENTIALS
    customer_id: C01234567
    admin_email: admin@acme.com
    domains:
      - acme.com
      - subsidiary.acme.com
      - vendor.acme.com

Use case: Organizations with multiple domains under one customer ID


Troubleshooting

Authentication Failed

Symptom:

✗ Google Workspace connector failed

Error: Invalid service account credentials (HTTP 401)

Causes:

  • Service account JSON file invalid
  • File path incorrect
  • File permissions denied

Solutions:

  1. Verify file exists:

    ls -l $GOOGLE_APPLICATION_CREDENTIALS
  2. Check file format:

    cat $GOOGLE_APPLICATION_CREDENTIALS | jq .type
    # Should output: "service_account"
  3. Test credentials:

    gcloud auth activate-service-account \
      --key-file=$GOOGLE_APPLICATION_CREDENTIALS

Domain-Wide Delegation Not Authorized

Symptom:

✗ Google Workspace connector failed

Error: Not Authorized to access this resource/api (HTTP 403)

Domain-wide delegation may not be enabled.

Causes:

  • Domain-wide delegation not set up
  • OAuth scopes not authorized
  • Wrong client ID used

Solutions:

  1. Get Client ID from service account:

    cat $GOOGLE_APPLICATION_CREDENTIALS | jq -r .client_id
  2. Verify delegation in Admin Console:

    • Go to Security → API controls → Domain-wide Delegation
    • Search for client ID
    • Verify scopes are correct
  3. Re-authorize with correct scopes:

    https://www.googleapis.com/auth/admin.directory.user.readonly
    https://www.googleapis.com/auth/admin.directory.rolemanagement.readonly
    https://www.googleapis.com/auth/admin.reports.audit.readonly

Invalid Customer ID

Symptom:

✗ Google Workspace connector failed

Error: Invalid customer ID 'C0xxxxxxx'

Causes:

  • Customer ID incorrect
  • Customer ID format wrong
  • Service account doesn't have access to customer

Solutions:

  1. Find correct customer ID:

    • Go to Admin Console → Account → Account settings
    • Copy Customer ID (format: C01234567)
  2. Verify format:

    • Must start with C
    • Followed by 8 digits
    • Total 9 characters
  3. Check service account access:

    • Service account must be in same organization
    • Or organization must allow external service accounts

Admin Email Not Found

Symptom:

✗ Google Workspace connector failed

Error: User 'admin@acme.com' not found or not an admin

Causes:

  • Admin email incorrect
  • User not an admin
  • User suspended

Solutions:

  1. Verify admin email:

    • Must be a super admin or have appropriate admin role
    • Check spelling carefully
  2. Check user status:

    • Go to Admin Console → Directory → Users
    • Search for user
    • Verify user is active and has admin privileges
  3. Use correct admin:

    • Must have privileges for all required scopes
    • Recommended: Use dedicated service admin account

Insufficient Permissions

Symptom:

✗ Google Workspace connector failed

Error: Insufficient permissions for this operation (HTTP 403)

Required scope: admin.directory.user.readonly

Causes:

  • OAuth scopes not complete
  • Scopes not authorized in delegation

Solutions:

  1. Check authorized scopes:

    • Go to Admin Console → Security → API controls
    • Find domain-wide delegation entry
    • Verify all three required scopes are listed
  2. Add missing scopes:

    • Edit delegation entry
    • Add missing scopes
    • Click "Authorize"
  3. Wait for propagation:

    • Changes may take 5-10 minutes to propagate
    • Retry collection after waiting

Best Practices

1. Use Dedicated Service Account

Create service account specifically for evidence collection:

Name: evidence-collector@project.iam.gserviceaccount.com Purpose: Read-only evidence collection Key rotation: Annual

Don't reuse:

  • ❌ Development service accounts
  • ❌ Production deployment accounts
  • ❌ Multi-purpose service accounts

2. Minimize Domain-Wide Delegation Scopes

Only grant required scopes:

  • *.readonly scopes only
  • ✅ Three scopes needed for evidence collection
  • ❌ No write scopes
  • ❌ No admin scopes beyond read-only

3. Use Dedicated Admin Account

Create service admin account:

  • Email: evidence-admin@acme.com
  • Role: Custom role with minimum required privileges
  • 2SV: Enforced
  • Purpose: Domain-wide delegation impersonation

Don't use:

  • ❌ Personal admin accounts
  • ❌ Super admin accounts
  • ❌ Shared admin accounts

4. Rotate Service Account Keys

Schedule:

  1. Create new service account key (January 1st)
  2. Update environment variables
  3. Test collection with new key
  4. Delete old key (keep for 7 days as backup)

Security:

  • Never commit keys to git
  • Store keys in secrets management (Vault, AWS Secrets Manager, etc.)
  • Encrypt keys at rest

5. Enable 2SV for All Users

Rollout plan:

  1. Announce to organization (30 days notice)
  2. Enable reminders
  3. Provide training and support
  4. Set enforcement date
  5. Remove exemptions (except emergency break-glass accounts)

Enforcement:

  • 100% of users must have 2SV enabled
  • No exemptions for regular users
  • Emergency accounts with exemptions must be audited monthly

See Also