> 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-purview-dlp.md).

# Microsoft Purview DLP

Microsoft Purview Data Loss Prevention (DLP) records data security events. OctoXLabs runs an advanced hunting query through Microsoft Graph. The query lists devices that raised data security events in the last 24 hours and joins them with device information by IP address.

## Use cases

* List devices that recently raised Purview DLP events.

```
Adapters = microsoft-purview-dlp
```

## Before you begin

### Network

| Source              | Destination               | Port | Protocol |
| ------------------- | ------------------------- | ---- | -------- |
| OctoXLabs connector | login.microsoftonline.com | 443  | HTTPS    |
| OctoXLabs connector | graph.microsoft.com       | 443  | HTTPS    |

### Required permissions

| Scope or role                                        | Permission | Needed for                                 |
| ---------------------------------------------------- | ---------- | ------------------------------------------ |
| ThreatHuntingRead.All (Microsoft Graph, application) | Read       | Advanced hunting query (`runHuntingQuery`) |

Add only the permissions your use case needs.

## Create credentials in Microsoft Purview DLP

{% stepper %}
{% step %}

### Register an application

Register an app in Microsoft Entra ID and note the Application (client) ID and the Tenant ID.
{% endstep %}

{% step %}

### Create a client secret

Go to Certificates & Secrets and select New client secret. Provide a description and expiration, select Add, and copy the secret value at once.
{% endstep %}

{% step %}

### Add the permission

Open API Permissions > Add a permission, select Microsoft Graph, then Application permissions, and add ThreatHuntingRead.All.
{% endstep %}

{% step %}

### Grant admin consent

Select Grant admin consent for the organization.
{% endstep %}
{% endstepper %}

## Connection parameters

| Parameter                       | Required | Type    | Default | Description                        |
| ------------------------------- | -------- | ------- | ------- | ---------------------------------- |
| Client ID (`client_id`)         | Yes      | String  |         | Application (client) ID.           |
| Client Secret (`client_secret`) | Yes      | String  |         | Client secret value.               |
| Tenant ID (`tenant_id`)         | Yes      | String  |         | Directory (tenant) ID.             |
| Timeout (`timeout`)             | No       | Integer | 30      | Seconds to wait for API responses. |

## Troubleshooting

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

## Change history

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