> 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/mdr/deploy/microsoft-defender.md). Agents can also search and read this documentation through its [MCP server](https://docs.stoik.io/~gitbook/mcp).

# Microsoft Defender

Connect your Microsoft Defender tenant to Stoïk so the Stoïk SOC team can monitor your devices and respond to threats.

The Microsoft licences stay yours: Stoïk does not sell them. To know which alerts the SOC handles, see [Monitoring and response](https://docs.stoik.io/mdr/deploy/microsoft-defender/monitoring.md).

Your Microsoft portals are not in English? See [Portal labels](https://docs.stoik.io/mdr/deploy/microsoft-defender/portal-labels.md) for the menu and button names in your language.

Stoïk needs two accesses to your tenant. Both are required:

* **The Stoïk application** ([Part A](#part-a-authorise-the-stoik-application)): sends your alerts and devices to Stoïk Protect and to the Stoïk SOC.
* **The Stoïk MDR guest account** ([Part B](#part-b-give-the-stoik-soc-team-access-to-your-defender-portal)): lets Stoïk analysts investigate and respond in your Defender portal.

## Prerequisites

* A **Global Administrator** account in the tenant that holds your devices. For [B.4](#b.4-create-the-stoik-role-in-defender), a **Security Administrator** account also works.
* A Defender licence for every device: see [Licences](https://docs.stoik.io/mdr/deploy/microsoft-defender/licences.md).
* The Defender agent on every device: see [Operating systems](https://docs.stoik.io/mdr/deploy/microsoft-defender/os.md).

## Part A: Authorise the Stoïk application

{% hint style="warning" %}
Do Part A and Part B in the **same Microsoft tenant**: the one where your devices appear in `Assets` > `Devices`.
{% endhint %}

1. In [Stoïk Protect](https://app.stoik.io), go to `MDR` > `Settings`.
2. Click **Connect your Microsoft account**.

   <figure><img src="https://2582414397-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FaDGGQ49Oui29Ft0kJjSm%2Fuploads%2FJ27yVAk93QDQsSIRVQsx%2FScreenshot%202026-04-21%20at%2010.11.45.png?alt=media&amp;token=ffa7861f-44e1-498c-a111-eaa8562a86ae" alt="" width="375"><figcaption></figcaption></figure>
3. You are redirected to Microsoft. Sign in with a **Global Administrator** account of the tenant that holds your devices.
4. Review the permissions requested by the Stoïk MDR application, then click **Accept**. To know what each permission does, see [Permissions](https://docs.stoik.io/mdr/deploy/microsoft-defender/permissions.md).
5. Back in Stoïk Protect, note the **Microsoft Tenant ID**. It must match the one in [B.1](#b.1-invite-the-stoik-mdr-user).\
   If it differs, contact <protect@stoik.io> before going further.

{% hint style="info" %}

* Stoïk Protect shows the same devices as `Assets` > `Devices` in Defender, once the `Machine.Read.All` permission is approved: see [Permissions](https://docs.stoik.io/mdr/deploy/microsoft-defender/permissions.md).
* Connected before these permissions were added? Re-approve the Stoïk application: see [Permissions](https://docs.stoik.io/mdr/deploy/microsoft-defender/permissions.md#existing-clients).
* Stoïk Protect shows one tenant per client. If you have several, contact your CSM at <protect@stoik.io>.
  {% endhint %}

## Part B: Give the Stoïk SOC team access to your Defender portal

{% hint style="info" %}
Your steps depend on your Defender licence: see [Check your licences](https://docs.stoik.io/mdr/deploy/microsoft-defender/licences.md#check-your-licences).

* **Defender for Business:** do B.1 to B.4. In B.4, the last step is already done, and there is no legacy roles option.
* **Defender for Endpoint Plan 2:** do B.1 to B.4, then B.5 if you have device groups.
  {% endhint %}

### B.1: Invite the Stoïk MDR user

{% stepper %}
{% step %}

#### Open the invite form

In [entra.microsoft.com](https://entra.microsoft.com), go to `Entra ID` > `Users` > `All users`.

Click **New user** > **Invite external user**.

<figure><img src="https://2582414397-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FaDGGQ49Oui29Ft0kJjSm%2Fuploads%2FFJBh3TOnPyKo4oQgp1lp%2Fazure-portal-users-invite-external-user.png?alt=media&amp;token=082c050f-ea20-4b37-a11c-70e49f8e0043" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

#### Fill in the form

* **Email:** `mdr_api@stoikcert.onmicrosoft.com`
* **Display name:** `Stoik_Mdr_Api`
* **Assignments** tab > **Add role**: select **Security Operator**, then **Select**.

Check that the tenant ID shown matches the one from Part A.

<figure><img src="https://2582414397-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FaDGGQ49Oui29Ft0kJjSm%2Fuploads%2FmMCAn1mu4QB71K9WwsYG%2Fazure-portal-invite-tenant.png?alt=media&amp;token=d8dab891-9674-4e9b-a13e-8097611752fc" alt=""><figcaption></figcaption></figure>

<figure><img src="https://2582414397-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FaDGGQ49Oui29Ft0kJjSm%2Fuploads%2F2oHLYYIQa0PUzkFIbIDM%2Fazure-portal-invite-external-user-assignments.png?alt=media&amp;token=487ffb49-f790-41f0-bd9f-61994b7a8713" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
The role does not show afterwards? Refresh the page: it is a known Microsoft display bug.
{% endhint %}
{% endstep %}

{% step %}

#### Send the invitation

Click **Review + invite**, then **Invite**.

<figure><img src="https://2582414397-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FaDGGQ49Oui29Ft0kJjSm%2Fuploads%2Fltyza0X2WhCcXbIErXpw%2Fazure-portal-invite-external-user-review.png?alt=media&amp;token=1c0cb9df-8683-4ccf-b817-92fc7a4bf5e9" alt="" width="375"><figcaption></figcaption></figure>
{% endstep %}
{% endstepper %}

{% hint style="info" %}
In your tenant, the guest's user name becomes `mdr_api_stoikcert.onmicrosoft.com#EXT#@<your-tenant>.onmicrosoft.com`.

In the next steps, search for it by its display name, **Stoik\_Mdr\_Api**, not by its email.
{% endhint %}

### B.2: Create the Stoik-MDR group

Defender device groups and legacy Defender roles accept groups only, never individual users. Use this group, not the user, in the next steps.

1. In [entra.microsoft.com](https://entra.microsoft.com), go to `Entra ID` > `Groups` > `All groups` > **New group**.

   <figure><img src="https://2582414397-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FaDGGQ49Oui29Ft0kJjSm%2Fuploads%2Fgit-blob-b3101e4ff5f5742aa7cc717174855a0dc5ce5b65%2Fentra-groups-new-group.png?alt=media" alt=""><figcaption></figcaption></figure>
2. Fill in:

   * **Group type:** `Security`
   * **Group name:** `Stoik-MDR`
   * **Membership type:** `Assigned`
   * **Members:** click **No members selected**, then add **Stoik\_Mdr\_Api**.

   <figure><img src="https://2582414397-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FaDGGQ49Oui29Ft0kJjSm%2Fuploads%2Fgit-blob-4714c19082562b69aaee2b2a50e08c0f0d364475%2Fentra-new-group-stoik-mdr.png?alt=media" alt=""><figcaption></figcaption></figure>
3. Click **Create**.

### B.3: Let the Stoïk account sign in

Two Entra settings can block the Stoïk account when it signs in to your tenant: MFA and Conditional Access. Check both.

{% stepper %}
{% step %}

#### Accept the MFA done by Stoïk

Stoïk analysts already complete MFA in Stoïk's tenant. This setting lets your tenant accept it, instead of asking them again: they cannot answer a second MFA prompt.

{% hint style="info" %}
**Optional** only if your tenant enforces no MFA at all: security defaults off, and no Conditional Access policy that requires MFA. If in doubt, do it: it changes nothing else.
{% endhint %}

1. In [entra.microsoft.com](https://entra.microsoft.com), go to `Entra ID` > `External Identities` > `Cross-tenant access settings`.
2. In the `Organizational settings` tab, click **Add organization**.
3. Enter the Stoïk tenant ID, `8100d7bd-172a-492e-bb96-e3f923731bd9` (or `stoikcert.onmicrosoft.com`), then click **Add**.
4. In the `Inbound access` column, click the link (usually `Inherited from default`).
5. Open the `Trust settings` tab and select **Customize settings**.
6. Tick `Trust multi-factor authentication from Microsoft Entra tenants`, then click **Save**.
   {% endstep %}

{% step %}

#### Check your Conditional Access policies

1. Go to `Entra ID` > `Conditional Access` > `Policies`. No policy, or all set to `Off`: you are done.
2. Otherwise, click **What If**. Select **Stoik\_Mdr\_Api**, **All resources**, a device platform and a client app (all four are required), then run it. The result lists the policies that apply to the Stoïk account.
3. For each listed policy that requires more than MFA (block, compliant device, location, risk level): under `Users` > `Exclude`, add the `Stoik-MDR` group, then click **Save**. The policy still applies to everyone else.

Policies that only require MFA are covered by the previous step.

If a sign-in fails later, open it in `Entra ID` > `Monitoring & health` > `Sign-in logs`. Its `Conditional Access` tab names the policy that blocked it.
{% endstep %}
{% endstepper %}

### B.4: Create the Stoïk role in Defender

{% hint style="warning" %}
**Before you start**, check which permission model your tenant uses.

Open `Setup & configuration` > `Permissions` > `Microsoft Defender XDR` > `Roles` > **Workload settings**, and look at **Endpoints & Vulnerability Management**:

* **Active** (always the case on Defender for Business): follow the steps below.
* **Not active** (Plan 2 only): your tenant still uses the legacy Defender for Endpoint roles. Step 5 activates it, and the legacy roles then stop working for **all** your users. Choose one:
  * Your teams do not use legacy roles: follow the steps below.
  * Your teams use them: import them first with **Import roles** on the `Roles` page, then follow the steps below.
  * You do not want to change your roles now: skip the steps below and use *Keep the legacy Defender for Endpoint roles* instead.
    {% endhint %}

{% stepper %}
{% step %}

#### Open the Roles page

In [security.microsoft.com](https://security.microsoft.com), sign in as **Global Administrator** or **Security Administrator**.

Go to `Setup & configuration` > `Permissions` > `Microsoft Defender XDR` > `Roles`. Direct link: [security.microsoft.com/mtp\_roles](https://security.microsoft.com/mtp_roles).

<figure><img src="https://2582414397-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FaDGGQ49Oui29Ft0kJjSm%2Fuploads%2Fgit-blob-c9b07745f8d8898a4264ac1cd341f12bf6e5348b%2Fmicrosoft-security-system-permissions-roles.png?alt=media" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

#### Create the custom role

Click **Create custom role** and name it `stoik_mdr_role`.

<figure><img src="https://2582414397-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FaDGGQ49Oui29Ft0kJjSm%2Fuploads%2FH3rzxW1t5X9JnDyhVXrL%2Fmicrosoft-security-permissions-roles-add.png?alt=media&amp;token=2f8b3a94-1749-4846-9f89-31be3bb8fcd8" alt=""><figcaption></figcaption></figure>

<figure><img src="https://2582414397-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FaDGGQ49Oui29Ft0kJjSm%2Fuploads%2F2h1FzJS2rhuhbO8HA9li%2Fmicrosoft-security-permissions-roles-add-setup-basics.png?alt=media&amp;token=7a1558bb-6030-4f53-895c-fdddf228eaee" alt="" width="375"><figcaption></figcaption></figure>
{% endstep %}

{% step %}

#### Set the permissions

For each permission group (**Security operations**, **Security posture**, **Authorization and settings**): select **All read and manage permissions**, then click **Apply**.

Then click **Next**.

<figure><img src="https://2582414397-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FaDGGQ49Oui29Ft0kJjSm%2Fuploads%2FP6xHDJ63Yb3DPCFZk3oE%2Fmicrosoft-settings-authorization-and-settings.png?alt=media&amp;token=98c0fe8e-133b-41e0-85d3-2dbca7e2a570" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

#### Assign the Stoik-MDR group

Click **Add assignment** and fill in:

* **Assignment name:** `stoik_mdr_assignment`
* **Employees:** the `Stoik-MDR` group
* **Data sources:** **Choose all data sources**, and tick **Include future data sources automatically**

Click **Add**, **Next**, then **Submit**.

<figure><img src="https://2582414397-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FaDGGQ49Oui29Ft0kJjSm%2Fuploads%2Fb3lIdpsPj6FsV0ZSMlJ7%2Fmicrosoft-security-assigment-details.png?alt=media&amp;token=e276326b-6c53-44c6-9b74-46377f8f18b0" alt=""><figcaption></figcaption></figure>

<figure><img src="https://2582414397-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FaDGGQ49Oui29Ft0kJjSm%2Fuploads%2F8LvLf582dkw7KpjNnqLP%2Fmicrosoft-security-assigment-validating.png?alt=media&amp;token=18d03c49-3cdc-41e1-914a-e343965e5d2e" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

#### Check the workload

In **Workload settings**, check that **Endpoints & Vulnerability Management** is active.

If it is not, activate it and confirm with **Activate**: without it, the role gives no access to devices.

On Defender for Business, it is already active.
{% endstep %}
{% endstepper %}

<details>

<summary>Keep the legacy Defender for Endpoint roles (Plan 2 only)</summary>

Use this only if the workload is not active and you do not want to migrate your legacy roles now.

Your other users keep their roles. Stoïk's access to devices then depends on this role only.

1. Go to `Setup & configuration` > `Settings` > `Endpoints` > `Permissions` > `Roles`.\
   Or: `Setup & configuration` > `Permissions` > `Endpoints roles & groups` > `Roles`.
2. Click **Add role** and name it `stoik_mdr_role`.
3. Tick all permissions, including **Live response capabilities: Advanced**.
4. Click **Next**, select the `Stoik-MDR` group, then click **Save and close**.

</details>

### B.5: Give access to your device groups

Defender for Endpoint Plan 2 only, and only if you have device groups. Defender for Business has no device groups in this menu.

A device group that does not list `Stoik-MDR` hides its devices from Stoïk, servers included.

1. Go to `Setup & configuration` > `Settings` > `Endpoints` > `Permissions` > `Device groups`.\
   Or: `Setup & configuration` > `Permissions` > `Endpoints roles & groups` > `Device groups`.\
   Direct link: [security.microsoft.com/securitysettings/endpoints/machine\_groups](https://security.microsoft.com/securitysettings/endpoints/machine_groups).
2. For **each** device group, **including `Ungrouped devices (default)`**: open the **User access** step, add `Stoik-MDR`, then click **Save and close**.
3. Do the same for every device group you create later.

Changes can take a few hours to apply.

## Check the setup and notify Stoïk

1. In the Defender portal, note your number of devices in `Assets` > `Devices` ([direct link](https://security.microsoft.com/machines)). It must match the number shown in Stoïk Protect.\
   Count workstations and servers only: Stoïk does not monitor mobile devices or network devices.
2. In [entra.microsoft.com](https://entra.microsoft.com), go to `Enterprise applications` > the Stoïk application > `Permissions`, and check that all permissions show **Granted for \<your organisation>**.
3. Email the number of devices to <protect@stoik.io>.

The onboarding is complete when the Stoïk SOC team confirms it.

<details>

<summary>Re-approving the Stoïk application (existing clients)</summary>

When Stoïk adds a permission to its application, a Global Administrator of your tenant must approve it again:

1. Ask your Stoïk CSM, or <protect@stoik.io>, for the approval link.
2. Open the link with a **Global Administrator** account, then click **Accept**.

An error page may appear afterwards. You can ignore it: the approval is recorded. See [Permissions](https://docs.stoik.io/mdr/deploy/microsoft-defender/permissions.md).

This only affects the Stoïk application (Part A), not the guest account's access to your Defender portal (Part B).

</details>

Something does not work? See [Troubleshooting](https://docs.stoik.io/mdr/deploy/microsoft-defender/troubleshooting.md). To revoke Stoïk's access to your tenant, contact <protect@stoik.io>.


---

# 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/mdr/deploy/microsoft-defender.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.
