Introduction: "Something Happened. Can You Find Out?"
The other day I got this question:
The investigation itself isn't the hard part. Reading an audit record is easy. What takes the time is everything before that: working out what Defender XDR logs at all, where each kind of change ends up, and then going through every one of those places.
And almost every answer comes with a condition:
- A security setting changed in the Defender portal is in the Unified Audit Log, if the tenant has one and auditing was on.
- A device isolated is in the Unified Audit Log too. It's in
CloudAppEventsif you have Defender for Cloud Apps and its connector is set up right. And it's in Action center, which comes with Defender itself, so you can open it by hand even without an audit log and work on from there. - An antivirus or firewall policy pushed through security settings management is in Intune, not in the Unified Audit Log.
- A Sentinel analytics rule or data connector changed, even from inside the Defender portal, is in the Azure Activity log.
- Group and role changes and sign-ins are in Entra ID, and they reach Sentinel only if a diagnostic setting sends them to the right workspace.
Each place has its own API, its own retention and its own licence requirement. And not every tenant runs Microsoft 365 E5. What you can find depends on the licences and on what was configured before the question came in, so the investigation starts with the current state and drills down from there.
Should it be this complicated? No, it shouldn't. A security platform should be able to tell you who changed it, in one place. Defender XDR can't, so here's the map instead. I mapped every source and every Defender record type, and ran both ways of reading the audit log against my own tenant.
1. The Map: Where Each Change Is Logged
Before any search, you need to know which log would have this change. Search the wrong one and you find nothing, which looks exactly like "nobody did anything". The map shows where each change goes when everything is in place; whether it is in place in your tenant is the first thing to check.
Read the drawing from left to right: the kind of change, the log Microsoft writes it to, and the table it lands in once you bring it into Sentinel.
What Is Never Audited
Set this expectation at the start of the investigation, not at the end. The audit trail covers changes and actions. Most reads aren't audited: one exception is an admin previewing or downloading an email in Threat Explorer, which writes an AdminMailAccess record. What isn't audited:
- Views in the Defender portal. Opening an incident or a device page leaves no audit record.
- Advanced hunting queries on Defender's own tables, such as
CloudAppEvents, when they're run in the portal. Queries on Sentinel tables are inLAQueryLogs, and a call to the GraphrunHuntingQueryAPI is inMicrosoftGraphActivityLogs, if that log is turned on. - Live Response per command. The audit log has the session, not the commands.
- Advanced features that aren't GA.
SetAdvancedFeaturescovers generally available features only.
2. Start with the Current State
What you can find depends on the tenant: the licences it has, and what was configured before the question came in. So the first step isn't a search. It's the current state of each place on the map. Then you drill down into the places that have data.
Check the Licence
Start with what the tenant has. The licence decides whether there is an audit log at all, and whether it was on by default. This lists the licences in the tenant:
# The tenant's licences, with how many are assigned
az rest --method get --url 'https://graph.microsoft.com/v1.0/subscribedSkus' --query 'value[].{sku:skuPartNumber, assigned:consumedUnits, status:capabilityStatus}' -o table
The command lists each licence by its SKU part number, such as SPE_E5 for Microsoft 365 E5. Microsoft's Product names and service plan identifiers for licensing page translates them into product names. Which of those products include the audit log, according to the Purview service description:
| Licence in the tenant | Audit log |
|---|---|
| Microsoft 365 E5 / A5 / G5 | Yes, on by default |
| Microsoft 365 / Office 365 E3, E1, F1/F3, A1/A3 | Yes, on by default |
| Microsoft 365 Business Basic / Standard / Premium | Yes, but off by default: auditing "isn't enabled by default for SMB licenses". If nobody turned it on, there is no history to search |
| Defender for Endpoint P2 standalone | Not listed for Audit (Standard), although the SKU includes the Exchange Foundation service plan: the auditing check decides |
| Defender for Endpoint P1 / Defender for Business standalone | Not included: no Exchange Foundation service plan, not listed for Audit (Standard) |
| Defender for Cloud with Defender for Servers only | Not included: no Microsoft 365 licence |
Defender records don't need Audit (Premium): none of the Defender audited activities carry a Premium note, so Standard is enough.
Check That Auditing Is On
The Unified Audit Log is Microsoft Purview Audit, and it runs on Exchange Online: the audit roles (Audit Logs, View-Only Audit Logs) are Exchange Online roles, the setting that turns auditing on (UnifiedAuditLogIngestionEnabled) is an Exchange Online setting, and Search-UnifiedAuditLog is an Exchange Online cmdlet. The check takes one minute and answers two questions: is auditing on, and does the audit log return anything?
# Install the Exchange Online module, version 3 or later (once)
Install-Module -Name ExchangeOnlineManagement -Scope CurrentUser
# Sign in with an account that has the View-Only Audit Logs role
Connect-ExchangeOnline -ShowBanner:$false
# Is auditing on?
Get-AdminAuditLogConfig | Format-List -Property UnifiedAuditLogIngestionEnabled
# Does the audit log return anything for the last 24 hours?
$searchParams = @{
StartDate = (Get-Date).AddDays(-1)
EndDate = Get-Date
ResultSize = 1
}
Search-UnifiedAuditLog @searchParams | Select-Object -Property CreationDate, RecordType
If UnifiedAuditLogIngestionEnabled is True, auditing is on. If it's False, auditing is off, and nothing was recorded while it was off. Turn it on with Set-AdminAuditLogConfig -UnifiedAuditLogIngestionEnabled $true.
Older guides also send you to a Unified audit log switch in the Defender for Endpoint advanced features. It isn't there any more: in my tenant, Settings → Endpoints, now a tab called Optional features, has no such option. Microsoft's Defender XDR auditing page says "Auditing is automatically turned on for Microsoft Defender", so the Purview auditing check above is the one that decides.
Check Retention
E5 doesn't change the retention of Defender records. Audit (Premium) has a default retention policy that keeps records for one year, but only for the AzureActiveDirectory, Exchange, OneDrive and SharePoint workloads, and only for users with an E5 (or Purview Suite, or E5 eDiscovery and Audit add-on) licence. "Audit records for all other activities are retained for 180 days by default." That includes Defender:
| Plan | Defender records kept | How to keep them longer |
|---|---|---|
| Audit (Standard) | 180 days | export them to your SIEM |
| Audit (Premium), E5 | 180 days | a custom audit retention policy for the Defender record types (up to 1 year), or your SIEM |
| E5 with the 10-Year Audit Log Retention add-on | 180 days | a custom policy of 3, 5, 7 or 10 years |
Custom retention policies live in the Purview portal under Audit → Audit retention policies, up to 50 of them. Target the Defender record types.
Check the Diagnostic Settings
The Intune and Entra ID logs are always kept in their own admin centers, and they reach Sentinel only through a diagnostic setting. A diagnostic setting can exist, with the right categories ticked, and send everything to a different Log Analytics workspace than the one Sentinel uses. The table in the Sentinel workspace stays empty, and nothing fails or alerts.
Checking where they point takes ten seconds:
# Where does each Intune diagnostic setting send its logs?
$intuneUri = 'https://management.azure.com/providers/microsoft.intune/diagnosticSettings?api-version=2017-04-01-preview'
az rest --method get --url $intuneUri --query 'value[].{name:name, workspace:properties.workspaceId}'
# Where does each Entra ID diagnostic setting send its logs?
$entraUri = 'https://management.azure.com/providers/microsoft.aadiam/diagnosticSettings?api-version=2017-04-01'
az rest --method get --url $entraUri --query 'value[].{name:name, workspace:properties.workspaceId}'
Check Sentinel
Sentinel is managed in the Defender portal now. Many new customers have been onboarded straight to it since July 2025, and after 31 March 2027 Microsoft no longer supports Sentinel in the Azure portal. Where its settings sit in the portal keeps changing, but the two settings that decide what Sentinel records about its own changes are both diagnostic settings, so you check them the same way as Intune's and Entra ID's:
- The Azure Activity log reaches the workspace through a diagnostic setting on the subscription. Without it there's no
AzureActivity. - Auditing and health monitoring turns on
SentinelAudit, which Microsoft says is billable. Turning it on "adds the right diagnostic settings for you"; in my tenant that's one diagnostic setting on the Sentinel resource under the workspace.
# Does the subscription send its Activity log to the Sentinel workspace?
az monitor diagnostic-settings subscription list --query 'value[].{name:name, workspace:workspaceId}'
# Is Sentinel auditing and health monitoring on, and where does it send?
$sentinelUri = '<workspace resource id>/providers/Microsoft.SecurityInsights/settings/SentinelHealth'
az monitor diagnostic-settings list --resource $sentinelUri --query '[].{name:name, workspace:workspaceId}'
The Current State Together
Put together, the checks tell you which places have data for this question, and which don't. That's where the drill-down starts:
| Place | What has to be in place | How far back | If it isn't in place |
|---|---|---|---|
| Unified Audit Log | Exchange Online, auditing on, a licence that includes Audit (Standard) | 180 days for Defender records, longer with a custom retention policy | Action center and the product APIs |
| Intune audit log | in Sentinel (IntuneAuditLogs): the Intune diagnostic setting points to the Sentinel workspace | two years in Intune | the Intune admin center or Graph |
| Entra ID logs | in Sentinel (AuditLogs, SigninLogs): the Entra ID diagnostic settings point to the Sentinel workspace | 7 days with Entra ID Free, 30 days with P1/P2 | the Entra admin center |
| Azure Activity log | in Sentinel (AzureActivity): the subscription diagnostic setting points to the Sentinel workspace | 90 days in Azure | the Azure Activity log in the Azure portal |
SentinelAudit | Auditing and health monitoring on | your workspace retention | AzureActivity, without the rule content |
CloudAppEvents | Defender for Cloud Apps, plus a chain of connector conditions | 30 days in advanced hunting by default | the audit log |
| Action center | Defender for Endpoint, Defender for Office 365 or Defender XDR, and a role that can see it; no audit licence | the History filter goes back 6 months |
3. What the Audit Log Records
Every audit record has a record type, and that's how you find Defender activity among millions of Exchange, SharePoint and Teams records. I went through every record type Microsoft documents, plus the ones only the Graph metadata knows about, and ended up with a map of 128 record types with the product each belongs to: 82 of them admin activity, the rest telemetry.
You don't need all 128. You need the one that answers your question, so start from the question:
| Product | The question | Record type | Look for |
|---|---|---|---|
| Defender for Endpoint | Who isolated, scanned or offboarded a device? | MSDEResponseActions | IsolateDevice, RunAntiVirusScan, DeviceOffBoarding |
| Who started Live Response or pulled a file? | MSDEResponseActions | RunLiveResponseSession, LiveResponseGetFile | |
| Who added, changed or deleted an indicator? | MSDEIndicatorsSettings | AddIndicator, EditIndicator, DeleteIndicator | |
| Who changed an advanced feature or the data retention? | MSDEGeneralSettings | SetAdvancedFeatures, ChangeDataRetention | |
| Who changed an MDE role? | MSDERolesSettings | AddRole, EditRole, DeleteRole | |
| Defender XDR | Who assigned, closed or reclassified an incident? | MS365DIncident | AssignUserToIncident, UpdateIncidentStatus, EditIncidentClassification |
| Who changed a custom detection? | MS365DCustomDetection | create, edit, delete, status | |
| Who suppressed alerts? | MS365DSuppressionRule | create, enable, disable | |
| What did automated investigation do? | AirInvestigation | investigation actions | |
| Defender for Office 365 | Who changed a Safe Links, Safe Attachments or anti-phishing policy? | ExchangeAdmin | Set-SafeLinksPolicy, New-AntiPhishRule |
| Who released a message from quarantine? | Quarantine | release actions | |
| Defender for Identity | Who changed a sensor or an exclusion? | MicrosoftDefenderForIdentityAudit | sensor and exclusion changes |
| Sentinel (Defender portal) | Who ran KQL on the data lake, and which query? | SentinelKQLOnLake | KQLQueryCompleted, with the query text |
| Security Copilot | Who used Security Copilot? | CopilotInteraction | AppIdentity starting with Copilot.Security; the type holds every Microsoft 365 Copilot chat |
| The audit itself | Who searched the audit log? | AuditSearch | AuditSearchCreated, AuditSearchCompleted |
Anatomy of a Record
The record type tells you where to look. The record itself tells you what happened. This is an MSDEGeneralSettings record from my tenant, with the ids, account and IP masked:
{
"CreationTime": "2026-11-22T16:03:44",
"Id": "<guid>",
"Operation": "SetAdvancedFeatures",
"OrganizationId": "<tenant guid>",
"RecordType": 111,
"UserKey": "<guid>",
"UserType": 2,
"Workload": "MicrosoftDefenderForEndpoint",
"UserId": "admin@contoso.com",
"ClientIP": "::ffff:192.0.2.10",
"SettingName": "Low fidelity enrichment enabled",
"SettingsNewValue": "False"
}
Two kinds of fields are in every record:
- The common fields (
CreationTime,UserId,UserType,Operation,Workload,ClientIP) answer who and when.CreationTimeis UTC, without a zone marker. - The product fields (
SettingNameandSettingsNewValuehere,IndicatorValuefor an indicator) answer what exactly. Keep the whole record, or you keep half the answer.
What I Found in My Tenant
Three things in the records of my tenant change how you filter:
- Sentinel automation has no user. When an automation rule or a playbook changes an incident,
UserIdis empty andUserTypeis 5. The actor is inAppAccessContext.ClientAppName(Sentinel). Filter onUserIdand your automation disappears. ExchangeAdminis every audited Exchange admin change in the tenant (cmdlets that start withGet-,Search-orTest-aren't audited). In my first 90-day test, 49 records were Defender activity and 2,509 were ordinary Exchange admin changes. Filter on the Defender for Office 365 and EOP policy cmdlets, about 140 of them.- More incident operations than you'd filter for. Besides the status, assignment and classification changes, my tenant had
UpdateIncidentSeverityandUpdateIncidentResolvingComment. Filter on the record type, not on a list of operations.
Record Type Names
Both the cmdlet and the Graph API take record type names, and three details about the names matter:
- Use names, never numbers. For the Sentinel data lake and Security Copilot types, the numbers in the Management Activity API schema and in the Graph metadata disagree.
- Spelling isn't consistent across Microsoft's pages (
MSDEIndicatorsSettingsversusMSDEIndicatorSettings). Check the value in your own tenant before you hard-code it. - The v1.0 reference page lists fewer types than the API takes. The page lists 311 record types; the v1.0
$metadatahas 507. The URBAC, Sentinel, Copilot and case management types are in the metadata and on the beta page, and they work in v1.0.
4. Reading the Audit Log: Search-UnifiedAuditLog and the Graph API
There are three ways into the audit log, and Microsoft is retiring the one most scripts use. On 15 October 2027 Search-UnifiedAuditLog retires (Message Center MC1505599), and the Microsoft Graph audit log query API, generally available since October 2026, replaces it.
The Audit Page Is Purview
The obvious first stop is Audit in the Defender portal. It looks like a Defender feature. It isn't: it's Purview Audit, the same search as in the Purview portal, over the same Unified Audit Log. That explains how it behaves:
| Aspect | What Microsoft documents |
|---|---|
| Model | an asynchronous search job that keeps running when you close the browser |
| Duration | "Broadly-scoped Search jobs may take up to 48 hours" |
| Concurrency | 10 jobs per user, one of them unfiltered |
| Range | up to 180 days per search, 7 days by default |
| Results kept | 30 days |
| Export | 50,000 rows with Audit (Standard), 1,000,000 with Audit (Premium) |
For a one-off investigation by someone who doesn't script, it's fine. For "what happened in the last 24 hours, now", you want one of the two methods below.
Method 1: Search-UnifiedAuditLog
The cmdlet the Audit page is built on. For a narrow question it answers in seconds. It needs the same Exchange Online module and audit role as the auditing check.
A narrow question, "who isolated a device yesterday?", is one call. The details sit in AuditData, a JSON string, so the last step turns it into an object:
# Sign in to Exchange Online
Connect-ExchangeOnline -ShowBanner:$false
# Who isolated a device in the last 24 hours?
$searchParams = @{
StartDate = (Get-Date).AddDays(-1)
EndDate = Get-Date
RecordType = 'MSDEResponseActions'
Operations = 'IsolateDevice'
ResultSize = 5000
}
$results = Search-UnifiedAuditLog @searchParams
# The details are in AuditData, a JSON string
$results |
ForEach-Object -Process { $_.AuditData | ConvertFrom-Json } |
Select-Object -Property CreationTime, UserId, Operation, ClientIP
A broad question is where the cmdlet gets slow. -RecordType takes one value, so covering the Defender record types means one search per type:
# The Defender record types to search
$recordTypes = @(
'MSDEResponseActions'
'MSDEIndicatorsSettings'
'MSDEGeneralSettings'
'MSDERolesSettings'
'MS365DIncident'
'MS365DCustomDetection'
'MS365DSuppressionRule'
'URBACRole'
'URBACAssignment'
)
$start = (Get-Date).AddDays(-7)
$end = Get-Date
# One search per record type: -RecordType takes a single value
$results = foreach ($recordType in $recordTypes) {
Search-UnifiedAuditLog -StartDate $start -EndDate $end -RecordType $recordType -ResultSize 5000
# Space the calls a little
Start-Sleep -Seconds 1
}
A single call returns at most 5,000 records. Past that you need a session, which pages through up to 50,000 records per search. Beyond 50,000, Microsoft's own script slices the time range into 60-minute chunks, and smaller ones when a chunk is still too big:
# One session pages through up to 50,000 records
$searchParams = @{
StartDate = $start
EndDate = $end
RecordType = 'MSDEGeneralSettings'
SessionId = [guid]::NewGuid().ToString()
SessionCommand = 'ReturnLargeSet'
ResultSize = 5000
}
$records = [System.Collections.Generic.List[object]]::new()
do {
$page = @(Search-UnifiedAuditLog @searchParams)
$records.AddRange([object[]]$page)
# The last page is the one whose last ResultIndex reaches ResultCount
if (($page | Measure-Object).Count -ne 0 -and $page[-1].ResultIndex -eq $page[0].ResultCount) {
break
}
} while (($page | Measure-Object).Count -ne 0)
# ReturnLargeSet is unsorted and can return a record twice: keep each record once
$unique = $records | Sort-Object -Property Identity -Unique
These are the limits that shape everything you build on the cmdlet:
| Limit | Value |
|---|---|
| Records per call | 100 by default, -ResultSize up to 5,000 |
| Records per search | 50,000 with -SessionCommand ReturnLargeSet (unsorted); ReturnNextPreviewPage is sorted, but only 5,000 |
| Record types per call | one |
| Completeness | -HighCompleteness: "more complete search results but might take significantly longer"; without it, "the query runs faster but might have missing search results" |
Method 2: The Microsoft Graph Audit Log Query API
The replacement works differently, and that's the part that turns a migration into a redesign: it's asynchronous. You submit a query, it runs for minutes, and you come back for the records:
What it needs:
| Requirement | Detail |
|---|---|
| Permission | AuditLogsQuery.Read.All: delegated for a person, application for an app or a managed identity, with admin consent |
| Narrower permissions | AuditLogsQuery-Exchange.Read.All, -Endpoint, -Entra, -SharePoint, -OneDrive, -CRM |
| The audit log | the same one underneath: Exchange Online and auditing on |
| Cloud | the global service only, not US Government L4/L5 or China |
For unattended runs you need an identity with the application permission. An app registration gets it through admin consent. A managed identity has no consent screen, so you assign the app role yourself:
# Sign in with the rights to assign an app role
Connect-MgGraph -Scopes 'Application.Read.All', 'AppRoleAssignment.ReadWrite.All' -NoWelcome
# The managed identity's object (principal) id
$managedIdentityId = '<managed identity object id>'
# Microsoft Graph, and its AuditLogsQuery.Read.All app role
$graph = Get-MgServicePrincipal -Filter "appId eq '00000003-0000-0000-c000-000000000000'"
$appRole = $graph.AppRoles | Where-Object -FilterScript { $_.Value -eq 'AuditLogsQuery.Read.All' }
# Assign the app role to the managed identity
$assignmentParams = @{
ServicePrincipalId = $managedIdentityId
PrincipalId = $managedIdentityId
ResourceId = $graph.Id
AppRoleId = $appRole.Id
}
New-MgServicePrincipalAppRoleAssignment @assignmentParams
This is the whole flow as one script. Unlike the cmdlet, every record type you list goes into one query:
#Requires -Modules Microsoft.Graph.Authentication
param(
[datetime] $StartUtc = (Get-Date).ToUniversalTime().AddDays(-1),
[datetime] $EndUtc = (Get-Date).ToUniversalTime()
)
Connect-MgGraph -Scopes 'AuditLogsQuery.Read.All' -NoWelcome
$baseUri = 'https://graph.microsoft.com/v1.0/security/auditLog/queries'
# 1. Submit: the record types, all in one query
$recordTypes = @(
'MSDEResponseActions'
'MSDEIndicatorsSettings'
'MSDEGeneralSettings'
'MSDERolesSettings'
'MS365DIncident'
'MS365DCustomDetection'
'MS365DSuppressionRule'
'URBACRole'
'URBACAssignment'
)
$body = @{
'@odata.type' = '#microsoft.graph.security.auditLogQuery'
displayName = "Investigation $(Get-Date -Format 'yyyyMMdd-HHmm')"
filterStartDateTime = $StartUtc.ToString('yyyy-MM-ddTHH:mm:ssZ')
filterEndDateTime = $EndUtc.ToString('yyyy-MM-ddTHH:mm:ssZ')
recordTypeFilters = $recordTypes
} | ConvertTo-Json
$query = Invoke-MgGraphRequest -Method POST -Uri $baseUri -Body $body -ContentType 'application/json'
# 2. Wait: ask for the status every 15 seconds
do {
Start-Sleep -Seconds 15
$status = Invoke-MgGraphRequest -Method GET -Uri "$baseUri/$($query.id)"
Write-Host "Status: $($status.status)"
} while ($status.status -in 'notStarted', 'running')
if ($status.status -ne 'succeeded') {
throw "The query ended $($status.status)."
}
if ($status.isRecordCountLimitExceeded) {
Write-Warning 'The query reached the record limit. Split the time window.'
}
# 3. Read: page by page
$records = [System.Collections.Generic.List[object]]::new()
$uri = "$baseUri/$($query.id)/records"
while ($uri) {
$page = Invoke-MgGraphRequest -Method GET -Uri $uri
$records.AddRange([object[]]$page.value)
$uri = $page.'@odata.nextLink'
}
# 4. Use: the whole record is in auditData
$report = foreach ($record in $records) {
[pscustomobject]@{
Time = $record.createdDateTime
User = $record.userPrincipalName
Type = $record.auditLogRecordType
Operation = $record.operation
Setting = $record.auditData.SettingName
NewValue = $record.auditData.SettingsNewValue
}
}
$report | Sort-Object -Property Time | Format-Table -AutoSize
Microsoft publishes the limits in the Microsoft Graph service limits, under Security audit log query service limits. They're per tenant, and they're the reason you can't simply carry the one-search-per-type habit over to the new API:
| Limit | Value |
|---|---|
| Queries per tenant | at least 200 per rolling 24 hours |
| Queued or running at once | at least 50 |
| Records per query | at least 1,000,000 |
| Throttled | HTTP 429 with Retry-After; without it, back off exponentially |
succeeded, with isRecordCountLimitExceeded set. If you only check the status, you lose records without knowing it. Split the window in half and run both halves.
How long a query takes varies. Practitioners report 4 to 40 minutes, and Microsoft's own Q&A staff call the endpoints "slow at times". In my tests, one query held 82 record types and 140 operations.
Old Versus New, Measured
I ran both methods against the same 90 days and the same 82 record types in my tenant:
Search-UnifiedAuditLog | Graph audit log query API | |
|---|---|---|
| Calls | 82 searches, one per record type | one query |
| Time | about 7 minutes | 3 min 19 s: 45 s queued, 2 min running, 26 s to read 2,558 records |
| Defender records found | 49 | all 49, none missing |
| The record | the whole AuditData | the whole auditData, plus Graph @odata.type annotations to strip |
5. Security Settings Management and Intune
Take a question like this: "Who changed the antivirus policy?" Or the firewall policy, the attack surface reduction rules, the EDR settings, the exclusions.
With security settings management, Defender for Endpoint enforces endpoint security policies on devices that aren't enrolled in Intune, and you can create and edit those policies right in the Defender portal (Endpoints → Configuration management → Endpoint security policies). It looks like a Defender setting. It isn't. Microsoft is clear about what these policies are:
- "You can use the Microsoft Intune admin center or the Microsoft 365 Defender portal to manage Intune endpoint security policies for Defender for Endpoint and assign those policies to Microsoft Entra ID groups."
- "Security settings management through the Defender portal uses the same Intune RBAC permissions."
- "Devices managed through Defender for Endpoint security settings management check in with Intune every 90 minutes for policy updates."
The Defender portal page is a second interface over the same Intune objects. The Unified Audit Log has no endpoint security policy operations among the Defender activities, and no Intune activities at all. The audit trail is Intune's.
The policy change is logged in Intune and the group membership in Entra ID. The Unified Audit Log has no record of the policy change:
Which Log for Which Defender Setting
The line between "Defender setting" and "Intune policy" isn't obvious. This is where each kind of change is recorded:
| The change | Made in | Logged in |
|---|---|---|
| Advanced features | Defender portal, Settings → Endpoints | Unified Audit Log, MSDEGeneralSettings (SetAdvancedFeatures, GA features only) |
| Tamper protection, as a policy | Intune (Antivirus → Windows Security Experience) | Intune audit log; the Intune policy wins over the portal toggle |
| Antivirus, firewall, ASR, EDR and exclusion policies | Intune admin center or Defender portal | Intune audit log |
| MDE roles | Defender portal | Unified Audit Log: AddRole, EditRole, DeleteRole |
The Intune Audit Log
This is what Microsoft documents about the Intune audit log:
| Aspect | What Microsoft documents |
|---|---|
| What's recorded | "the create, update (edit), delete, assign, and remote actions all create audit events" |
| On or off | "Auditing is enabled for all customers. It can't be disabled." |
| Who and what | the actor, where it was run, the targets, and each changed property with its old and new value |
| Retention | "Intune maintains audit logs for user and device actions for two years." |
| Where | Intune admin center → Tenant administration → Audit logs |
| Graph API | GET /deviceManagement/auditEvents, v1.0 and beta |
| Permission | DeviceManagementApps.Read.All |
| Licence | the Graph API "requires an active Intune license for the tenant" |
In my tenant, I changed the description of an antivirus policy in the Intune admin center. The Intune audit log had the change within minutes: who, from which app, which policy, and its properties. Every property was listed with its new value and an empty old value, the description included, so for this kind of policy you see the state after the change, not what it was before.
Then I changed the description of another policy in the Defender portal. The Intune audit log had that change too, with the same activity type and the same empty old values. One field differed: the application. That's how you tell which console a change came from:
| Changed in | Application in the Intune audit log |
|---|---|
| Intune admin center | Microsoft Intune portal extension |
| Defender portal | WindowsDefenderATP (fc780465-2017-40d4-a0c5-307022471b92) |
The Groups Are Entra ID
Intune doesn't target devices one by one. "Intune policy assignments use Microsoft Entra security groups." So "why did this device get that firewall policy?" has two halves:
- The policy and its assignment: the Intune audit log.
- Who or what is in the group: the Entra ID audit log. Adding a device to a group changes which policies it gets, and Intune never sees that change.
In my tenant's Entra ID audit log, that's Add member to group with a device as the member, for a BitLocker profile group.
Getting It into Sentinel
There's no Intune data connector in Sentinel, and Microsoft's own Sentinel team wrote in 2026 that "there isn't a native pre-built Intune content pack as of now". The route is a diagnostic setting in the Intune admin center (Tenant administration → Diagnostics settings) that sends the AuditLogs category to your Sentinel workspace, where it lands in the IntuneAuditLogs table. Microsoft says audit logs are "sent immediately".
6. Entra ID: Sign-ins, Roles, Groups and Tenant Changes
Three things that matter in a Defender investigation are recorded in Entra ID, not in any Defender log:
- Group membership, which decides which devices get an Intune policy.
- Roles. Access to the Defender portal can come from Microsoft Entra roles such as Security Administrator. Assigning or removing one is an Entra ID change.
- Sign-ins. Every sign-in to the Defender portal, the Intune admin center and the Azure portal.
They're in two logs, and in Sentinel they arrive as these tables through the Entra ID diagnostic settings (the Microsoft Entra ID data connector sets them up):
| Log | What's in it | Sentinel table |
|---|---|---|
| Audit log | changes in the directory: users, groups and their members, roles, apps and consent, devices | AuditLogs |
| Sign-in log | interactive sign-ins | SigninLogs |
| sign-ins without the user, by service principals and by managed identities | AADNonInteractiveUserSignInLogs, AADServicePrincipalSignInLogs, AADManagedIdentitySignInLogs |
Some Entra ID changes also appear in the Unified Audit Log, under the AzureActiveDirectory workload.
7. Microsoft Sentinel: Its Own Audit Trail, and What It Collects for You
Sentinel brings two questions of its own. First: who changed Sentinel itself? And second: "We have Sentinel. Isn't all of this already in there?"
Who Changed Sentinel: AzureActivity
A Sentinel data connector, analytics rule or automation rule is an Azure resource (Microsoft.SecurityInsights). Changing or deleting one, in the Defender portal or the Azure portal, goes through Azure Resource Manager, and Azure Resource Manager writes to the Azure Activity log, not to the Unified Audit Log. The newer Sentinel platform features (data lake, jobs, notebooks, KQL on the lake) are different: those are in the Unified Audit Log. So "Sentinel" is in two logs, depending on which part of it you touched.
This is a data connector deletion in AzureActivity, from my workspace (the caller, IP and ids replaced):
TimeGenerated 2026-11-23T15:30:43Z OperationNameValue MICROSOFT.SECURITYINSIGHTS/DATACONNECTORS/DELETE ActivityStatusValue Success CategoryValue Administrative ResourceProviderValue MICROSOFT.OPERATIONALINSIGHTS Caller <the admin's UPN> CallerIpAddress <the admin's IP address> CorrelationId <guid> _ResourceId /subscriptions/<id>/resourcegroups/<rg>/providers/microsoft.operationalinsights/workspaces/<workspace>/providers/microsoft.securityinsights/dataconnectors/securityevents
The same deletion wrote a second record a second earlier, MICROSOFT.SECURITYINSIGHTS/METADATA/DELETE for dataconnector-securityevents. A connector built on a connector definition shows up as DATACONNECTORDEFINITIONS/DELETE.
AzureActivity gives you who, what, when and from which IP. It doesn't give you the content of the change: you see that a rule was written, not what changed in it. Defender for Cloud's changes (plans, alerts dismissed or resolved, workflow automations) are in the Azure Activity log too.
What Changed in a Rule: SentinelAudit
SentinelAudit has what AzureActivity is missing: the changed resource before and after, plus the names of the changed fields.
Microsoft's pages disagree about what it covers. The table reference says "Data Connectors, Analytic Rules and more". The page that tells you how to turn it on says "Only the analytics rule resource type is currently supported for auditing." In my tenant, the data connector deletions weren't in SentinelAudit. In practice, it's analytics rules only.
"Isn't Defender Activity Already in Sentinel?"
Mostly not. Here's what each built-in route gives you for Defender portal activity:
| Option | Defender portal activity? | The catch |
|---|---|---|
Microsoft 365 connector (OfficeActivity) | No | Exchange, SharePoint and Teams only, and free |
Defender XDR connector (incidents, alerts, Device*, Email* …) | No | telemetry about devices, mail and identities, not the admin audit. With one exception: CloudAppEvents |
CloudAppEvents | Yes, with Defender for Cloud Apps | a chain of conditions, below |
Management Activity API (Audit.General) | Yes, as a feed | content stays retrievable for 7 days; you build the ingestion |
| Community CCF connector ("Microsoft 365 Audit General and DLP") | Partly | fixed columns: SettingName, SettingsNewValue, IndicatorValue and AppAccessContext are dropped (version 3.0.0, April 2026) |
CloudAppEvents
CloudAppEvents is the closest thing to a built-in answer. Defender for Cloud Apps copies the audit log into it, so Defender admin activity becomes a table you can hunt in, alert on with custom detections, and stream to Sentinel. Device actions are in it too: Bert-Jan Pals shows isolation, Live Response and other device actions in CloudAppEvents in his post Audit Defender XDR Activities.
The catch is that every one of these conditions has to hold:
| # | Condition | Why it matters |
|---|---|---|
| 1 | A Defender for Cloud Apps licence (standalone, EMS E5, Microsoft 365 E5/A5/G5 and similar) | not in Microsoft 365 E3, Business Premium, Defender for Business or Office 365 E5 |
| 2 | At least one assigned Microsoft 365 licence | otherwise the connector fails with AF20012 |
| 3 | Auditing on | the audit log is the source |
| 4 | The Microsoft 365 app connector connected with Microsoft 365 activities | without it, Defender changes don't arrive |
| 5 | The connector healthy ("Connected") | while it isn't connected, it doesn't collect |
| 6 | No scoped-deployment exclusion | "activities generated by excluded users, groups, or apps aren't ingested" |
CloudAppEvents: it works today, and it can stop without notice.
So before you trust an empty result, check whether the table gets Defender data at all. Each Defender workload should show up with a recent last event:
CloudAppEvents | where Timestamp > ago(30d) | extend Workload = tostring(RawEventData.Workload) | summarize Events = count(), LastEvent = max(Timestamp) by Workload | sort by Events desc
If the audit log has Defender records and CloudAppEvents doesn't, the problem is on the Defender for Cloud Apps side (conditions 1, 4, 5, 6). If neither has them, check that auditing is on (condition 3).
CloudAppEvents is an advanced hunting table, so a script reads it through the advanced hunting API, and that API has moved to Microsoft Graph:
| The old APIs | Microsoft Graph | |
|---|---|---|
| Endpoint | Defender XDR: POST /api/advancedhunting/runDefender for Endpoint: POST /api/advancedqueries/runon api.security.microsoft.com | POST /v1.0/security/runHuntingQueryon graph.microsoft.com |
| Permission | AdvancedHunting.Read.All, AdvancedQuery.Read.All | ThreatHunting.Read.All, delegated or application |
| Status | retirement began in January 2026; they "will stop returning data on February 1, 2027" | the replacement |
The Graph API queries the last 30 days and returns up to 100,000 rows and 50 MB per request. A request that runs longer than three minutes times out, and a tenant can make at least 45 calls a minute.
When None of These Fit
Without Defender for Cloud Apps, no built-in route keeps the whole Defender record. I don't like codeless connectors: they're hard to troubleshoot, and they still depend on data collection rules and data collection endpoints, so they aren't really codeless. So I built my own Sentinel connector on an Azure Function. It's one of my solutions; everything in this article works without it.
8. Action Center and the Product APIs
Action center doesn't need the audit log or an audit licence. It comes with Defender for Endpoint, Defender for Office 365 and Defender XDR, for anyone with a role that can see it. Microsoft describes its History tab as one that "serves as an audit log for actions that were taken", and for a device action it's the place to start. From there the investigation goes on to the device itself and its timeline. Since 1 September 2026, automated investigation no longer runs as a separate investigation in Defender for Endpoint; in Defender for Office 365 it does. The incident Activity log does the same for an incident: every change, with "performed by", and it's also in the incident PDF export. The Live Response command log has what was run in a session.
What the portal shows by hand, the Defender and Graph product APIs give you in a form you can collect and keep. In tenants with no Exchange Online and no audit log, they're the history you have. They aren't an audit log, but they show who did what:
| Source | What you get |
|---|---|
| MDE machine actions | the device actions: isolate, release, antivirus scan, investigation package, restrict, quarantine, offboard and API Live Response, with requestor, comment and status. Not Live Response started from the device page |
| Incident and alert comments | author, time, text |
| Incidents | the last modifier and the current status, classification and assignment only |
| Indicators, custom detection rules | created by and last edited by only. Deleted objects are invisible |
An Entra app with these application permissions (admin consent) reads all of it. Note the first one: Microsoft documents only Machine.ReadWrite.All for listing machine actions, a write permission for a read:
| API | Application permissions |
|---|---|
| Microsoft Defender for Endpoint (WindowsDefenderATP) | Machine.ReadWrite.All, Ti.ReadWrite.All (to see indicators created by others), Alert.Read.All |
| Microsoft Graph | SecurityIncident.Read.All, SecurityAlert.Read.All, CustomDetection.Read.All |
The APIs show what exists now, not what was deleted. Collect more than once and keep every run, and a deleted indicator shows up as something that was there yesterday and isn't today.
9. Who Watches the Watchmen?
One record type audits the audit log itself.
The first time I brought the audit log into Sentinel, there were ten records. Two were my Defender changes. The other eight were... me. AuditSearchCreated and AuditSearchCompleted, with my account, the name of the search, the record types I asked for, the time span, and how many records came back. They were my own investigation searches from that morning.
Microsoft writes an AuditSearch record every time somebody searches the audit log: a person in the Purview portal, a script through Graph, or an app. One way of searching isn't covered: "Audit search and export activities that use Search-UnifiedAuditLog aren't audited." Each search is two records, one when it starts and one when it ends with the result count. An app's searches show up with the app's client id in UserId, so a managed identity that reads the audit log is visible too.
These are the fields that make it useful:
| Field | What it tells you |
|---|---|
UserId | who searched: a person, or an app's client id |
SearchJobName | the search's name |
CompletionStatus, ResultsCount | how it ended and how many records came back |
SearchFilters | JSON text with the record types, operations, users, free text and the time span, and IsGraphSearch |
That's the audit of the audit:
- Who searched the audit log in the last 30 days?
- Who searched for one specific person's activity? (
SearchFilters.Users) - Who exported results?
- Is there a script out there using up the tenant's daily Graph query limit?
Queries: LAQueryLogs
AuditSearch covers searches of the audit log. Queries against the Sentinel workspace have their own audit, LAQueryLogs, and it's off until you turn it on: a diagnostic setting on the Log Analytics workspace that sends the Audit category to the same workspace. From then on every query a person or an app runs is a row (queries Azure runs itself, such as scheduled alert rules, aren't logged): who ran it (AADEmail, AADObjectId), with which tool (RequestClientApp, AADClientId), the full query text, the workspace it ran against, and how many rows came back.
Microsoft's pages disagree about advanced hunting. The Azure Monitor page lists M365D_AdvancedHunting as a client app; the Sentinel audit page says queries from the Defender portal's advanced hunting aren't included. In my tenant:
| Query in advanced hunting | In LAQueryLogs? |
|---|---|
AzureActivity, a Sentinel table | yes, as M365D_AdvancedHunting, with the user and the query text |
CloudAppEvents, a Defender table | no |
union of 45 tables | getschema, which the portal runs itself each time advanced hunting opens | yes, under the user who opened the page |
The last row is a trap. Open advanced hunting and the portal queries the schema of the Sentinel tables in your name, so a person who only opened the page looks like someone who queried 45 tables. Leave those rows out:
LAQueryLogs | where TimeGenerated > ago(30d) | where QueryText !endswith "getschema" | project TimeGenerated, AADEmail, RequestClientApp, AADClientId, ResponseRowCount, QueryText | order by TimeGenerated desc
10. KQL Reference
All of these run in advanced hunting in the Defender portal, where Sentinel's Logs page now lives. I ran them against my own workspace.
Who changed Sentinel (needs the Azure Activity connector). It drops the "Start" and "Accept" duplicates and shows one row per change. It filters on the operation, because ResourceProviderValue on these records is MICROSOFT.OPERATIONALINSIGHTS, the workspace's provider.
AzureActivity
| where TimeGenerated > ago(30d)
| where OperationNameValue has "Microsoft.SecurityInsights"
| where ActivityStatusValue !in~ ("Start", "Started", "Accept", "Accepted")
| extend Resource = tolower(tostring(split(OperationNameValue, "/")[1])),
Action = tolower(tostring(split(OperationNameValue, "/")[-1])),
ResourceName = tostring(split(_ResourceId, "/")[-1])
| project TimeGenerated, Caller, CallerIpAddress, Action, Resource, ResourceName, ActivityStatusValue
| order by TimeGenerated desc
What changed in an analytics rule, with the rule before and after (needs Auditing and health monitoring):
SentinelAudit
| where TimeGenerated > ago(30d)
| project TimeGenerated,
Caller = tostring(ExtendedProperties.CallerName),
CallerIpAddress = tostring(ExtendedProperties.CallerIpAddress),
Rule = coalesce(tostring(ExtendedProperties.ResourceDisplayName), SentinelResourceName),
ChangedFields = tostring(ExtendedProperties.ResourceDiffMemberNames),
Before = ExtendedProperties.OriginalResourceState,
After = ExtendedProperties.UpdatedResourceState
| order by TimeGenerated desc
Defender admin activity in CloudAppEvents, one row per action, with the full record in RawEventData (needs Defender for Cloud Apps):
CloudAppEvents
| where Timestamp > ago(7d)
| extend Workload = tostring(RawEventData.Workload), Operation = tostring(RawEventData.Operation)
| where Workload in ("MicrosoftDefenderForEndpoint", "Microsoft365Defender")
| project Timestamp, AccountDisplayName, Workload, Operation, ActionType, RawEventData
| order by Timestamp desc
Endpoint security policy changes from Intune, including the ones made in the Defender portal (needs the Intune diagnostic setting). The summarize removes the rows the export sends twice:
IntuneAuditLogs | where TimeGenerated > ago(30d) | extend P = parse_json(Properties) | summarize arg_max(TimeGenerated, *) by CorrelationId, OperationName | project TimeGenerated, Identity, OperationName, Category, ResultType, Properties = P | order by TimeGenerated desc
Conclusion
It started with one question: something happened, can you find out? The answer existed. It was in seven places, behind different APIs, and what each place had depended on the licences and on what was configured before the question came in. That's why the investigation starts with the current state, and only then goes to the place the change was written to.
It shouldn't be this complicated. For my own work I built an investigation tool that answers the question in one run, and a Sentinel connector that keeps the Defender audit trail next to everything else; both are part of my solutions. Until Microsoft puts it in one place, the map above does the job.
This is the tool's report for my own tenant, 90 days of Defender portal activity:
The audit trail in Sentinel, and a runbook for the day the question comes in. Get in touch.
Sources
Microsoft documentation, checked in November 2026:
- Audit (Standard) and Audit (Premium): Learn about auditing solutions in Microsoft Purview
- Audit retention: Manage audit log retention policies
- Auditing on or off, and the SMB licences: Turn auditing on or off
- Audit licensing: Microsoft Purview service description
- Audited activities and record types: Audit log activities, Office 365 Management Activity API schema
- Defender XDR auditing: Search the audit log for events in Microsoft Defender XDR
Search-UnifiedAuditLog: cmdlet reference, Use a PowerShell script to search the audit log; the retirement on 15 October 2027: Microsoft 365 Message Center, MC1505599- Graph audit log query API: auditLogQuery, Create auditLogQuery, List auditLogRecords, Microsoft Graph service limits
- Security settings management: Manage endpoint security policies with Defender for Endpoint
- Intune audit log: Use audit logs to track and monitor events, Send Intune log data to Azure Monitor, List auditEvents
- Sentinel in the Defender portal: Microsoft Sentinel in the Microsoft Defender portal, Transition your Microsoft Sentinel environment to the Defender portal
- Sentinel auditing: Auditing and health monitoring in Microsoft Sentinel, Turn on auditing and health monitoring, SentinelAudit table, Audit Microsoft Sentinel queries and activities
CloudAppEvents: CloudAppEvents table, Connect Microsoft 365 to Defender for Cloud Apps, Troubleshooting app connectors- Advanced hunting API: runHuntingQuery, Microsoft Graph security API overview, Microsoft Defender XDR advanced hunting API, Defender for Endpoint advanced hunting API
OfficeActivity: OfficeActivity table- Retention of the other places: Microsoft Entra data retention, Azure Monitor activity log, Advanced hunting overview, Action center
- Other audit sources: Microsoft Graph activity logs, Threat Explorer (
AdminMailAccess), List MachineActions - Query auditing: Audit queries in Azure Monitor Logs, Audit Microsoft Sentinel queries and activities
Community:
- Bert-Jan Pals, Audit Defender XDR Activities