Query Details
// =========================================================================
// HQ-004: Burst Service Principal Creations in 1-Hour Window
// =========================================================================
// Description : Detects three or more service principals created by the
// same actor within a one-hour bucket. MicroBurst, ROADtools
// and CloudKatana register SPs in bulk when setting up attack
// infrastructure. Legitimate admins rarely create more than
// one or two SPs in rapid succession.
// MITRE ATT&CK: TA0003 Persistence
// T1136.003 – Create Cloud Account
// Tools : ROADtools, MicroBurst, CloudKatana, AADInternals
// Severity : Medium
// Data Source : AuditLogs (Azure Active Directory)
// =========================================================================
AuditLogs
| where TimeGenerated > ago(1d)
| where ActivityDisplayName == "Add service principal"
| extend InitiatedByUPN = tostring(InitiatedBy.user.userPrincipalName)
| extend InitiatedByApp = tostring(InitiatedBy.app.displayName)
| extend Actor = iff(isnotempty(InitiatedByUPN), InitiatedByUPN, InitiatedByApp)
| extend NewSPName = tostring(TargetResources[0].displayName)
| extend NewSPId = tostring(TargetResources[0].id)
| summarize
SPCreatedCount = count(),
SPNames = make_set(NewSPName, 20),
SPIds = make_set(NewSPId, 20),
FirstCreation = min(TimeGenerated),
LastCreation = max(TimeGenerated)
by Actor, bin(TimeGenerated, 1h)
| where SPCreatedCount >= 3
| extend DurationMinutes = datetime_diff('minute', LastCreation, FirstCreation)
| extend RatePerMinute = round(toreal(SPCreatedCount) / iff(DurationMinutes == 0, 1.0, toreal(DurationMinutes)), 2)
| order by SPCreatedCount desc
This query is designed to detect suspicious activity related to the creation of service principals in Azure Active Directory. Here's a simplified explanation:
Purpose: The query identifies instances where three or more service principals are created by the same user or application within a one-hour period. This behavior is unusual for legitimate administrators but common in certain attack scenarios.
Data Source: It uses the AuditLogs from Azure Active Directory to track these activities.
Process:
TimeGenerated > ago(1d)).bin(TimeGenerated, 1h)).Additional Calculations:
Output: The results are ordered by the number of service principals created, highlighting potential security concerns where a high number of service principals are created rapidly by the same actor.
This query helps in identifying potential misuse or attack patterns involving bulk creation of service principals, which could indicate malicious activity.

David Alonso
Released: April 6, 2026
Tables
Keywords
Operators