> For the complete documentation index, see [llms.txt](https://docs.threatdefence.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.threatdefence.com/siem-integrations/software-as-a-service/google-workspace.md).

# Google Workspace

This guide walks you through enabling the **G Suite Alert Center API**, creating a **service account** and **P12 key**, delegating domain-wide access, and preparing the **deliverables** for ThreatDefence.

***

## Step 1: Enable API

1. **Enable the G Suite (Admin SDK) API**
   * Open the [Google Cloud Console](https://console.cloud.google.com).
   * Go to **APIs & Services → Library**.\
     ![APIs & Services > Library](https://4191868192-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOlFHF8fl339QOw3Og8L7%2Fuploads%2Fgit-blob-37bac8186f1b273c3d14f2cfef376cac1aac8d17%2Fimage1.png?alt=media)
   * If no project exists, create one:
     * Click the **project dropdown** → **New Project**.
     * Provide a project **Name** and **Location**.\
       ![Create New Project](https://4191868192-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOlFHF8fl339QOw3Og8L7%2Fuploads%2Fgit-blob-b5de837e44011aaf5f7f3356eab4df4a09fb959a%2Fimage2.png?alt=media)
   * Select the newly created project and click **Open**.\
     \&#xNAN;*Tip: wait for the project creation notification to complete before proceeding.*
   * Search for **Admin SDK API** and click **Enable**.\
     ![Enabling Admin SDK API](https://4191868192-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOlFHF8fl339QOw3Og8L7%2Fuploads%2Fgit-blob-784b864996b739513b3cd30e581021bd64d81edb%2Fimage3.png?alt=media)

***

## Step 2: Create a Service Account

1. **Open Service Accounts**
   * Click the top-left **Menu**.
   * Navigate to **IAM & Admin → Service Accounts**.\
     ![IAM & Admin > Service Accounts](https://4191868192-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOlFHF8fl339QOw3Og8L7%2Fuploads%2Fgit-blob-8c9663a2829304ab81f71b0d531bc14a3359a1c6%2Fimage4.png?alt=media)
2. **Create the Service Account**
   * Click **Create Service Account** and enter a **Service account name**.\
     \&#xNAN;*(Optional) Add a description.*\
     ![Create Service Account Form](https://4191868192-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOlFHF8fl339QOw3Og8L7%2Fuploads%2Fgit-blob-f5f11a45a7e4bf05032db7e1be779081d274350d%2Fimage5.png?alt=media)
   * Click **Create**.
3. **Assign a Role**
   * Assign **Project Viewer** (or a more restrictive role suitable for your governance).
   * Click **Continue**.\
     ![Assign Role](https://4191868192-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOlFHF8fl339QOw3Og8L7%2Fuploads%2Fgit-blob-fc8127a63c71905f6c414ccdb275e45c613d593a%2Fimage7.png?alt=media)
4. **Generate a P12 Key**
   * Open the service account and click **Manage Keys**.\
     ![Manage Keys and Generate New Key](https://4191868192-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOlFHF8fl339QOw3Og8L7%2Fuploads%2Fgit-blob-43eecf9935c174f2c7337ba4a19851e29552874e%2Fimage6.png?alt=media)
   * Click **Add Key → Create New Key**.\
     ![Create New Key](https://4191868192-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOlFHF8fl339QOw3Og8L7%2Fuploads%2Fgit-blob-0d524a840e3a77e492e2bf044f92f21bea16ee59%2Fimage6.1.png?alt=media)
   * Choose key type **P12** and click **Create**.\
     ![Select P12 Key](https://4191868192-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOlFHF8fl339QOw3Og8L7%2Fuploads%2Fgit-blob-0cd832bcb0abe6c94f6c776cacfbd9573e8b5e4e%2Fimage.png?alt=media)
   * **Download** the P12 file when prompted and store it securely.
   * **Private key password:** set to `notasecret`.\
     ![Private Key Password](https://4191868192-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOlFHF8fl339QOw3Og8L7%2Fuploads%2Fgit-blob-981fc1a6273de61a91b6a9c55d0370bdf9935aa8%2Fimage6.3.png?alt=media)
   * Record the file **path/name** for future reference, then **Close**.

***

## Step 3: Add the Service Account to G Suite (Domain-Wide Delegation)

1. **Open Admin Console**
   * Go to your G Suite **Admin console**.
   * Search for **API Controls**.\
     ![API Controls in Admin Console](https://4191868192-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOlFHF8fl339QOw3Og8L7%2Fuploads%2Fgit-blob-343e298934ff8d7d65418fef5eac3fe2e30dea95%2Fimage7.1.png?alt=media)
2. **Manage Domain-Wide Delegation**
   * Click **Manage Domain Wide Delegations**.\
     ![Manage Domain Wide Delegations](https://4191868192-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOlFHF8fl339QOw3Og8L7%2Fuploads%2Fgit-blob-9df4df4051699b49019cf91c32cd558feb9251a6%2Fimage7.2.png?alt=media)
   * In **Authentication**, click **Add New**.
3. **Authorize the Client**
   * In **Client ID**, enter the **OAuth 2 Client ID** of the service account\
     (found in **IAM & Admin → Service Accounts** in Cloud Console).\
     ![Client ID and OAuth Scopes](https://4191868192-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOlFHF8fl339QOw3Og8L7%2Fuploads%2Fgit-blob-6f46ec674da06d78bb88fd39df55db381278d2bc%2Fimage7.3.png?alt=media)
   * In **OAuth scopes**, add:

     ```
     https://www.googleapis.com/auth/admin.reports.audit.readonly
     ```

     ![Authorize Scopes](https://4191868192-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOlFHF8fl339QOw3Og8L7%2Fuploads%2Fgit-blob-0ea0b0f18727abbb8ea9c38c4488f6f07b82cc89%2Fimage7.5.png?alt=media)
   * Click **Authorize**.

***

## Deliverables

Email the following to [**support@threatdefence.com**](mailto:support@threatdefence.com):

1. **P12 Key**
   * The downloaded **.p12** file (stored securely).
2. **Service Account Email Address**
   * Found under **IAM & Admin → Service Accounts** in Google Cloud Console.
3. **Administrator Email Address**
   * The admin email used when configuring domain-wide delegation.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.threatdefence.com/siem-integrations/software-as-a-service/google-workspace.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
