The Service Principal Had Global Administrator
The user account looked normal.
The MFA logs looked normal.
The application looked legitimate.
Then Agent Foskett reviewed the permissions. A service principal had been granted Global Administrator level access.
Investigation focus
Learn how a service principal can become a powerful privileged identity if enterprise application permissions and role assignments are not reviewed regularly.
The suspicious detail
No compromised user accounts were identified. No obvious malicious sign-ins were detected.
But an enterprise application appeared in a permissions review with access far beyond what its function required. The associated service principal had privileged access that could affect the entire tenant.
First hunt: identify privileged service principal changes
- 1
- 2
- 3
- 4
- 5
- 6
- 7
AuditLogs | where TimeGenerated > ago(90d) | where OperationName has_any ("Add service principal", "Add app role assignment", "Add member to role") | project TimeGenerated, OperationName, InitiatedBy, TargetResources, Result | order by TimeGenerated desc
Show me recent activity involving service principals, application permissions and privileged role assignments.
What Agent Foskett checks next
Second hunt: review enterprise application activity
- 1
- 2
- 3
- 4
- 5
- 6
- 7
AuditLogs | where TimeGenerated > ago(90d) | where OperationName has "role" | project TimeGenerated, OperationName, InitiatedBy, TargetResources, Result | order by TimeGenerated desc
Third hunt: look for role assignment changes
- 1
- 2
- 3
- 4
- 5
- 6
- 7
CloudAppEvents | where Timestamp > ago(30d) | where isnotempty(Application) | summarize EventCount = count(), Users = dcount(AccountDisplayName) by Application | order by EventCount desc
The investigation lesson
Attackers do not care whether an identity belongs to a person or an application. If an application has enough permissions, compromising that application can provide access equivalent to compromising an administrator account.
Common mistakes
Related Agent Foskett investigations and KQL guides
Continue with The User Clicked Accept And Gave Away The Entire Mailbox, The Conditional Access Policy Was In Report-Only Mode, The Session Token Never Expired, KQL Threat Hunting Guide, Agent Foskett Academy, Microsoft Security and the GEMXIT Security Review.
Develop IT. Protect IT. GEMXIT PTY LTD | GEMXIT UK LTD