---
name: iblai-connect-microsoft-defender
description: "Read and write Microsoft Defender XDR data through the Microsoft Graph security API and Microsoft Defender for Endpoint API and expose it to an ibl.ai agent as an MCP tool. Use when the user asks an agent to work with Microsoft Defender XDR data, or to set up a Microsoft Defender XDR MCP connection on ibl.ai."
metadata:
  kind: guide
---

# Microsoft Defender XDR connector for AI agents

> A starting point maintained on ibl.ai at https://ibl.ai/developer/connectors/microsoft-defender — not part of the iblai/base repository. Checked against Microsoft Corporation's documentation on October 20, 2026; test it against your own Microsoft Defender XDR setup before you rely on it.

Microsoft Defender XDR correlates alerts from Defender for Endpoint, Identity, Office 365, Cloud Apps and Entra ID Protection into incidents, and keeps 30 days of raw device, email and identity events for advanced hunting.

## Auth & conventions

- **API:** Microsoft Graph security API and Microsoft Defender for Endpoint API (REST). Graph exposes security/incidents, security/alerts_v2 and security/runHuntingQuery (KQL), plus Secure Score and threat intelligence. The Defender for Endpoint API adds device response actions such as isolating a machine.
- **Base URL:** https://graph.microsoft.com/v1.0/security/ (response actions: https://api.security.microsoft.com/api/)
- **Access:** Issued by your administrator. An admin of the customer's Microsoft Entra tenant registers an app and consents to permissions such as ThreatHunting.Read.All or Machine.Isolate. Microsoft recommends app-only tokens for Defender for Endpoint data.
- **Auth:** Microsoft Entra ID OAuth 2.0 (application permissions); Microsoft Entra ID OAuth 2.0 (delegated permissions). Graph calls use an Entra token with permissions such as ThreatHunting.Read.All. Delegated isolate calls also need the user's 'Active remediation actions' role and access to the device's group.
- **Limits:** Hunting: at least 45 calls per minute per tenant, 100,000 rows and 50 MB per result, 3-minute timeout, CPU quota per 15-minute cycle (429 when hit). Isolate machine: 100 calls per minute and 1,500 per hour.
- Keep Microsoft Defender XDR credentials in environment variables or the ibl.ai credential store. Never print a token in chat and never commit one to a file.
- Destructive or outward-facing calls are marked **Confirm with the user first** — do.

## Reads

- **Incidents** — GET /security/incidents, with ?$expand=alerts to include correlated alerts.
- **Alerts** — GET /security/alerts_v2 with evidence, severity, status and the source product.
- **Advanced hunting (KQL)** — POST /security/runHuntingQuery over the last 30 days of Defender data; permission ThreatHunting.Read.All.
- **Secure Score** — GET /security/secureScores and secureScoreControlProfiles.

## Writes

- **Update an incident** — PATCH /security/incidents/{id} to set status, assignment, classification or tags.
- **Update an alert** — PATCH an alert to set status, assignment or classification.
- **Isolate a device** — POST /api/machines/{id}/isolate (Full, Selective or UnManagedDevice); permission Machine.Isolate. **Confirm with the user first.**

## Expose it to an ibl.ai agent (MCP)

Microsoft Corporation publishes an official MCP server, Microsoft Sentinel MCP server: triage collection (https://learn.microsoft.com/en-us/azure/sentinel/datalake/sentinel-mcp-triage-tool). Register it below as-is, or host your own server that wraps the calls in this skill.

First install the ibl.ai platform skills and connect your organization (writes `IBLAI_ORG`, `IBLAI_USERNAME` and `IBLAI_API_KEY` to `.env`):

```bash
npx skills add iblai/base --all
# then, in your coding agent:
/iblai-api-login
```

Every call below sends `Authorization: Api-Token $IBLAI_API_KEY`.

1. **Register the server** — `POST https://api.iblai.app/dm/api/ai-mentor/orgs/$IBLAI_ORG/users/$IBLAI_USERNAME/mcp-servers/` with `name`, `url`, `transport` (`sse` | `websocket` | `streamable_http`) and `auth_type` (`none` | `token` | `oauth2`). Capture the returned `id`.
   - For an API key or service credential use `auth_type=token` with `auth_scope=platform` for one key across the organization, or scope it to a single agent for one key per agent.
2. **Create the connection** — `POST https://api.iblai.app/dm/api/ai-mentor/orgs/$IBLAI_ORG/users/$IBLAI_USERNAME/mcp-server-connections/` with `server`, `scope` (`platform` | `mentor` | `user`), `auth_type`, and either `credentials` + `authorization_scheme` or a `connected_service` id for OAuth. Credentials are masked on read; never send a masked value back.
3. **Enable it on the agent** — `GET https://api.iblai.app/dm/api/ai-mentor/orgs/$IBLAI_ORG/users/$IBLAI_USERNAME/mentors/{agent_id}/settings/`, add `mcp-tool` to `tool_slugs` and the server id to `mcp_servers`, then `PATCH` the full lists back. They are replaced, not merged.

Full reference: https://ibl.ai/developer/platform/mcp/mcp-connections and the `/iblai-api-agent-mcp` skill.

## Example prompts

- "List open High-severity incidents with their alerts from the last 24 hours"
- "Hunt for PowerShell launched from an AppData path in the past 7 days"
- "Summarize the evidence on alert da637 and recommend a classification"
- "Report this week's Secure Score change and the top three open controls"

## Guardrails

- Incident, alert and hunting data reveal an organization's devices, users and weaknesses. Use least-privilege app permissions and confirm every isolation with a person.
- Request the narrowest Microsoft Defender XDR scopes or role the task needs, and prefer a read-only credential for agents that only answer questions.
- Return the fields the user asked for, not whole records; do not paste personal data into chat that the user did not request.
- Before any write, show the user exactly what will change and wait for a yes.
- Respect the documented limits above: page through results and back off on rate-limit responses instead of retrying in a loop.

## References

- Microsoft Graph security API overview: https://learn.microsoft.com/en-us/graph/api/resources/security-api-overview
- Isolate machine API (Defender for Endpoint): https://learn.microsoft.com/en-us/defender-endpoint/api/isolate-machine
- Sentinel MCP triage collection: https://learn.microsoft.com/en-us/azure/sentinel/datalake/sentinel-mcp-triage-tool
- Microsoft Sentinel MCP server: triage collection: https://learn.microsoft.com/en-us/azure/sentinel/datalake/sentinel-mcp-triage-tool
- This connector on ibl.ai: https://ibl.ai/developer/connectors/microsoft-defender
- ibl.ai MCP server connections: https://ibl.ai/developer/platform/mcp/mcp-connections
