> For the complete documentation index, see [llms.txt](https://docs.octoxlabs.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.octoxlabs.com/adapters/m/microsoft-defender-atp.md).

# Microsoft Defender ATP

Microsoft Defender ATP (formerly ATP) is the endpoint detection and response product of Microsoft. OctoXLabs reads the onboarded machines and can add installed software, missing KBs, vulnerabilities, logged on users and security recommendations.

## Use cases

* List the machines onboarded to Defender for Endpoint.

```
Adapters = microsoft-defender
```

* Find servers that Defender for Endpoint has not seen for 7 days.

```
Adapters = microsoft-defender AND Category = Server AND NOT LastSeen last now-7d/d
```

## Before you begin

### Network

| Source              | Destination                                                                | Port | Protocol |
| ------------------- | -------------------------------------------------------------------------- | ---- | -------- |
| OctoXLabs connector | login.microsoftonline.com                                                  | 443  | HTTPS    |
| OctoXLabs connector | api.securitycenter.windows.com and api.securitycenter.microsoft.com        | 443  | HTTPS    |
| OctoXLabs connector | Export file download URLs returned by the export APIs (Azure Blob Storage) | 443  | HTTPS    |

### Required permissions

| Scope or role                                      | Permission | Needed for                                                             |
| -------------------------------------------------- | ---------- | ---------------------------------------------------------------------- |
| Machine.Read.All (WindowsDefenderATP, application) | Read       | Machines                                                               |
| Software.Read.All                                  | Read       | Installed software and missing KBs                                     |
| Vulnerability.Read.All                             | Read       | Vulnerabilities (Fetch Vulnerabilities)                                |
| User.Read.All                                      | Read       | Logged on users (Fetch Logged On Users)                                |
| SecurityRecommendation.Read.All                    | Read       | Security recommendations (Fetch Security Recommendations For Machines) |

Source: frontend instructions. See the Microsoft Defender ATP API documentation (<https://learn.microsoft.com/en-us/microsoft-365/security/defender-endpoint/api-hello-world>).

## Create credentials in Microsoft Defender ATP

{% stepper %}
{% step %}

### Register an application

Sign in to the Azure Portal as an administrator, open Azure Active Directory and select App registrations > New registration. Fill in the details and select Register. Note the Application (client) ID and Directory (tenant) ID.
{% endstep %}

{% step %}

### Create a client secret

In the left menu, select Certificates & Secrets > New client secret. Select Add and copy the secret.
{% endstep %}

{% step %}

### Add API permissions

Select API Permissions > Add a permission, choose APIs my organization uses, and select WindowsDefenderATP.
{% endstep %}

{% step %}

### Select application permissions

Add the permissions from the table above for the options you enable. Grant admin consent.
{% endstep %}
{% endstepper %}

{% hint style="warning" %}
The frontend instructions announce that from version 6.6.0 the per-machine fetch methods will be removed and only the bulk and export APIs will be used. The batch options (Fetch Installed Softwares in Batch, Fetch Missing KBs in Batch, Fetch Recommendations in Batch) will be removed from the form. Grant Machine.Read.All, Software.Read.All, Vulnerability.Read.All and SecurityRecommendation.Read.All (and User.Read.All for logged on users) before upgrading.
{% endhint %}

## Connection parameters

| Parameter                                                                                   | Required | Type    | Default | Description                                                                                                                          |
| ------------------------------------------------------------------------------------------- | -------- | ------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------ |
| Tenant ID (`tenant_id`)                                                                     | Yes      | String  |         | Directory (tenant) ID.                                                                                                               |
| Client ID (`client_id`)                                                                     | Yes      | String  |         | Application (client) ID.                                                                                                             |
| Client Secret (`client_secret`)                                                             | Yes      | String  |         | Client secret value.                                                                                                                 |
| Proxy (`proxy`)                                                                             | No       | String  |         | Proxy host and port, sent as an `http://` proxy URL.                                                                                 |
| Timeout (`timeout`)                                                                         | No       | Integer | 60      | Seconds to wait for API responses.                                                                                                   |
| Fetch Vulnerabilities (`fetch_vulnerabilities`)                                             | No       | Boolean | False   | Fetch vulnerabilities through the export API.                                                                                        |
| Fetch Missing Kbs (`fetch_missingkbs`)                                                      | No       | Boolean | True    | Fetch missing KBs.                                                                                                                   |
| Fetch Installed Softwares (`fetch_installed_softwares`)                                     | No       | Boolean | True    | Fetch installed software.                                                                                                            |
| Fetch Installed Softwares in Batch (`fetch_installed_softwares_batch`)                      | No       | Boolean | True    | Use the software export API instead of one call per machine.                                                                         |
| Fetch Missing KBs in Batch (`fetch_missingkbs_batch`)                                       | No       | Boolean | False   | Derive missing KBs from the SoftwareVulnerabilitiesByMachine API. Entries have fewer fields (no `url` or `machineMissedOn`).         |
| Fetch Recommendations in Batch (`fetch_recommendations_batch`)                              | No       | Boolean | False   | Use the organization-wide recommendations API, then read machine references for each recommendation.                                 |
| Fetch Logged On Users (`fetch_logonusers`)                                                  | No       | Boolean | False   | Fetch logged on users for each machine, one call per machine.                                                                        |
| Fetch Security Recommendations For Machines (`fetch_security_recommendations_for_machines`) | No       | Boolean | False   | Fetch security recommendations for each machine.                                                                                     |
| IP Aggregation (`ip_aggregation`)                                                           | No       | Boolean | False   | Aggregate machines that have no `computerDnsName` by `lastIpAddress` instead of dropping them. Loopback and invalid IPs are ignored. |
| SSL (`is_secure`)                                                                           | No       | Boolean | True    | Use HTTPS for the token request.                                                                                                     |

## Troubleshooting

| Error message | Cause | Fix                                    |
| ------------- | ----- | -------------------------------------- |
| Not verified  |       | No adapter-specific error text in code |

## Change history

{% hint style="info" %}
Available starting from version 2.5.0.
{% endhint %}
