> For the complete documentation index, see [llms.txt](https://docs.stackai.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.stackai.com/integrations/catalog/microsoft-outlook/set-up-a-custom-outlook-oauth-connector.md).

# Set up a custom Outlook OAuth connector

Create a custom OAuth connector when authentication must run through your Microsoft Entra app. This applies to single-tenant and on-premises deployments. It also applies when you must restrict the requested scopes.

You'll register an app in Microsoft Entra ID, grant delegated Microsoft Graph permissions, create a client secret, and add those credentials to StackAI.

{% stepper %}
{% step %}

### Register an app in Microsoft Entra ID

1. Sign in to the [Microsoft Entra admin center](https://entra.microsoft.com/) or [Azure portal](https://portal.azure.com/).
2. Go to **Identity** → **Applications** → **App registrations**.
3. Select **New registration**.
4. Complete the form:
   * **Name:** Use a descriptive name, such as `StackAI Outlook OAuth2 Connector`.
   * **Supported account types:** Select **Single tenant**.
   * **Redirect URI:** Select **Web**. Enter `https://www.stackai.com/auth`.

{% hint style="info" %}
For single-tenant and on-premises deployments, the redirect URI is instance-specific. StackAI displays the correct URI when you create the connector.
{% endhint %}

5. Select **Register**.
6. On the app's **Overview** page, copy these values:
   * **Application (client) ID:** Use this as the **Client ID** in StackAI.
   * **Directory (tenant) ID:** Use this as the **Tenant ID** in StackAI.
     {% endstep %}

{% step %}

### Add Microsoft Graph API permissions

A custom OAuth2 connector uses delegated Microsoft Graph permissions. The app acts on behalf of the signed-in user.

<table><thead><tr><th width="260.0390625">Permission</th><th width="150">Type</th><th>Purpose</th></tr></thead><tbody><tr><td><code>User.Read</code></td><td>Delegated</td><td>Read the signed-in user's profile for health checks via <code>/me</code>.</td></tr><tr><td><code>Mail.Read</code></td><td>Delegated</td><td>Read emails for the Search Emails action.</td></tr><tr><td><code>Mail.ReadWrite</code></td><td>Delegated</td><td>Create drafts, add attachments, modify messages, and reply or forward.</td></tr><tr><td><code>Mail.Send</code></td><td>Delegated</td><td>Send emails as the signed-in user.</td></tr><tr><td><code>MailboxSettings.Read</code></td><td>Delegated</td><td>Get the list of email categories.</td></tr><tr><td><code>Calendars.ReadWrite</code></td><td>Delegated</td><td>Read calendars and create events.</td></tr><tr><td><code>offline_access</code></td><td>Delegated</td><td>Obtain refresh tokens.</td></tr><tr><td><code>openid</code></td><td>Delegated</td><td>OpenID Connect sign-in.</td></tr><tr><td><code>profile</code></td><td>Delegated</td><td>Read basic profile information.</td></tr><tr><td><code>email</code></td><td>Delegated</td><td>Read the user's email address.</td></tr><tr><td><code>Mail.Read.Shared</code></td><td>Delegated</td><td>Read email in shared mailboxes and mailboxes delegated to the signed-in user</td></tr><tr><td><code>Mail.ReadWrite.Shared</code></td><td>Delegated</td><td>Create drafts, modify, reply to and forward messages in shared or delegated mailboxes</td></tr><tr><td><code>Mail.Send.Shared</code></td><td>Delegated</td><td>Send email from a shared or delegated mailbox</td></tr><tr><td><code>Calendars.ReadWrite.Shared</code></td><td>Delegated</td><td>Read and create events in calendars shared with or delegated to the signed-in user</td></tr></tbody></table>

{% hint style="info" %}
Confirm the scopes for your intended actions in [Outlook connector settings](https://www.stackai.com/settings/connectors/outlook).
{% endhint %}

1. In the app registration, go to **API permissions** → **Add a permission**.
2. Select **Microsoft Graph**.
3. Select **Delegated permissions**.
4. Select each required permission from the table.
5. Select **Add permissions**.
   {% endstep %}

{% step %}

### Grant admin consent

Pre-authorize high-privilege permissions for your tenant. This avoids individual consent prompts and tenant policy blocks.

1. In the app registration, go to **API permissions**.
2. Select **Grant admin consent for \_your tenant name**\_.
3. Confirm the dialog.

Each permission should show **Granted for \_tenant**\_ in the **Status** column.

{% hint style="info" %}
You need at least the **Cloud Application Administrator** role to grant consent.
{% endhint %}
{% endstep %}

{% step %}

### Create a client secret

1. In the app registration, go to **Certificates & secrets** → **Client secrets**.
2. Select **New client secret**.
3. Add a description and choose an expiration period.
4. Select **Add**.
5. Copy the secret **Value** immediately. Use it as the **Client Secret** in StackAI.
   {% endstep %}

{% step %}

### Add the connector in StackAI

1. Go to [**Settings** → **Connectors** → **Outlook**](https://www.stackai.com/settings/connectors/outlook).
2. Enter the **Client ID**, **Tenant ID**, and **Client Secret**.
3. Save the connector.

Users can now sign in with this connector. Authentication runs through your Entra app.
{% endstep %}
{% endstepper %}

## Connection fields and action reference

See [Microsoft Outlook](https://docs.stackai.com/integrations/catalog/microsoft-outlook.md) for the current connector fields and supported actions.


---

# 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.stackai.com/integrations/catalog/microsoft-outlook/set-up-a-custom-outlook-oauth-connector.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.
