Real-time Identity Monitoring
Real-time identity monitoring extends the Microsoft Graph change-notification pipeline to detect a compromised account while it is happening. Four sources are ingested in near-real-time and correlated in a 30-minute sliding window.
realtime_identity feature flag. Azure AD P1 required for Graph change notifications; P1-only tenants fall back to polling every 60 seconds.
Data sources
| Source | Mechanism | Fallback |
|---|---|---|
signin | Graph beta /auditLogs/signIns push | Polling every 60 s |
audit_log | Graph /auditLogs/directoryAudits subscription | Inherits directory subs |
sharepoint | Office 365 Management Activity API | Polling |
mailbox | Graph mailbox audit subscription | Inherits directory subs |
Correlation engine & indicators
Events are grouped per (tenant_id, UPN) over a 30-minute sliding window. A CompromiseAlert is raised when the weighted score reaches ≥50. At least two distinct indicators must fire (single-source noise suppression).
| Indicator | Trigger | Weight |
|---|---|---|
| Risky sign-in | Identity Protection medium/high or risk_state=atRisk | 35 |
| Mass downloads | ≥10 SharePoint/OneDrive FileDownloaded in window | 30 |
| Permission change | Consent grant, role assignment, app credential added | 25 |
| Mailbox rule | New/modified inbox forwarding rule | 20 |
| Severity bonus | Any event already classified high or critical | 10 |
Event lifecycle
- Subscribe — click "Refresh subscriptions" on the Real-time Monitoring page, or call
POST /api/realtime/subscribe. One subscription row per resource type, per tenant. - Receive — Microsoft delivers notifications to
/api/webhooks/graph/signinsand/api/webhooks/o365/activity. Each becomes aRealtimeEventrow. - Correlate — inline after insert, and via the Celery beat task every 30 s.
- Notify — when score ≥50: Teams Adaptive Card / Slack / webhook with a link to the Identity Investigator pre-filtered on the suspicious UPN.
- Renew —
renew_subscriptionsruns hourly and re-issues subscriptions expiring within 2 hours.
API reference
| Method | Path | Purpose |
|---|---|---|
| GET | /api/realtime/subscriptions | List active subscriptions |
| POST | /api/realtime/subscribe | Trigger a fresh subscribe pass (Admin) |
| GET | /api/realtime/events | Paginated event stream. Filters: upn, since, severity |
| GET | /api/realtime/dashboard | KPIs: events 1h/24h, top UPNs, subscription health |
| GET | /api/realtime/settings | Check whether monitoring is enabled |
| POST | /api/realtime/settings | Toggle monitoring on/off (Admin) |
Quick test (local)
# 1. Subscribe
curl -X POST -H "Authorization: Bearer $JWT" \
http://localhost:8000/api/realtime/subscribe
# 2. Inject a fake risky sign-in
curl -X POST -H "Content-Type: application/json" \
http://localhost:8000/api/webhooks/graph/signins \
-d '{"value":[{"clientState":"<from sub row>","resourceData":{
"tenantId":"contoso","userPrincipalName":"[email protected]",
"riskLevel":"high","riskState":"atRisk",
"createdDateTime":"2026-06-19T12:00:00Z","ipAddress":"203.0.113.42"
}}]}'
# 3. Check KPI dashboard
curl -H "Authorization: Bearer $JWT" \
http://localhost:8000/api/realtime/dashboard Real-time kill-chain detection (DCSync)
Shipped — ad_attack_surface (Enterprise)
DCSync-relevant AD ACLs are polled every 60 seconds (well inside a 90-second detection target) for every LDAP-enabled tenant, plus on-demand whenever a qualifying Graph directory change notification arrives. This is narrower than full real-time KILL-* coverage: DCSync grant changes are genuinely detected this way, but Golden Ticket detection is not — that requires Domain Controller Security Event Log telemetry this product does not collect. The other 30 KILL rules still run at scan time.
Next steps
- → Kill-Chain Coverage — KILL-001..030 rules
- → Notifications & Webhooks — configure Slack / Teams / HTTP delivery