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.

Enterprise license required — 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-inIdentity Protection medium/high or risk_state=atRisk35
Mass downloads≥10 SharePoint/OneDrive FileDownloaded in window30
Permission changeConsent grant, role assignment, app credential added25
Mailbox ruleNew/modified inbox forwarding rule20
Severity bonusAny event already classified high or critical10

Event lifecycle

  1. Subscribe — click "Refresh subscriptions" on the Real-time Monitoring page, or call POST /api/realtime/subscribe. One subscription row per resource type, per tenant.
  2. Receive — Microsoft delivers notifications to /api/webhooks/graph/signins and /api/webhooks/o365/activity. Each becomes a RealtimeEvent row.
  3. Correlate — inline after insert, and via the Celery beat task every 30 s.
  4. Notify — when score ≥50: Teams Adaptive Card / Slack / webhook with a link to the Identity Investigator pre-filtered on the suspicious UPN.
  5. Renew — renew_subscriptions runs hourly and re-issues subscriptions expiring within 2 hours.

API reference

Method Path Purpose
GET/api/realtime/subscriptionsList active subscriptions
POST/api/realtime/subscribeTrigger a fresh subscribe pass (Admin)
GET/api/realtime/eventsPaginated event stream. Filters: upn, since, severity
GET/api/realtime/dashboardKPIs: events 1h/24h, top UPNs, subscription health
GET/api/realtime/settingsCheck whether monitoring is enabled
POST/api/realtime/settingsToggle monitoring on/off (Admin)

Quick test (local)

Local test — inject sign-in event
# 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