> For the complete documentation index, see [llms.txt](https://docs.stoik.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.stoik.io/email-security/microsoft-365.md).

# Setup: Microsoft 365

Connect your Microsoft 365 tenant so Email Security can analyze your mailboxes. Every mailbox gets the same features, whatever its Microsoft license.

## Prerequisites

* A Microsoft 365 **Global Administrator** account.

## Connect your tenant

{% stepper %}
{% step %}

### Sign in to Microsoft

1. In Stoïk Protect, go to `Email Security` > `Settings`.
2. Select `Microsoft 365` and click `Confirm`.
3. Sign in with your Global Administrator account.
   {% endstep %}

{% step %}

### Accept the permissions

Review and accept the requested permissions. See [Required permissions](/email-security/microsoft-365/permissions.md) for what each one is used for.
{% endstep %}

{% step %}

### Follow the guided setup

Stoïk Protect detects your license type and shows the right path:

* **No action needed**: you are redirected to the results page. The setup is complete.
* **Minimal action required**: enable audit in Microsoft Purview. See [Enable audit in Microsoft Purview](#enable-audit-in-microsoft-purview).
* **Full setup required**: configure Purview access first, then enable audit. See [Configure Microsoft Purview access](#configure-microsoft-purview-access).
  {% endstep %}
  {% endstepper %}

## Configure Microsoft Purview access

Only if Stoïk Protect asks for it and Purview access is not configured yet.

1. Go to the [Azure Portal](https://portal.azure.com/) and sign in with an administrator account.
2. Open the `Marketplace`.
3. Search for Microsoft Purview, select it, and click `Create`.

## Enable audit in Microsoft Purview

Only if Stoïk Protect asks for it.

1. Go to [Microsoft Purview](https://purview.microsoft.com/) and sign in with an administrator account.
2. Open `Solutions` > `Audit`.
3. Click `Start recording user and admin activity`.

If Purview shows an error, see [Purview activation errors](/email-security/microsoft-365/purview-errors.md).

## After the connection

* Monitored mailboxes appear in `Email Security` > `Mailboxes`. See [Mailbox statuses](/email-security/mailbox-statuses.md).
* Stoïk retrieves the emails of the past 90 days for all monitored mailboxes, starting with the oldest. This can take some time.

To connect another tenant (Microsoft 365 or Google Workspace), go to `Email Security` > `Settings`, click `Add a provider` and follow the same steps. You can connect as many tenants as you need.

{% hint style="info" %}
If the users list doesn't show up more than 10 minutes after synchronization, contact <protect@stoik.io>.
{% endhint %}


---

# 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.stoik.io/email-security/microsoft-365.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.
