and PowerShell
and PowerShell
This guide provides step-by-step instructions for automating DLP incident resolution in Microsoft
### Scenario
4. Set the trigger as Recurrence to schedule periodic runs (e.g., hourly or daily).
- Method: GET.
- URL: https://<your-instance>.microsoft.com/api/dlp/incidents.
- Headers:
- Content-Type: application/json.
- Name: HRUsers.
- Type: Array.
- Value:
- Use the output of the HTTP Action as the array to loop through.
1. Inside the true branch of the condition, add another HTTP Action to resolve the incident.
- Method: PATCH.
- URL: https://<your-instance>.microsoft.com/api/dlp/incidents/<incident_id>.
- Headers:
- Content-Type: application/json.
- Body:
"status": "Resolved",
1. Save the flow and manually test it to ensure incidents are resolved for matching conditions.
This section describes how to achieve the same automation using PowerShell.
### Scenario
Example:
$HRUsers = @(
$ClientSecret = "<Your-Client-Secret>"
$TenantId = "<Your-Tenant-ID>"
$TokenUrl = "https://login.microsoftonline.com/$TenantId/oauth2/v2.0/token"
$Body = @{
grant_type = "client_credentials"
client_id = $ClientId
client_secret = $ClientSecret
scope = "https://graph.microsoft.com/.default"
$AccessToken = $Response.access_token
$PurviewEndpoint = "https://<your-instance>.microsoft.com/api/dlp/incidents"
$Headers = @{
"Content-Type" = "application/json"
2. Resolve incidents:
$IncidentId = $Incident.id
$UpdateEndpoint = "$PurviewEndpoint/$IncidentId"
$Body = @{
status = "Resolved"
} | ConvertTo-Json -Depth 10