entra-audit-investigation
Skill0 starsChanged 15 days agoMITView on GitHub
Investigate Microsoft Entra ID audit logs for persistence and privilege escalation — MFA/authentication method changes, role assignments (incl. PIM), app registrations and credentials, OAuth consent grants, service principal changes, federation/domain changes, Conditional Access edits. Use after suspected account or tenant compromise, or when hunting identity persistence in Entra ID.
In this repository273 other files it gives its agents.
- ad-attack-path-analysisSkill
- adcs-security-reviewSkill
- ad-privileged-access-reviewSkill
- dcsync-detectionSkill
- gpo-security-reviewSkill
- kerberos-attack-detectionSkill
- agent-tool-permission-reviewSkill
- ai-incident-responseSkill
- llm-gateway-controlsSkill
- llm-security-evaluationSkill
- mcp-server-security-reviewSkill
- model-artifact-securitySkill
- prompt-injection-reviewSkill
- rag-security-reviewSkill
- api-abuse-detectionSkill
- api-authorization-testingSkill
- api-inventorySkill
- api-schema-securitySkill
- dast-baselineSkill
- sast-triageSkill
- sca-dependency-riskSkill
- secure-code-reviewSkill
- security-requirementsSkill
- threat-modelingSkill
- asset-criticality-tieringSkill
- asset-inventory-reconciliationSkill
- external-attack-surface-reviewSkill
- shadow-it-discoverySkill
- aws-credential-compromiseSkill
- aws-iam-reviewSkill
- aws-org-guardrailsSkill
- cloudtrail-investigationSkill
- guardduty-triageSkill
- s3-exposure-reviewSkill
- azure-activity-investigationSkill
- azure-rbac-reviewSkill
- conditional-access-reviewSkill
- entra-signin-investigationSkill
- backup-assuranceSkill
- critical-service-mappingSkill
- ransomware-recoverySkill
- recovery-exerciseSkill
- cloud-exposure-reviewSkill
- cloud-incident-responseSkill
- cloud-logging-baselineSkill
- cloud-posture-assessmentSkill
- audit-evidence-packageSkill
- continuous-control-monitoringSkill
- control-mappingSkill
- control-testing-samplingSkill
- container-incidentSkill
- dockerfile-hardeningSkill
- image-scanningSkill
- runtime-detection-falcoSkill
- db-audit-loggingSkill
- db-exfiltration-investigationSkill
- db-hardeningSkill
- db-privilege-reviewSkill
- data-classificationSkill
- data-discoverySkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
1 rule. About 0 are common, 1 is distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 53
Remove attacker auth methods, role assignments, app credentials and consents.
≈ “Common” is an estimate: at least 1 in 5 of the 364,980 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Entra ID Audit Investigation
High-risk operations (AuditLogs.OperationName)
| Area | OperationName examples | Why |
| Auth methods | User registered security info, Admin registered security info, User changed default security info, Update user (StrongAuthenticationMethod) | Attacker adds own MFA device |
| Roles | Add member to role, Add eligible member to role (PIM), Add scoped member to role | Privilege escalation |
| Apps | Add application, Update application – Certificates and secrets management, Add service principal credentials, Add owner to application | Backdoor credentials on apps with high privileges |
| Consent | Consent to application, Add delegated permission grant, Add app role assignment to service principal | OAuth persistence / illicit consent |
| Federation | Set domain authentication, Set federation settings on domain, Add unverified domain, Verify domain | Golden SAML / rogue IdP |
| Policy | Update conditional access policy, Delete conditional access policy, Update authorization policy | Defense evasion |
| Users | Add user, Invite external user, Reset password (by admin) | New access paths |
KQL
AuditLogs
| where TimeGenerated > ago(30d)
| where OperationName in ("Add member to role", "Add eligible member to role", "Consent to application",
"Add service principal credentials", "Update application – Certificates and secrets management",
"Set domain authentication", "Set federation settings on domain", "User registered security info",
"Update conditional access policy", "Delete conditional access policy")
| extend Actor = coalesce(tostring(InitiatedBy.user.userPrincipalName), tostring(InitiatedBy.app.displayName)),
ActorIP = tostring(InitiatedBy.user.ipAddress),
Target = tostring(TargetResources[0].displayName), TargetUPN = tostring(TargetResources[0].userPrincipalName)
| project TimeGenerated, OperationName, Result, Actor, ActorIP, Target, TargetUPN, TargetResources, AdditionalDetails
| order by TimeGenerated ascNote the en dash in "Update application – Certificates and secrets management" — copy exact names from your logs.
Graph PowerShell checks:
Connect-MgGraph -Scopes "Directory.Read.All","UserAuthenticationMethod.Read.All"
Get-MgUserAuthenticationMethod -UserId alice@contoso.com | Select-Object Id, AdditionalProperties
Get-MgServicePrincipal -All | Where-Object { $_.PasswordCredentials -or $_.KeyCredentials } | Select DisplayName, AppId
Get-MgDomain | Select Id, AuthenticationType # Federated domains you don't expect = critical
Get-MgOauth2PermissionGrant -All | Where-Object { $_.ConsentType -eq "AllPrincipals" }Response
Remove attacker auth methods, role assignments, app credentials and consents; revert federation changes (then rotate token-signing certificates if AD FS/IdP compromised); revoke sessions of affected users; review CA policy changes. Export evidence first.
Related skills
entra-signin-investigation, oauth-app-review, conditional-access-review, token-theft-investigation
References
- Entra audit log activities: https://learn.microsoft.com/en-us/entra/identity/monitoring-health/reference-audit-activities
- CISA/Microsoft guidance on detecting post-compromise in Entra/M365 (AA21-008A): https://www.cisa.gov/news-events/cybersecurity-advisories/aa21-008a
- Microsoft app consent grant investigation: https://learn.microsoft.com/en-us/security/operations/incident-response-playbook-app-consent
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

