Microsoft Defender for Endpoint
Microsoft Defender for Endpoint
Description
Microsoft Defender for Endpoint (MDE) can be enabled on the virtual machines of the lab, reporting into your own tenant.
Its sensor is available on both Windows and Linux.
Warning
For now, Microsoft Defender for Endpoint is only available on development platforms: the M&NTIS platform does not offer it when a lab is configured.
Warning
Microsoft Defender for Endpoint is not yet available on Windows Server 2016 machines.
Alerts and telemetry are sent to your Defender tenant. At the end of the lab, M&NTIS reads the alerts back through the Defender for Endpoint API and lines them up against the attack steps that were executed, so you can see which steps were detected and which were not.
How to enable
You need two things from your tenant: API credentials and the onboarding files.
1. Register an application for the API
In the Microsoft Entra admin center, create an app registration and give it application permissions on the WindowsDefenderATP API, then grant admin consent:
| Permission | What M&NTIS uses it for |
|---|---|
Alert.Read.All | reading the alerts raised during the lab |
AdvancedQuery.Read.All | running the detection queries shipped with the attacks |
Machine.Offboard | releasing those devices when the lab ends |
Note the Directory (tenant) ID, the Application (client) ID and a client secret. For the secret, under Certificates & secrets > New client secret, copy the Value column right away: the portal shows it only once, and the Secret ID next to it is not the secret.
2. Download the onboarding files
Open the Defender portal's Onboarding page — in the menu, Settings > Endpoints > Onboarding, Settings sitting at the bottom under Setup & configuration or System depending on the portal version — and download one file per operating system family your lab uses:
| Operating system to select | Then | Covers | Fields |
|---|---|---|---|
| Windows | Onboard, under Defender deployment tool: name the package, pick an expiry, copy the access key shown, then Download deployment tool | every Windows machine but Windows Server 2016 | deployment_tool_windows, and the key in deployment_tool_key_windows |
| Linux | Download script, under Onboarding script | every Linux machine | onboarding_package_linux |
Keep each .zip exactly as downloaded — nothing needs to be unzipped, opened or edited. The key reaches the tool on its command line, and M&NTIS removes it from the tool's logs afterwards; a collector that records command lines, such as Sysmon, still captures it when it runs on the machine before MDE is onboarded.
3. Fill the run configuration
On the M&NTIS run configuration page, click "Add" in the Microsoft Defender for Endpoint box, provide tenant_id, client_id and client_secret, and the files it asks for, with the access key for Windows: the form only shows the fields of the operating systems in your lab, and requires each of them. A machine missing its file — for a lab configured outside this form — stops the lab with an explicit error rather than running undetected, naming the entry to select in the portal.
The lab needs internet connectivity enabled: the sensor reaches your tenant through the lab's proxy.
Protection posture
MDE is set up to alert without blocking. That posture is set by the platform rather than by your own console. The defaults are:
| Expert setting | Default | Why |
|---|---|---|
real_time_protection | false | a real-time antivirus quarantines the attack's implant, and the scenario then never runs. Windows servers run Defender Antivirus in passive mode instead: it keeps scanning and reporting, without blocking |
asr_rules_mode | audit | Attack Surface Reduction rules report instead of blocking |
sample_submission | false | lab implants are not uploaded to Microsoft |
cloud_delivered_protection | true | improves detection quality without blocking by itself |
offboard_at_teardown | true | the lab's devices stop holding a licence in your tenant |
Warning
Applying this posture means changing Defender Antivirus settings locally, which tamper protection blocks — silently, the change appearing to succeed. Microsoft turns tamper protection on by default for enterprise tenants, for every device of the tenant: Settings > Endpoints > Optional features > Tamper protection. M&NTIS reads the setting back after onboarding, and a machine where it did not hold stops the lab with a message saying so. On a Windows client, onboarding itself turns real-time protection back on, and whether M&NTIS can turn it off again depends on tamper protection not having reached the machine yet: with it on, the same lab can pass one run and stop the next. Servers are not affected, as they run in passive mode. Use a tenant dedicated to labs with tamper protection turned off, or set real_time_protection to true and accept that the antivirus may block the attack before it can be measured. Do not turn tamper protection off in a tenant that also protects real devices.
Override any of these to harden the posture, and replay the same killchain against both configurations to see the difference.
Usage
Sign in to the Defender portal. Under Assets > Devices you should see the lab's machines appear once they are onboarded, within minutes on some days and after more than an hour on others. Alerts are under Incidents & alerts.
On a lab machine you can check the state directly:
- Windows:
sc.exe query sensereports the service asRUNNING, and the registry valueHKLM\SOFTWARE\Microsoft\Windows Advanced Threat Protection\Status\OnboardingStateis1. - Linux:
mdatp health --field healthyreturnstrue.
Once onboarded, each machine reports the device id its sensor registered under, and M&NTIS only reports and offboards those devices. A device of yours, or one an earlier lab left behind, is never touched, whatever its name. Offboarding is requested as the lab ends, while its machines still run. A device MDE has not registered yet can be refused: it then stays listed until the portal marks it inactive, and M&NTIS logs which.
Detections are also correlated with the executed attack steps in the lab's results, so an alert that matches an attack in time shows up against it.
Warning
Microsoft makes MDE's alerts available with a delay that varies from minutes to more than an hour. M&NTIS collects them until the lab ends, so on a slow day part or all of a lab's alerts arrive too late to appear in its results; they still show in the Defender portal.
Tips
Scenarios that tamper with Defender — those built on windows_defender_disable, disable_tamper_protection or disable_defender_settings — interact with this integration by design. Where tamper protection is in force on the machine, those steps fail; where it is not, they suppress part of the telemetry being measured. It reaches a machine some time after onboarding, so on a tenant that enforces it they can still succeed: in a certifombre run they did, and MDE raised "Microsoft Defender Antivirus protection turned off". Both are legitimate results, and worth deciding on before the run.

