Microsoft 365 Defender v2
Triage Microsoft 365 Defender incidents and contain endpoints
Reads and updates Defender incidents, alerts, devices and indicators; isolates, scans or collects evidence from endpoints.
microsoft-365-defender-v2_3.0.2.tgz
Community code that runs on your platform. A maintainer reviewed this exact source; the download is rebuilt from it. Follow the to install it.
Connects FortiSOAR to Microsoft 365 Defender to triage incidents and contain endpoints. It lists and reads Defender incidents, alerts, devices, files and threat indicators; updates an incident or alert's status, owner, classification, tags or comment; submits, lists and deletes custom file, IP, domain and URL indicators; isolates and releases devices; runs antivirus scans; collects investigation packages and gets their download link; restricts and unrestricts application execution; stops and quarantines files; runs read-only advanced hunting queries; and sends a generic request to any other Defender API path. Every operation validates its parameters before it calls Defender, and machine actions are followed to completion.
Live-tested on FortiSOAR 8.0.1 against a Microsoft 365 lab tenant.
Authentication: the connector needs an app registration in Microsoft Entra ID with these application permissions, granted with admin consent. Defender for Endpoint: Machine.Read.All, Machine.ReadWrite.All, Machine.Isolate, Machine.Scan, Machine.RestrictExecution, Machine.CollectForensics, Alert.Read.All, Alert.ReadWrite.All, Ip.Read.All, Url.Read.All, File.Read.All, Ti.Read.All, Ti.ReadWrite.All. Microsoft Graph: ThreatHunting.Read.All (advanced hunting). Microsoft Threat Protection: Incident.Read.All, Incident.ReadWrite.All (incidents). The tested mode is "Without a User - Application Permission". Delegated (on behalf of a user) sign-in is refused for the machine, alert, indicator and file operations.
Known issues
- Restrict App Execution can apply on the device while the Defender action status reports Failed (0x802A0001). After a restrict, run Unrestrict App Execution to verify and clear it, even when the API reports Failed. Not live-tested
- Run Antivirus Scan operation: the playbook branch completed, but Defender refused the scan on the device (device-side action failure), so a finished scan was not seen.
- Stop And Quarantine File operation: the test file's hash was not on the one lab device, so Defender returned not found.
- Respond to Defender Endpoint Incident, "Close Not Onboarded" branch: the lab tenant has one onboarded device, so no device that is not onboarded could be produced.
- Triage Defender Incident to Response, approve paths (user path and no-user path): the approval step was never answered. The Teams approval listener was stopped in the lab, so no approval card could be answered.
- Triage Defender Incident to Response, reject path: same reason as the approve paths; no card could be answered.
Configuration · 2 fields
- Get Access Token
auth_typeselect requiredSelect the method using which you will get authentication tokens used to access the Microsoft 365 Defender APIs. You can choose between On behalf of User - Delegate Permission or Without a User - Application Permission. For more information, see the Getting Access Tokens section.
Options On behalf of User - Delegated PermissionWithout a User - Application PermissionWhen Get Access Token is Without a User - Application Permission
- Server URL
resourcetext requiredThe service-based URL to which you will connect and perform the automated operations.
Default
https://api.security.microsoft.com - Directory (tenant) ID
tenant_idtext requiredThe ID of the tenant that you have been provided for your Azure Network Security Group instance.
- Application (client) ID
client_idtext requiredUnique ID of the Azure Network Security Group application that is used to create an authentication token required to access the API.
- Application (Client) Secret
client_secretpassword requiredUnique Client Secret of the Azure Network Security Group application that is used to create an authentication token required to access the API. For information on how to get the secret key, see https://docs.microsoft.com/en-us/windows/security/threat-protection/microsoft-defender-atp/exposed-apis-create-app-webapp.
When Get Access Token is On behalf of User - Delegated Permission
- Server URL
resourcetext requiredThe service-based URL to which you will connect and perform the automated operations.
Default
https://api.security.microsoft.com - Directory (tenant) ID
tenant_idtext requiredThe ID of the tenant that you have been provided for your Azure Network Security Group instance.
- Application (client) ID
client_idtext requiredUnique ID of the Azure Network Security Group application that is used to create an authentication token required to access the API.
- Application (Client) Secret
client_secretpassword requiredUnique Client Secret of the Azure Network Security Group application that is used to create an authentication token required to access the API. For information on how to get the secret key, see https://docs.microsoft.com/en-us/windows/security/threat-protection/microsoft-defender-atp/exposed-apis-create-app-webapp.
- Authorization Code
codepassword required(Only Applicable to On behalf of User - Delegate Permission) The authorization code that you acquired during the authorization step. For more information, see the Getting Access Tokens using the On behalf of the user - Delegate Permission method section.
- Redirect URI
redirect_urltext(Only Applicable to On behalf of User - Delegate Permission) The redirect_uri of your app, where authentication responses can be sent and received by your app. The redirect URL that you specify here must exactly match one of the redirect_uri's you have registered in your app registration portal.
- Verify SSL
verify_sslcheckboxSpecifies whether the SSL certificate for the server is to be verified or not. By default, this option is set as True.
Default
true
Operations · 29
List Incidents 8 params
list_incidentslist_incidentsLists Microsoft 365 Defender incidents, with status, assignee and time filters, all pages on request.
- Last Update Time
lastUpdateTimetextOnly incidents updated at or after this time (UTC, ISO 8601, for example 2026-01-15T08:00:00Z).
- Created Time
createdTimetextOnly incidents created at or after this time (UTC, ISO 8601, for example 2026-01-15T08:00:00Z).
- Status
statusselectstatus
Options ActiveResolvedIn ProgressRedirected - Assigned To
assignedTotextThe owner as a user principal name or email. Leave empty to keep the current owner.
- Query
querytextExtra OData filter clause, combined with the other filters.
- Skip
skipnumberskip
- Top
topnumberMaximum number of results to return.
- Get All Records
get_all_recordscheckboxFollow every page of results (ignores Skip and Top).
Default
false
Get Incident 1 param
get_incidentget_incidentFetches one Defender incident with its alerts, devices and comments.
- ID
idselect requiredPick from the list or enter the ID.
Update Incident 6 params
update_incidentupdate_incidentUpdates the status, owner, classification, tags or comment of a Defender incident.
- ID
idselect requiredPick from the list or enter the ID.
- Status
statusselectstatus
Options ActiveResolvedIn ProgressRedirected - Assigned To
assignedTotextThe owner as a user principal name or email. Leave empty to keep the current owner.
- Classification
classificationselectclassification
Options TruePositiveInformational, expected activityFalsePositive - Tags
tagstextComma-separated tags to add to the incident.
- Comment
commenttextFree text recorded with the action in Defender.
Run Advanced Hunting Query 1 param
advanced_huntingadvanced_huntingRuns a KQL advanced hunting query through Microsoft Graph v1.0 runHuntingQuery (ThreatHunting.Read.All, app-only).
- Query
Querytext requiredKQL advanced hunting query. Runs through Microsoft Graph runHuntingQuery.
List Machines 2 params
list_machineslist_machinesLists onboarded devices (machines) in Defender, with an optional OData filter.
- Filter
filtertextOData $filter expression, for example healthStatus eq 'Active'.
- Top
topnumberMaximum number of results to return.
Get Machine 1 param
get_machineget_machineFetches one device by its 40-character machine ID.
- ID
idselect requiredPick from the list or enter the ID.
Isolate Machine 3 params
isolate_machineisolate_machineNetwork-isolates a device (Full or Selective).
- ID
idselect requiredPick from the list or enter the ID.
- Isolation Type
isolation_typeselectFull cuts all network access except Defender. Selective keeps Outlook and Teams.
Default
FullOptions FullSelective - Comment
commenttextFree text recorded with the action in Defender.
Release Machine From Isolation 2 params
unisolate_machineunisolate_machineReleases a device from network isolation.
- ID
idselect requiredPick from the list or enter the ID.
- Comment
commenttextFree text recorded with the action in Defender.
Run Antivirus Scan 3 params
run_av_scanrun_av_scanStarts a Quick or Full antivirus scan on a device.
- ID
idselect requiredPick from the list or enter the ID.
- Scan Type
scan_typeselectQuick scans the usual malware locations. Full scans every file.
Default
QuickOptions QuickFull - Comment
commenttextFree text recorded with the action in Defender.
Collect Investigation Package 2 params
collect_investigation_packagecollect_investigation_packageStarts collection of an investigation package on a device.
- ID
idselect requiredPick from the list or enter the ID.
- Comment
commenttextFree text recorded with the action in Defender.
Restrict App Execution 2 params
restrict_app_executionrestrict_app_executionRestricts code execution on a device to Microsoft-signed code.
- ID
idselect requiredPick from the list or enter the ID.
- Comment
commenttextFree text recorded with the action in Defender.
Remove App Execution Restriction 2 params
unrestrict_app_executionunrestrict_app_executionRemoves the code-execution restriction from a device.
- ID
idselect requiredPick from the list or enter the ID.
- Comment
commenttextFree text recorded with the action in Defender.
Get Machine Action 1 param
get_machine_actionget_machine_actionFetches a machine action by ID, to poll it to completion.
- ID
idtext requiredPick from the list or enter the ID.
Cancel Machine Action 2 params
cancel_machine_actioncancel_machine_actionCancels a machine action that has not reached a final state.
- ID
idtext requiredPick from the list or enter the ID.
- Comment
commenttextFree text recorded with the action in Defender.
Stop And Quarantine File 3 params
stop_and_quarantine_filestop_and_quarantine_fileStops a file (by SHA-1) on a device and quarantines it.
- ID
idselect requiredPick from the list or enter the ID.
- SHA-1
sha1text requiredSHA-1 hash of the file (40 hex characters).
- Comment
commenttextFree text recorded with the action in Defender.
Get Investigation Package SAS URI 1 param
get_investigation_package_sas_uriget_investigation_package_sas_uriReturns the short-lived download link for a completed investigation package.
- ID
idtext requiredPick from the list or enter the ID.
List Alerts 3 params
list_alertslist_alertsLists Defender for Endpoint alerts, with an OData filter and optional evidence.
- Filter
filtertextOData $filter expression, for example healthStatus eq 'Active'.
- Top
topnumberMaximum number of results to return.
- Expand Evidence
expand_evidencecheckboxInclude the evidence list for each alert (slower).
Default
false
Get Alert 1 param
get_alertget_alertFetches one Defender for Endpoint alert by ID.
- ID
idselect requiredPick from the list or enter the ID.
Update Alert 6 params
update_alertupdate_alertUpdates the status, owner, classification, determination or comment of an alert.
- ID
idselect requiredPick from the list or enter the ID.
- Status
statusselectstatus
Options NewInProgressResolved - Assigned To
assignedTotextThe owner as a user principal name or email. Leave empty to keep the current owner.
- Classification
classificationselectclassification
Options TruePositiveInformationalExpectedActivityFalsePositive - Determination
determinationselectdetermination
Options Multistage attackMalicious user activityCompromised accountMalwarePhishingUnwanted softwareOtherSecurity testLine-of-business applicationConfirmed activityNot maliciousNot enough data to validate - Comment
commenttextFree text recorded with the action in Defender.
Submit Indicator 9 params
submit_indicatorsubmit_indicatorCreates a custom threat indicator (file hash, IP, domain or URL) with an allow, audit or block action. Requires Ti.ReadWrite.All.
- Indicator Value
indicatorValuetext requiredThe hash, IP address, domain or URL to match.
- Indicator Type
indicatorTypeselect requiredindicatorType
Options FileSha1FileSha256IpAddressDomainNameUrlCertificateThumbprint - action
actionselect requiredaction
Options AllowedAuditBlockAlertAlertAndBlockBlockAndRemediate - title
titletext requiredtitle
- description
descriptiontext requireddescription
- severity
severityselectseverity
Default
MediumOptions InformationalLowMediumHigh - Expiration Time
expirationTimetextWhen the indicator expires (UTC, ISO 8601). Leave empty for no expiry.
- Recommended Actions
recommendedActionstextrecommendedActions
- Generate Alert
generateAlertcheckboxRaise an alert when the indicator matches. Required for the Audit action.
Default
true
List Indicators
list_indicatorslist_indicatorsLists custom threat indicators. Requires Ti.Read.All or Ti.ReadWrite.All.
No parameters.
Delete Indicator 1 param
delete_indicatordelete_indicatorDeletes a custom threat indicator by ID.
- ID
idtext requiredPick from the list or enter the ID.
Get File Info 1 param
get_file_infoget_file_infoReturns Defender's file profile for a SHA-1 hash.
- SHA-1
sha1text requiredSHA-1 hash of the file (40 hex characters).
Get File Related Machines 1 param
get_file_related_machinesget_file_related_machinesLists the devices that have seen a file (SHA-1).
- SHA-1
sha1text requiredSHA-1 hash of the file (40 hex characters).
Get File Related Alerts 1 param
get_file_related_alertsget_file_related_alertsLists the alerts that reference a file (SHA-1).
- SHA-1
sha1text requiredSHA-1 hash of the file (40 hex characters).
Execute Defender API Request 4 params
execute_api_requestexecute_api_requestCalls any Defender XDR API path under /api/ with the connector's authentication. Use for endpoints that have no dedicated operation.
- Method
methodselectmethod
Default
GETOptions GETPOSTPATCHPUTDELETE - Endpoint
endpointtext requiredDefender API path under /api/, for example /api/machines.
- Query Parameters
paramstextareaQuery parameters as a JSON object, for example {"$top": "5"}.
- Body
bodytextareaRequest body as JSON.
Get Machine Options
get_machine_optionsget_machine_optionsLists up to 200 onboarded devices as "name [machine ID]" choices for the Machine dropdowns.
No parameters.
Get Alert Options
get_alert_optionsget_alert_optionsLists up to 200 Defender for Endpoint alerts, newest first, as "title [alert ID]" choices.
No parameters.
Get Incident Options
get_incident_optionsget_incident_optionsLists up to 200 Defender incidents as "name [incident ID]" choices.
No parameters.