Microsoft Defender XDR connector
The Microsoft Defender XDR connector uses the Microsoft Graph Security API so agents can manage incidents and alerts, run advanced hunting KQL queries, audit custom detection rules, enrich threat intelligence, and report on secure score against Microsoft Defender XDR threat data.
This connector is currently available in Agent Builder only.
You can create connectors in Stack Management → Connectors.
To use this connector, register an application in Microsoft Entra ID and grant it the required application permissions.
- Sign in to the Azure Portal and open Microsoft Entra ID > App registrations.
- Select New registration. Enter a name (for example,
Kibana Defender XDR), choose Accounts in this organizational directory only, and select Register. - Note the Application (client) ID and Directory (tenant) ID shown on the Overview page.
In your app registration, go to API permissions > Add a permission > Microsoft Graph > Application permissions.
Add the following permissions:
Permission Purpose SecurityIncident.ReadWrite.AllRead, update, merge, and comment on incidents SecurityAlert.ReadWrite.AllRead, update, and comment on alerts ThreatHunting.Read.AllRun advanced hunting queries CustomDetection.Read.AllList and read custom detection rules CustomDetection.ReadWrite.All(optional)Create, update, and delete custom detection rules — only needed for the API-only rule-management actions ThreatIntelligence.Read.AllThreat intelligence enrichment (host details, reputation, passive DNS, WHOIS) SecurityEvents.Read.AllRead Microsoft Secure Score Select Add permissions, then Grant admin consent for your organization.
- In your app registration, go to Certificates & Secrets > Client secrets > New client secret.
- Set a description and expiry, then select Add.
- Copy the Value immediately — it is not shown again after you leave the page.
- Generate a self-signed or CA-issued X.509 certificate (PEM format).
- In your app registration, go to Certificates & Secrets > Certificates > Upload certificate and upload the public certificate (
.pemor.crt). - When configuring the connector, choose the Certificate authentication method and upload both the public certificate and the matching private key.
- Cloud environment
-
Select the Microsoft cloud where your Defender XDR tenant is hosted:
- Commercial (global): Public Microsoft 365 cloud (default)
- US Government GCC High: Microsoft 365 Government GCC High cloud
- US Government DoD: Microsoft 365 Government DoD cloud
On self-managed Kibana, both the token endpoint host and the Graph API host must be added to xpack.actions.allowedHosts.
| Cloud | Token host | Graph API host |
|---|---|---|
| Commercial | login.microsoftonline.com |
graph.microsoft.com |
| GCC High | login.microsoftonline.us |
graph.microsoft.us |
| DoD | login.microsoftonline.us |
dod-graph.microsoft.us |
On Elastic Cloud (hosted or serverless) these hosts are pre-allowed and no extra configuration is needed.
Configure the following fields:
- Token URL
- The Microsoft Entra ID token endpoint for your tenant. Use the format
https://login.microsoftonline.com/{tenant-id}/oauth2/v2.0/token, replacing{tenant-id}with your directory (tenant) ID (GUID). For GCC High and DoD usehttps://login.microsoftonline.us/{tenant-id}/oauth2/v2.0/token. - Client ID
- The Application (client) ID from your Microsoft Entra app registration.
- Client Secret
- A client secret created for the app registration under Certificates & Secrets.
- OAuth scope
https://graph.microsoft.com/.defaultfor Commercial,https://graph.microsoft.us/.defaultfor GCC High, orhttps://dod-graph.microsoft.us/.defaultfor DoD. Must match the cloud environment selected above.
As an alternative to a client secret, authenticate with an X.509 certificate. Upload the PEM-encoded public certificate and private key. The certificate must first be uploaded to your app registration under Certificates & secrets > Certificates.
The following actions are available for the Microsoft Defender XDR connector. Actions marked (API only) are not available as agent tools and must be invoked directly via the Kibana Run a connector API. For API-only actions, set params.subAction to the action name and place the action's input parameters under params.subActionParams. If the connector was saved with an action allowlist (config.selectedActions), each API-only action you want to call must be explicitly included in that list, otherwise /_execute returns HTTP 200 with status: "error" — check the status field and read service_message for the reason, rather than relying on the HTTP status code alone. For example, to call updateIncident:
{
"params": {
"subAction": "updateIncident",
"subActionParams": {
"incidentId": "42",
"status": "resolved",
"classification": "truePositive",
"determination": "malware"
}
}
}
| Action | Category | Required parameters | Optional parameters | Required Graph permission |
|---|---|---|---|---|
listIncidents |
Incident management | — | filter, top, skip, includeAlerts |
SecurityIncident.ReadWrite.All |
getIncident |
Incident management | incidentId |
includeAlerts |
SecurityIncident.ReadWrite.All |
updateIncident (API only) |
Incident management | incidentId + at least one field |
status, assignedTo, classification, determination, severity, customTags |
SecurityIncident.ReadWrite.All |
addIncidentComment |
Incident management | incidentId, comment |
— | SecurityIncident.ReadWrite.All |
mergeIncidents (API only) |
Incident management | incidentIds (≥ 2 IDs) |
comment |
SecurityIncident.ReadWrite.All |
listAlerts |
Alert management | — | filter, top, skip |
SecurityAlert.ReadWrite.All |
getAlert |
Alert management | alertId |
— | SecurityAlert.ReadWrite.All |
updateAlert (API only) |
Alert management | alertId + at least one field |
status, assignedTo, classification, determination |
SecurityAlert.ReadWrite.All |
addAlertComment |
Alert management | alertId, comment |
— | SecurityAlert.ReadWrite.All |
runHuntingQuery |
Advanced hunting | query |
timespan |
ThreatHunting.Read.All |
listDetectionRules |
Custom detection rules | — | top, skip |
CustomDetection.Read.All |
getDetectionRule |
Custom detection rules | ruleId |
— | CustomDetection.Read.All |
createDetectionRule (API only) |
Custom detection rules | displayName, queryText, period, alertTemplate |
status |
CustomDetection.ReadWrite.All |
updateDetectionRule (API only) |
Custom detection rules | ruleId + at least one field |
displayName, status, queryText, period, alertTemplate |
CustomDetection.ReadWrite.All |
deleteDetectionRule (API only) |
Custom detection rules | ruleId |
— | CustomDetection.ReadWrite.All |
getThreatIntelHost |
Threat intelligence | host |
— | ThreatIntelligence.Read.All |
getThreatIntelHostReputation |
Threat intelligence | host |
— | ThreatIntelligence.Read.All |
getPassiveDnsRecords |
Threat intelligence | host |
— | ThreatIntelligence.Read.All |
getWhoisRecord |
Threat intelligence | host |
— | ThreatIntelligence.Read.All |
listSecureScores |
Secure score | — | top |
SecurityEvents.Read.All |
listIncidents- Lists Defender XDR incidents with optional OData
$filterexpressions, pagination (top/skip), and optional expansion of related alerts. Use to get an overview of active threats or page through incident history. getIncident- Retrieves details for a single incident by its numeric ID. Set
includeAlertstotrueto expand related alerts and evidence (device evidence items includemdeDeviceIdanddeviceDnsNamefor use with the Microsoft Defender for Endpoint connector). OmitincludeAlertswhen you only need the incident's status, assignee, or classification to avoid oversized responses. updateIncident(API only)- Updates an incident — change
status(active,resolved,inProgress,redirected), assign to an analyst (assignedTo), setclassificationanddetermination, adjustseverity, or replacecustomTags. Only the fields you provide are changed. To add a comment, useaddIncidentCommentinstead. addIncidentComment- Appends a comment to an incident's activity log. Use to record analyst notes, investigation findings, or escalation decisions for audit trail purposes.
mergeIncidents(API only)- Merges two or more incidents into a single incident. The first incident ID in the
incidentIdslist becomes the primary (surviving) incident; all others are merged into it. Use to consolidate duplicate detections or combine related incidents from the same attack campaign. This action is irreversible — verify incident IDs withlistIncidentsorgetIncidentfirst.
listAlerts- Lists Defender XDR alerts (
alerts_v2) across all Defender products (Endpoint, Office 365, Identity, Cloud Apps) with optional OData$filterexpressions and pagination. Use to inspect an alert before it is rolled into an incident, or to triage alerts that may not warrant a full incident. getAlert- Retrieves full details for a single alert, including evidence (affected devices, users, files, processes, and network connections). Device evidence includes
mdeDeviceIdfor use with the Microsoft Defender for Endpoint connector. updateAlert(API only)- Updates an alert independently of its parent incident — change
status(new,inProgress,resolved), assign to an analyst (assignedTo), or setclassificationanddetermination. Alert severity cannot be changed via PATCH. Provide only the fields you want to change. addAlertComment- Appends a comment to an alert's activity log. Use to record triage notes, analyst observations, or escalation decisions directly on the alert for audit trail purposes.
runHuntingQuery- Runs a Kusto Query Language (KQL) advanced hunting query against Defender XDR tables such as
DeviceEvents,EmailEvents,AlertInfo,AlertEvidence,IdentityLogonEvents, andCloudAppEvents. Results are capped at 100,000 rows; queries can access up to 30 days of data. Use the optionaltimespanparameter (ISO 8601 duration, e.g.PT1H,P7D) to scope the query time range.
listDetectionRules- Lists configured custom hunting-based detection rules. Use to audit what rules are already generating alerts before creating a new one, or to retrieve rule IDs for update or delete operations.
getDetectionRule- Retrieves full details for a single custom detection rule by its numeric ID, including its KQL query, schedule, alert template, and trigger settings.
createDetectionRule(API only)- Creates a new custom detection rule that runs a KQL query on a schedule and generates alerts when the result count satisfies the trigger condition. The query must project at least one of:
DeviceId,AccountObjectId,AccountSid,AccountUpn,AccountName,MailboxAddress,FileName,SHA256,IPAddress,URL. ThealertTemplateobject requires atitleandseverityand optionally acceptsdescription,recommendedActions, andtactics.tacticsis an array of tactic objects, each with atacticstring (e.g."Execution") and an optionaltechniquesarray; each technique has atechniquestring (e.g."T1059") and an optionalsubTechniquesarray of strings. Theperiodmust be one ofPT1H,PT3H,PT12H,P1D, orP7D. The optionalstatusfield controls whether the rule runs immediately after creation; it defaults to'enabled'when omitted — pass'disabled'to create an inactive rule that you can enable later. updateDetectionRule(API only)- Updates an existing custom detection rule — modify
displayName, enable/disable viastatus(enabledordisabled), change the KQLqueryText, adjust theperiod, or update thealertTemplate. Provide only the fields you want to change. deleteDetectionRule(API only)- Permanently deletes a custom detection rule by its numeric ID. Confirm the rule ID with
listDetectionRulesorgetDetectionRulebefore deleting. This action is irreversible.
getThreatIntelHost- Retrieves the Microsoft Defender Threat Intelligence (MDTI) host record for a hostname or IP address — returning the host ID, first-seen date, and last-seen date. Does not include threat-actor associations or malware-family associations; use
getThreatIntelHostReputationfor a risk score, orgetPassiveDnsRecords/getWhoisRecordfor infrastructure pivoting. Thehostparameter accepts FQDNs, IPv4 addresses, or IPv6 addresses. getThreatIntelHostReputation- Returns the MDTI reputation score and classification for a hostname or IP address. The score ranges from 0–100 (higher = more malicious). Classification is one of
unknown,neutral,suspicious, ormalicious, with the rules that influenced the score. getPassiveDnsRecords- Retrieves forward passive DNS records for a hostname from MDTI — showing what IPs a domain resolved to. Use to pivot across attacker infrastructure during threat hunting or attribution investigations.
getWhoisRecord- Retrieves WHOIS registration data for a domain from MDTI. Returns registrar, registrant contact details, name servers, registration and expiry dates, and abuse contact. Use to attribute domains to known threat actors or identify recently registered infrastructure.
listSecureScores- Retrieves Microsoft Secure Score snapshots. Returns the organization's composite identity, device, and app security score with control-level breakdowns. Results are ordered by date descending so the most recent score is first. The
topparameter controls how many snapshots to return (default 25, maximum 100).
The getAlert response includes a top-level evidence array. The getIncident response (with $expand=alerts) nests evidence under each alert in alerts[].evidence. Items of type #microsoft.graph.security.deviceEvidence contain:
mdeDeviceId— the Microsoft Defender for Endpoint machine IDdeviceDnsName— the device hostnameazureAdDeviceId— the Azure AD device object ID (when available)
Pass mdeDeviceId to the Microsoft Defender for Endpoint connector to trigger isolate, scan, or live-response actions.