agentleFS
kaandgnshkaandgnsh/Claude-Blue/skills/azure-security/entra-audit-investigation/SKILL.md

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.

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
  1. Distinctive:

    Remove attacker auth methods, role assignments, app credentials and consents.

    line 53

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Entra ID Audit Investigation

High-risk operations (AuditLogs.OperationName)

AreaOperationName examplesWhy
Auth methodsUser registered security info, Admin registered security info, User changed default security info, Update user (StrongAuthenticationMethod)Attacker adds own MFA device
RolesAdd member to role, Add eligible member to role (PIM), Add scoped member to rolePrivilege escalation
AppsAdd application, Update application – Certificates and secrets management, Add service principal credentials, Add owner to applicationBackdoor credentials on apps with high privileges
ConsentConsent to application, Add delegated permission grant, Add app role assignment to service principalOAuth persistence / illicit consent
FederationSet domain authentication, Set federation settings on domain, Add unverified domain, Verify domainGolden SAML / rogue IdP
PolicyUpdate conditional access policy, Delete conditional access policy, Update authorization policyDefense evasion
UsersAdd 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 asc

Note 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

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.