The Microsoft 365 Unified Audit Log is the single most important forensic artifact in any cloud-focused investigation involving Microsoft services. It provides a centralized, timestamped record of all user and administrator activities across Exchange Online, SharePoint, OneDrive, Teams, Azure AD (Entra ID), and Microsoft Purview — but with a critical constraint: retention is limited to 90 days on E3 licenses and 365 days on E5. If you are reading this during an active investigation, begin log extraction immediately.
What Is the Unified Audit Log?
The Microsoft 365 Unified Audit Log (UAL) is a centralized logging system that aggregates audit events from across the entire Microsoft 365 ecosystem. When a user reads an email, downloads a SharePoint document, creates an inbox forwarding rule, logs in from a new IP address, or grants OAuth consent to a third-party application, that action is recorded as a JSON audit event in the UAL. The log is “unified” because it consolidates events from services that previously maintained separate, incompatible audit logs into a single searchable repository.
The UAL is accessed through three primary interfaces: the Microsoft Purview Compliance Portal (GUI-based search with limited result sets), the Search-UnifiedAuditLog PowerShell cmdlet (programmable, supports pagination for bulk extraction), and the Office 365 Management Activity API (REST-based, designed for SIEM integration and continuous log streaming). For forensic investigations, the PowerShell cmdlet is the standard extraction method because it supports date-range filtering, operation-type filtering, and handles the 5,000-record per-page pagination required for comprehensive collection.
Each UAL record is a JSON object containing a standard set of fields (CreationDate, UserIds, Operations, ResultStatus, ClientIP) plus an AuditData field that contains a nested JSON payload specific to the operation type. The AuditData field is where the forensically critical detail lives — for a MailItemsAccessed event, it contains the ClientInfoString, MailboxGuid, and individual message IDs; for a FileDownloaded event, it contains the file name, site URL, source IP, and user agent string.
The UAL retention clock is non-negotiable: E3 tenants lose audit data after 90 days, and E5 tenants after 365 days. If the investigation concerns events that occurred more than 90 days ago on an E3 tenant without a SIEM, that data is permanently gone. The single most impactful preventive measure for any M365 environment is streaming UAL to long-term storage (Sentinel, Splunk, or even Azure Blob) before an incident occurs.
Location & Format
Access Methods
| Method | Interface | Max Results | Notes |
|---|---|---|---|
| Purview Compliance Portal | GUI (browser) | 50,000 per search | Good for initial triage; limited filtering; exports to CSV |
| Search-UnifiedAuditLog | PowerShell | 5,000 per page (paginate for more) | Standard forensic extraction method; supports date/operation filters |
| Management Activity API | REST API | Streaming / subscription-based | Designed for SIEM integration; 7-day content blob availability |
| Microsoft Sentinel | KQL queries | Unlimited (within ingested data) | If UAL is being ingested into Sentinel, query OfficeActivity / AuditLogs tables |
Record Format
Each UAL record is a JSON object. The top-level fields are consistent across all record types:
| Field | Type | Forensic Value |
|---|---|---|
CreationDate | DateTime (UTC) | Timestamp of the audited action |
UserIds | String (UPN) | User principal name of the actor (e.g., jdoe@contoso.com) |
Operations | String | Operation name (e.g., MailItemsAccessed, FileDownloaded, New-InboxRule) |
ResultStatus | String | Success or failure indicator |
AuditData | JSON (nested) | Operation-specific payload containing IPs, user agents, resource identifiers, and detailed parameters |
Key Operations by Service
| Service | Operation | Forensic Significance |
|---|---|---|
| Exchange | MailItemsAccessed | Email reads with Bind (specific message) or Sync (bulk folder sync); ClientInfoString identifies client type |
| Exchange | New-InboxRule | Inbox forwarding rules — the signature of BEC; check for ForwardTo, ForwardAsAttachmentTo, RedirectTo |
| Exchange | Set-Mailbox | Mailbox delegation changes; -ForwardingSmtpAddress parameter indicates mail forwarding |
| Exchange | Send / SendAs / SendOnBehalf | Email sent from the compromised account; proves attacker sent messages |
| SharePoint | FileDownloaded | File downloads from SharePoint/OneDrive with filename, site URL, source IP |
| SharePoint | FileAccessed | File viewed (not downloaded); still indicates access to sensitive content |
| SharePoint | FileSyncDownloadedFull | OneDrive sync client downloaded a full file; indicates sync-based exfiltration |
| Azure AD | UserLoggedIn | Authentication events with IP, user agent, conditional access result, MFA status |
| Azure AD | Consent to application | OAuth consent grants — critical for detecting OAuth phishing / illicit consent attacks |
| Teams | MemberAdded / MessageSent | Teams activity; channel membership changes and message sends |
| Purview | DLPRuleMatch | DLP policy violations; proves sensitive data was detected in transit |
The MailItemsAccessed operation has two subtypes that are critical for BEC investigation. Bind means a specific email message was opened/read — the AuditData contains individual InternetMessageId values. Sync means a folder was synchronized (e.g., by Outlook or a mail client) — this generates fewer, aggregated records. The ClientInfoString field distinguishes between Client=OWA (browser), Client=Microsoft Outlook (MAPI), and Client=REST or Client=Microsoft Graph (API-based access, common in AiTM attacks). Seeing Client=REST from an IP that differs from the user’s normal pattern is a strong indicator of session token replay.
What It Reveals
The UAL provides cross-service visibility that no single endpoint artifact can match. The following investigative questions are directly answerable from UAL data:
- Who accessed the compromised mailbox and from where? —
MailItemsAccessedevents record theClientIP,ClientInfoString, andSessionIdfor every email read operation. Correlating IPs with geolocation and the user’s known travel patterns identifies unauthorized access. - Were inbox rules created to hide attacker activity? —
New-InboxRuleevents show the rule parameters (ForwardTo,DeleteMessage,MoveToFolder). BEC attackers typically create rules that forward copies of incoming mail and/or delete messages containing keywords like “invoice,” “wire,” or “payment.” - What emails were read by the attacker? —
MailItemsAccessedBind events containInternetMessageIdvalues that identify specific messages. Cross-referencing with Exchange message tracking logs reconstructs which emails the attacker surveilled. - Were files downloaded from SharePoint or OneDrive? —
FileDownloadedevents record the filename, site URL, source IP, and user agent. A spike in downloads from a single user account, especially from an unusual IP, indicates data theft. - Did the attacker grant OAuth consent to a malicious application? —
Consent to applicationevents record theAppId,Permissionsgranted, and the user who consented. OAuth consent phishing grants the attacker persistent access that survives password resets. - Was MFA bypassed? —
UserLoggedInevents includeAuthenticationDetailsshowing which authentication methods were used. AiTM attacks result in successful logins where the attacker replays a stolen session token, bypassing MFA entirely. - What was the scope of the compromise across services? — Because the UAL is unified, a single query can correlate Exchange mailbox access, SharePoint downloads, Teams messages, and Azure AD sign-ins for the same user account over the same time window.
In BEC investigations, the three most critical UAL operations are: New-InboxRule (proves the attacker established persistence and mail interception), MailItemsAccessed with Client=REST from a non-corporate IP (proves the attacker read emails via API), and Send operations from the compromised account (proves the attacker sent fraudulent messages). If all three are present, the BEC attack chain is fully documented.
Forensic Use Cases
1. Business Email Compromise (BEC) Investigation
The most common UAL forensic use case. An attacker compromises a user’s credentials via AiTM phishing, replays the stolen session token to access the mailbox, creates an inbox rule forwarding copies of financial correspondence to an external email address, surveys the mailbox for ongoing payment conversations, and then sends a fraudulent wire transfer instruction from the compromised account. The UAL records every step: UserLoggedIn from the attacker’s IP, New-InboxRule with ForwardTo parameter, MailItemsAccessed Bind events showing which emails were read, and Send events for the fraudulent messages.
2. OAuth Consent Phishing
The attacker sends a link that prompts the user to grant OAuth permissions to a malicious Azure AD application. Once consent is granted, the application has persistent API-level access to the user’s mailbox, calendar, and files — access that survives password changes and MFA enforcement. The UAL Consent to application event records the AppId, the permissions granted (e.g., Mail.Read, Files.ReadWrite.All), and the timestamp. Revoking the application via Remove-AzureADOAuth2PermissionGrant terminates the persistent access.
3. SharePoint/OneDrive Data Theft
An insider or compromised account downloads hundreds of files from a sensitive SharePoint site. The UAL FileDownloaded events record each file by name, site URL, and source IP. Aggregating download volume by hour reveals activity spikes that correlate with off-hours access. If the downloads occurred from an IP address that does not match the user’s known locations, or if the user agent string indicates an automated tool rather than a browser, the access is likely unauthorized.
4. Insider Threat Cross-Service Correlation
The UAL’s cross-service visibility is uniquely valuable for insider threat investigations. A single query can show that the same user account read sensitive emails (MailItemsAccessed), downloaded the attached documents from SharePoint (FileDownloaded), forwarded them to a personal email address (Send with external recipient), and then deleted the sent items (SoftDelete). No other single artifact provides this cross-service activity correlation.
5. Account Takeover Scope Assessment
After an account compromise is detected, the UAL provides rapid scope assessment. Querying all operations for the compromised UserIds during the attack window reveals exactly which services the attacker accessed, which emails they read, which files they downloaded, which rules they created, and whether they pivoted to other accounts via delegation or impersonation. This scope assessment drives the remediation plan: if the attacker only accessed email, the response is different than if they also downloaded SharePoint content and granted OAuth consent.
Acquisition Methods
UAL data is permanently deleted after the retention window (90 days E3, 365 days E5). There is no recovery mechanism. If you are investigating an incident, extract all relevant UAL data immediately. Do not wait for authorization, scope definition, or legal review if there is any risk of data aging out. Extract first, analyze later.
PowerShell — Search-UnifiedAuditLog
# Connect to Exchange Online Connect-ExchangeOnline -UserPrincipalName admin@contoso.com # Search for all activity by a specific user in a date range # Note: Max 5,000 results per page; must paginate for full extraction $results = @() $sessionId = [guid]::NewGuid().ToString() $startDate = "2026-02-01" $endDate = "2026-03-01" $userIds = "jdoe@contoso.com" do { $batch = Search-UnifiedAuditLog ` -StartDate $startDate ` -EndDate $endDate ` -UserIds $userIds ` -SessionId $sessionId ` -SessionCommand ReturnLargeSet ` -ResultSize 5000 $results += $batch Write-Host "Retrieved $($results.Count) records..." } while ($batch.Count -eq 5000) # Export to JSON for analysis $results | ConvertTo-Json -Depth 10 | Out-File "C:\Evidence\UAL_jdoe.json" # Export AuditData field (nested JSON) to CSV for tabular analysis $results | ForEach-Object { $_.AuditData | ConvertFrom-Json } | Export-Csv "C:\Evidence\UAL_jdoe_auditdata.csv" -NoTypeInformation
PowerShell — Operation-Specific Queries
# Search for inbox rule creation (BEC indicator) Search-UnifiedAuditLog -StartDate "2026-02-01" -EndDate "2026-03-01" ` -Operations New-InboxRule,Set-InboxRule,Enable-InboxRule ` -ResultSize 5000 # Search for MailItemsAccessed (email surveillance) Search-UnifiedAuditLog -StartDate "2026-02-01" -EndDate "2026-03-01" ` -Operations MailItemsAccessed ` -UserIds "jdoe@contoso.com" ` -ResultSize 5000 # Search for SharePoint file downloads Search-UnifiedAuditLog -StartDate "2026-02-01" -EndDate "2026-03-01" ` -Operations FileDownloaded ` -ResultSize 5000 # Search for OAuth consent grants Search-UnifiedAuditLog -StartDate "2026-02-01" -EndDate "2026-03-01" ` -Operations "Consent to application" ` -ResultSize 5000
Automated Extraction Tools
| Tool | Author | License | Notes |
|---|---|---|---|
| Microsoft Extractor Suite | Invictus IR | Open source (Python) | Automated UAL extraction with pagination handling; also extracts Azure AD sign-in logs, mailbox rules, and OAuth apps |
| CrowdStrike CRT | CrowdStrike | Free | CRT (Cloud Response Tool) automates M365 log collection with pre-built forensic queries |
| HAWK | T0pCyber | Open source (PowerShell) | Automated BEC investigation module; extracts inbox rules, sign-in logs, and UAL events |
| Sparrow | CISA | Open source (PowerShell) | M365 compromise assessment tool; focuses on known compromise indicators |
Parsing & Analysis Techniques
Parsing the AuditData JSON
The most important step in UAL analysis is correctly parsing the nested AuditData JSON field. Each record’s AuditData contains the operation-specific details that drive forensic conclusions. The top-level UAL fields (CreationDate, UserIds, Operations) provide the index; the AuditData provides the evidence.
# Parse UAL JSON export and analyze MailItemsAccessed events import json import pandas as pd from collections import Counter with open('/evidence/UAL_jdoe.json', 'r') as f: records = json.load(f) # Extract AuditData from each record audit_data = [] for r in records: try: ad = json.loads(r['AuditData']) if isinstance(r['AuditData'], str) else r['AuditData'] audit_data.append(ad) except: continue df = pd.DataFrame(audit_data) # Analyze MailItemsAccessed — identify non-corporate IPs mail_access = df[df['Operation'] == 'MailItemsAccessed'].copy() ip_counts = Counter(mail_access['ClientIPAddress']) print("Top IPs accessing mailbox:") for ip, count in ip_counts.most_common(10): print(f" {ip}: {count} events") # Identify inbox rule creation rules = df[df['Operation'].isin(['New-InboxRule', 'Set-InboxRule'])] for _, rule in rules.iterrows(): params = rule.get('Parameters', []) print(f"Rule created at {rule['CreationTime']} from {rule.get('ClientIP', 'N/A')}") print(f" Parameters: {params}")
ClientInfoString Analysis
The ClientInfoString in MailItemsAccessed events identifies the client application. Key patterns for BEC/AiTM detection:
Client=OWA— Outlook Web Access (browser); normal for users accessing email via browserClient=Microsoft Outlook 16.0— Desktop Outlook via MAPI; normal for corporate usersClient=REST;Client=RESTSystem— Microsoft Graph API access; common in AiTM token replay attacksClient=CIM;Client=CIMApp— Cloud Intelligence Module; automated Microsoft scanning
Alert trigger: Client=REST or Client=Microsoft Graph from an IP that does not match the user’s normal access pattern is a high-confidence AiTM indicator.
Retention & Licensing
| License | UAL Retention | MailItemsAccessed Available? | Notes |
|---|---|---|---|
| E3 / Business Premium | 90 days | No (E5/G5 only) | Standard audit; does not include advanced audit events |
| E5 / G5 | 365 days | Yes | Advanced audit; includes MailItemsAccessed, Send, SearchQueryInitiatedExchange |
| E5 + 10-year retention add-on | 10 years | Yes | Microsoft Purview Audit (Premium) with long-term retention policies |
| Any license + SIEM | Unlimited (in SIEM) | Depends on base license | UAL streamed to Sentinel/Splunk is retained per SIEM retention policy |
MailItemsAccessed is the single most important BEC investigation artifact, and it is only available on E5/G5 licenses. Organizations on E3 cannot determine which specific emails the attacker read. If your organization handles financial transactions and is on E3, upgrading compromised accounts to E5 after the breach does not retroactively generate MailItemsAccessed events for the attack period. This is a preventive investment, not a reactive one.
Anti-Forensics Resilience
The UAL is a cloud-hosted, Microsoft-managed audit system. It cannot be directly modified, deleted, or tampered with by tenant administrators or attackers — with important caveats.
| Action | Impact on UAL | Explanation |
|---|---|---|
| Attacker clears browser/endpoint | None | UAL is server-side; endpoint cleanup has no effect on cloud audit logs |
| Attacker deletes emails | Generates events | Deletions generate SoftDelete, HardDelete, or MoveToDeletedItems events in the UAL |
| Attacker disables mailbox audit | Possible (admin) | A Global Admin can disable mailbox auditing via Set-Mailbox -AuditEnabled $false; generates its own audit event |
| Attacker disables UAL | Possible (admin) | A Global Admin can disable UAL via Set-AdminAuditLogConfig -UnifiedAuditLogIngestionEnabled $false; detectable in admin audit log |
| Retention expiry | Permanent data loss | After 90/365 days, data is permanently deleted by Microsoft; this is the primary forensic risk |
| Log tampering | Not possible | UAL records are immutable within the retention window; no API exists to modify or delete individual records |
The greatest threat to UAL evidence is not attacker action but retention expiry. In the majority of M365 investigations we handle, the limiting factor is whether the relevant logs still exist within the retention window — not whether they were tampered with. The UAL is effectively tamper-proof for the duration of its retention period, but it is also ephemeral by design.
MITRE ATT&CK Detection Mapping
UAL data provides evidentiary support for detecting the following MITRE ATT&CK techniques:
| Technique | Name | UAL Evidence |
|---|---|---|
T1114 T1114 | Email Collection | MailItemsAccessed Bind/Sync events; inbox rule creation with ForwardTo parameter; delegate access grants |
T1098 T1098 | Account Manipulation | New-InboxRule, Set-Mailbox forwarding changes, OAuth consent grants, mailbox delegation modifications |
T1530 T1530 | Data from Cloud Storage | FileDownloaded, FileAccessed, FileSyncDownloadedFull events in SharePoint/OneDrive |
T1078 T1078 | Valid Accounts | UserLoggedIn events with anomalous IPs, user agents, or conditional access bypass; MFA status in authentication details |
Related Artifacts & Case Studies
Corroborating Artifacts
| Artifact | Relationship to UAL | Cross-Correlation Value |
|---|---|---|
| Azure AD Sign-in Logs | Detailed authentication events with conditional access evaluation, MFA details, risk scores | Sign-in logs provide richer auth detail than UAL UserLoggedIn; cross-reference for impossible-travel and MFA bypass analysis |
| Exchange Message Tracking | SMTP-level message routing logs with sender, recipient, subject, timestamps | Cross-reference MailItemsAccessed InternetMessageIds with message tracking to identify exactly which emails were read |
| Mailbox Audit Log | Per-mailbox audit events (subset of UAL data) | Mailbox audit logs can be queried per-mailbox when UAL search is slow or timing out |
| Azure AD Audit Logs | Directory-level changes (user creation, role assignment, group membership) | Detect attacker privilege escalation, persistence via new accounts, or role assignment changes |
| Conditional Access Policies | Policy evaluation results in sign-in logs | Identify which policies were evaluated and whether they were bypassed during the attack |
| Chrome Artifacts | Browser history on the victim’s endpoint may show the phishing URL | Chrome History can identify the initial phishing URL that started the attack chain; complements server-side UAL evidence |
Case Studies
BEC Wire Fraud Investigation — UAL analysis revealed an inbox forwarding rule created 72 hours before a fraudulent wire transfer instruction was sent from the compromised account. MailItemsAccessed events showed the attacker surveilled the mailbox for three days, reading emails related to an ongoing acquisition. The ClientInfoString showed Client=REST from a VPN exit node in a different country, confirming AiTM session token replay.
Hybrid AiTM + Insider Threat — Cross-service UAL correlation revealed that the compromised account not only had its email surveilled but also downloaded 340 files from a restricted SharePoint site over 48 hours. The FileDownloaded events identified each file by name, and the source IPs matched the AiTM infrastructure. Without UAL’s unified view across Exchange and SharePoint, the SharePoint data theft component would have been missed entirely.
References
- Microsoft, “Search the audit log in Microsoft Purview” — https://learn.microsoft.com/en-us/purview/audit-log-search
- Microsoft, “Detailed properties in the audit log” — https://learn.microsoft.com/en-us/purview/audit-log-detailed-properties
- Invictus IR, “Microsoft Extractor Suite” — https://github.com/invictus-ir/Microsoft-Extractor-Suite
- CrowdStrike, “CRT — Cloud Response Tool” — https://github.com/CrowdStrike/CRT
- T0pCyber, “HAWK — Hunting Attacks in the Wild with Kinesis” — https://github.com/T0pCyber/hawk
- SANS Institute, “FOR509 — Enterprise Cloud Forensics and Incident Response” — https://www.sans.org/
- Microsoft, “MailItemsAccessed audit records” — https://learn.microsoft.com/en-us/purview/audit-mailitemsaccessed
- Invictus IR, “BEC Investigation Guide using M365 Unified Audit Log” — https://www.invictus-ir.com/
Mjolnir Security — Digital Forensics & Incident Response
Mjolnir Security provides 24/7 incident response, digital forensics, and expert witness testimony. Our DFIR team specializes in M365 compromise investigations, BEC response, and cloud forensics where Unified Audit Log analysis is central to determining attack scope and impact.
mjolnirsecurity.com — 24/7: +1 833 403 5875