This page describes how to create a data store and connect Microsoft 365
to Gemini Enterprise.

## Before you begin

Before you set up your Microsoft 365 connection, do the following:

1.
   Grant the Discovery Engine Editor role (`roles/discoveryengine.editor`). This role is required for the user to create the data store. To grant this role, do the following:

   1. In the Google Cloud console, go to the **IAM** page.

      [Go to IAM](https://console.cloud.google.com/iam-admin/iam)
   2. Locate the user account and click edit **Edit**.
   3. Grant the `Discovery Engine Editor` role to the user. For more information, see [IAM roles and permissions](https://cloud.google.com/gemini/enterprise/docs/access-control).

   <br />

2. Choose how the connector authenticates to Microsoft 365:

   - **OAuth 2.0 (Google Managed)** (default): The connector uses an Microsoft Entra application that Google manages. You don't register an application or enter a client ID or client secret. Depending on your tenant's consent settings and the actions you enable, an Microsoft Entra administrator might need to grant consent for your organization.
   - **OAuth 2.0 (Bring Your Own App)**: Register your own Microsoft Entra application and grant it the Microsoft Graph permissions for the actions you plan to enable. You need the tenant ID, client ID, and client secret from that application to complete the steps on this page.

   For details, see
   [Microsoft 365 configuration](https://docs.cloud.google.com/gemini/enterprise/docs/connectors/ms-365/third-party-config.md.txt).

## Create the Microsoft 365 data store

To create the Microsoft 365 data store, follow these steps:

1. In the Google Cloud console, go to the Gemini Enterprise page.

   [Go to Gemini Enterprise](https://console.cloud.google.com/gen-app-builder/engines)
2. Click **Data stores** in the navigation menu.

3. Click **Create data store**.

4. In the **Source** section, search for **Microsoft 365** , and click
   **Select**.

5. In the **Actions** section, under **Select Microsoft 365 actions to
   enable**, choose the actions you want to enable:

   - The actions are grouped by the Microsoft 365 surface they act on:
     **Users and groups** , **SharePoint and OneDrive** , **Outlook** , and
     **Teams**. Select a group to enable every action in it, or select
     individual actions.

   - Read-only actions appear in the same list as the actions that write. Only
     **Get my profile** is preselected, so select the other read-only actions
     you need as well.

   - To find an action by name, use **Search actions** . To enable every
     action, select **Select all actions**.

   > [!NOTE]
   > **Note:** Select the actions before you authenticate. Gemini Enterprise builds the authorization request from the actions you select here, so your selection determines which Microsoft Graph permissions the user is asked to consent to.

6. Click **Continue**.

7. In the **Data** section, expand **Authentication settings** . For **Select
   your authentication method**, choose one of the following options:

   - **OAuth 2.0 (Google Managed)** (default):

     You don't enter a tenant ID, client ID, or client secret. Leave
     **Microsoft 365 Environment Type** set to **Standard**: the
     Google-managed application is registered in the commercial
     Microsoft cloud. Each user authorizes the connector with their
     Microsoft 365 account when they first use it in the app.
   - **OAuth 2.0 (Bring Your Own App)**:

     1. Enter the following details from your Microsoft Entra application:

        - **Tenant ID**: The tenant ID of your Microsoft 365 tenant.
        - **Client ID**: The client ID of your Microsoft Entra app registration.
        - **Client Secret**: The client secret of your Microsoft Entra app registration.
        - **Microsoft 365 Environment Type** : Select **Standard** for tenants on `login.microsoftonline.com`, or **US Government** for tenants on `login.microsoftonline.us`.
     2. Click **Verify Auth**, sign in with the account you want the
        connector to act as, and grant consent. Gemini Enterprise stores
        the resulting refresh token on the connection; you don't enter it
        yourself.

8. Click **Continue**.

9. Expand **Advanced options** and do the following:

   1.
      If the create data store flow shows an **Advanced options** section, you can select the **Enable Static IP Addresses** checkbox within it. This ensures the data store uses a fixed set of IP addresses for outbound traffic, suitable for allowlisting on the source system. For more information, see [Configure static IP egress](https://docs.cloud.google.com/gemini/enterprise/docs/connectors/configure-static-ip-egress.md.txt).

      Static IP addresses are available only with **OAuth 2.0 (Bring Your Own
      App)**.
   2. Optional: For **Microsoft 365 Cloud Environment** , select the
      Microsoft Graph endpoint your tenant uses: **Standard / GCC** ,
      **GCC High** , or **DoD** . If you leave this unset, the connector uses
      **Standard / GCC**.

   3. Click **Continue**.

10. Expand **Entities to search** and select **Enterprise Search**.

11. Click **Continue**.

12. In the **Configuration** section:

    1. From the **Multi-region** list, select the location for your data store.

    2. In the **Your data connector name** field, enter a name for your
       data store.

    3. Optional: In the **Tag** field, enter a stable identifier for this
       data store across versions. This value is immutable after you set it.

    4. If you selected `us` or `eu` as the location, configure the
       **Encryption settings**:

       - Optional: If you haven't configured single-region keys, click **Go to settings page** to do so. For more information, see [Register a single-region key for third-party connectors](https://docs.cloud.google.com/gemini/enterprise/docs/cmek.md.txt#third-party-connectors-key-registration).
       - Select **Google-managed encryption key** or **Cloud KMS
         key**.
       - If you selected **Cloud KMS key** :
         - In the **Key management type** list, select the appropriate type.
         - In the **Cloud KMS key** list, select the key.
    5. Optional: In the **Sensitive Data Protection policy** section, attach an
       existing
       [Sensitive Data Protection](https://cloud.google.com/sensitive-data-protection/docs/sensitive-data-protection-overview)
       policy to inspect and de-identify data that Gemini Enterprise retrieves
       through this data store. If your organization doesn't require a
       Sensitive Data Protection policy, you can skip this step.

13. Click **Create**.

On the **Data Stores** page, click your data store name to see the status.
After the data store state changes from **Creating** to **Active**, you can
start using the Microsoft 365 data store.

After creating the data store, connect the data store you just created to
an existing app or [create a new app](https://docs.cloud.google.com/gemini/enterprise/docs/create-app.md.txt) and
[connect](https://docs.cloud.google.com/gemini/enterprise/docs/connect-existing-data-store) it to the new app, and
[authorize](https://docs.cloud.google.com/gemini/enterprise/docs/connect-existing-data-store#user_authorization)
Gemini Enterprise to access Microsoft 365 before executing any queries.

## Change the enabled actions

You select the actions to enable in the **Actions** step when you create the
data store. To add or remove actions afterwards, see
[Add actions](https://docs.cloud.google.com/gemini/enterprise/docs/manage-actions#add-actions).

> [!NOTE]
> **Note:** If you add actions after the data store was created, re-authorize the connection. Until you do, the new actions fail with an HTTP 403 error, because the stored token was issued for the previous set of scopes. If you use **OAuth 2.0 (Bring Your Own App)** , confirm that your Microsoft Entra app registration also grants the permission each new action needs; see [Supported actions](https://docs.cloud.google.com/gemini/enterprise/docs/connectors/ms-365.md.txt#supported-actions).


## Data handling and query execution

This section describes how Gemini Enterprise manages your query and the privacy implications of using the federated data store.

### Query execution

After you authorize Microsoft 365 and send a search query to Gemini Enterprise:

- Gemini Enterprise sends your search query directly to the Microsoft Graph API.
- Gemini Enterprise blends the results with those from other connected data sources and displays a comprehensive search result.

### Data handling

When using third-party federated search, the following data handling rules apply:

- Your query string is sent to the third-party search backend (Microsoft Graph API).
- These third parties may associate queries with your identity.
- If multiple federated search data sources are enabled, the query might be sent to all of them.
- After the data reaches the third-party system, it is governed by that system's terms of service and privacy policies.

> [!NOTE]
> **Note:** To improve accuracy, an LLM may rewrite your query before it is sent to Microsoft 365. This rewritten query can incorporate information from your session's query history. As a result, parts of your query history might also be included in the query sent to the Microsoft Graph API.

<br />

## What's next

- To provide a user interface for querying your Microsoft 365 data, [create an app](https://docs.cloud.google.com/gemini/enterprise/docs/create-app.md.txt) and [connect it to the Microsoft 365 data store](https://docs.cloud.google.com/gemini/enterprise/docs/connect-existing-data-store).
- To view and manage the list of actions you enabled for the Microsoft 365 data store, see [View and manage actions](https://docs.cloud.google.com/gemini/enterprise/docs/manage-actions).
- To preview how your search results appear after your app is set up, see [Get search results](https://docs.cloud.google.com/gemini/enterprise/docs/preview-search-results.md.txt).
- To enable alerts for the data store, see [Configure alerts for third-party data stores](https://docs.cloud.google.com/gemini/enterprise/docs/configure-periodic-data-alerts).