Sign in Get 3 free credits

Try a job or a niche: tiktok captions, study notes, excel formulas. Press Esc to close.

Microsoft 365 breach investigation

Investigates Microsoft 365 and Entra account takeovers from the logs, so you find and lock out the attacker.

What we improved

Fixed the MFA result codes. The original said 50076 means MFA completed; 50074 and 50076 both mean MFA was required and not yet satisfied in that request. Added a result code table with investigative readings (50126, 50053, 500121 for MFA f

Improved by YourAISkill from the original by trilwu, under its MIT licence. The download includes the author's licence and a CHANGES.md listing every change. Both Claude reviews read the improved version.

Claude's review

9/10 Accurate, deep M365 and Entra incident playbook: retention facts, non-truncating UAL paging, result codes, OAuth and inbox-rule forensics and full containment.

We asked Claude the question you would ask: would I be glad I installed this? Two separate reviews, the second blind to the first, must both rate a skill 7 or higher before we sell it.

In detail

Investigate security incidents in Microsoft 365 and Entra ID (Azure AD) -- search the Unified Audit Log, correlate sign-in and audit events, trace illicit OAuth consent grants, analyze mailbox rule manipulation, and contain compromised identities. Use when responding to a BEC incident, investigating Entra ID compromise, analyzing suspicious OAuth app permissions, tracing mail forwarding abuse, or reviewing Azure AD sign-in anomalies.

How you use it

  1. Add it to your pack, then download your pack (1 credit).
  2. In Claude, open Customize > Skills and upload the zip. Code execution needs to be on under Settings > Capabilities.
  3. Ask Claude for the job in your own words. It uses the skill when your request matches what it does. Step by step guide

Safety check

Nothing risky found: no hidden instructions, no download and run, no reading of saved passwords or keys.

An automated scan lowers risk but cannot promise zero risk. How we check skills

Preview

The first lines of SKILL.md
---
name: investigating-m365-entra
description: "Investigate Microsoft 365 and Entra ID (Azure AD) incidents: check which logs exist and their retention, search the Unified Audit Log without silent truncation, read interactive and non-interactive sign-ins and their result codes correctly, trace illicit OAuth grants and app credentials, find malicious inbox rules and forwarding, build a UTC timeline, and contain a compromised identity without leaving persistence. Use for business email compromise (BEC), Entra account takeover, MFA fatigue or adversary-in-the-middle phishing, suspicious OAuth apps, mail forwarding abuse, or sign-in anomalies."
verified: 2026-07-27
---

<!-- Modified by YourAISkill (youraiskill.com) on 2 December 2026 from the original by trilwu. See CHANGES.md. -->

# Investigating M365 and Entra ID

M365/Entra investigations have no disk images, memory dumps or event logs you collect yourself. Everything comes from Microsoft's log stores, with retention that depends on licence and settings. Knowing which logs exist, which are missing and how long they last is half the investigation.

## When to Use

BEC and invoice fraud, Entra account takeover (token replay, password spray, MFA fatigue, AiTM phishing), suspicious OAuth apps, hidden inbox rules and forwarding, Conditional Access or MFA method tampering. Out of scope: Azure subscription compromise, other clouds, offensive testing.

## First hour: preserve before you analyse

1. **Export before it ages out.** Sign-in and Entra audit logs roll off daily (30 days on P1/P2, 7 on free). Export the account's sign-ins and the tenant's audit logs for the full available window now, before any analysis.
2. **Place a litigation hold** on affected mailboxes (needs Exchange Online Plan 2, included in E3/E5) so items the attacker, or your clean-up, deletes stay in Recoverable Items.
3. **Snapshot persistence state** (inbox rules, forwarding, delegates, OAuth grants, auth methods) to files before anyone changes it. Containment will destroy this evidence otherwise.
4. Record your own admin actions with UTC times so they are not mistaken for attacker activity later.

## Log landscape and retention

Establish what you have and how far back it goes. Missing logs are a finding, not a reason to skip the question.

| Log source | Default retention | Notes |
| --- | --- | --- |
| Unified Audit Log (Purview Audit) | 180 days (Audit Standard) | 1 year for users licensed for Audit Premium (E5 or add-on), for Exchange, SharePoint, OneDrive and Entra ID records |
| Entra sign-in logs | 30 days (P1/P2), 7 days (free) | Four streams: interactive, non-interactive, service principal, managed identity. Stream to Log Analytics or a SIEM for longer |
| Entra audit logs | 30 days (P1/P2), 7 days (free) | Role changes, app registrations, credentials, CA policies, auth methods |
| Identity Protection | Shorter than the UAL; check Microsoft's Entra data retention page | Full risk detail needs Entra ID P2 |
| Mailbox audit log | 90 days (`AuditLogAgeLimit`), on by default | Feeds the UAL's Exchange mailbox records |
| Defender for Cloud Apps | 180 days | Needs an MDCA licence |
| Microsoft Graph activity logs | Only if a diagnostic setting was sending them before the incident | Shows what a stolen token did through Graph |

**Get the retention right before you conclude anything from a gap.** Since 17 October 2023 the Audit (Standard) default is **180 days**, not the 90 days older material cites. Retention is per user by licence, not per tenant: the same query can return a year for an E5 user and 180 days for the E3 user beside them. Confirm the account's licence before reading an empty result as "no activity", state the gap, and check the SIEM for longer history.

**MailItemsAccessed** was historically E5 only; Microsoft's 2023 to 2024 logging expansion brought it (and `Send`) to Audit (Standard), but whether a mailbox records it depends on licence and audit configuration. Check before concluding: `Get-Mailbox user@contoso.com | Select-Object -ExpandProperty AuditOwner` should include `MailItemsAccessed`, and a short UAL search for it should return the user's normal activity.
...

From trilwu's repository, MIT licence.

Related skills

  • Checked

    Codebase quality audit

    Audits a whole code repo for bugs, security holes, slow paths and dead code, ranked in plain English.

    by DietrichGebert 203k
    7/101 credit
  • Checked

    Security and CVE audit

    Runs a security and CVE audit on code in any language and scores it out of 100, with false alarms filtered.

    by opencrabs 1k
    7/101 credit
  • Checked

    OWASP code review

    Reviews code for security flaws using the latest OWASP Top 10 lists, including those for AI and agent apps.

    by agamm 467
    7/101 credit
  • Checked

    Code security hardening

    Hardens code that handles user input, logins and data against the OWASP Top 10, starting from a threat model.

    by addyosmani 122k
    7/101 credit
  • Checked

    Secure web backend code

    Writes and reviews login, access control and input handling for web backends, so common attacks are blocked.

    by Jeffallan 13k
    8/101 credit
  • Checked

    Android intent security

    Audits Android components and incoming intents to fix redirection and unauthorised access holes in your app.

    by android 11k
    8/101 credit

Secure checkout

Credits

AUD

  1. 1Choose
  2. 2Pay on Square
  3. 3Credits added