Dude, Where Are My Logs?

Defender XDR and Microsoft Sentinel audit investigation: what is logged, where each change goes, and how to read it

📖 28 min read
🎯 Advanced
🔧 Investigation Guide
💡 Defender XDR, Intune, Entra ID, Sentinel

Introduction: "Something Happened. Can You Find Out?"

The other day I got this question:

"Something happened in our environment. What happened? Can you find out?"

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 CloudAppEvents if 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.

One question, seven places: the Unified Audit Log, the Intune audit log, Entra ID, the Azure Activity log, SentinelAudit, the product APIs and Action center
One question, seven places.

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.

Where each Defender XDR, Intune, Entra ID and Sentinel change is logged, and the Sentinel table it lands in
Where each change is logged, and the table it lands in once it's in 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 in LAQueryLogs, and a call to the Graph runHuntingQuery API is in MicrosoftGraphActivityLogs, 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. SetAdvancedFeatures covers 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:

PowerShell - Which licences does the tenant have?
# 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 tenantAudit log
Microsoft 365 E5 / A5 / G5Yes, on by default
Microsoft 365 / Office 365 E3, E1, F1/F3, A1/A3Yes, on by default
Microsoft 365 Business Basic / Standard / PremiumYes, 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 standaloneNot listed for Audit (Standard), although the SKU includes the Exchange Foundation service plan: the auditing check decides
Defender for Endpoint P1 / Defender for Business standaloneNot included: no Exchange Foundation service plan, not listed for Audit (Standard)
Defender for Cloud with Defender for Servers onlyNot 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?

PowerShell - Is auditing on, and does the audit log return records?
# 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
PowerShell output: UnifiedAuditLogIngestionEnabled is True and Search-UnifiedAuditLog returns one record
One minute: auditing is on, and the audit log returns records.

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:

PlanDefender records keptHow to keep them longer
Audit (Standard)180 daysexport them to your SIEM
Audit (Premium), E5180 daysa 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-on180 daysa 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.

A Purview audit retention policy with Defender record types selected and a one-year duration
With E5, Defender records stay at 180 days until you create a policy like this.

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:

PowerShell - Where do the Intune and Entra ID diagnostic settings send their logs?
# 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.
PowerShell - Where do the Activity log and Sentinel auditing send their logs?
# 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:

PlaceWhat has to be in placeHow far backIf it isn't in place
Unified Audit LogExchange Online, auditing on, a licence that includes Audit (Standard)180 days for Defender records, longer with a custom retention policyAction center and the product APIs
Intune audit login Sentinel (IntuneAuditLogs): the Intune diagnostic setting points to the Sentinel workspacetwo years in Intunethe Intune admin center or Graph
Entra ID logsin Sentinel (AuditLogs, SigninLogs): the Entra ID diagnostic settings point to the Sentinel workspace7 days with Entra ID Free, 30 days with P1/P2the Entra admin center
Azure Activity login Sentinel (AzureActivity): the subscription diagnostic setting points to the Sentinel workspace90 days in Azurethe Azure Activity log in the Azure portal
SentinelAuditAuditing and health monitoring onyour workspace retentionAzureActivity, without the rule content
CloudAppEventsDefender for Cloud Apps, plus a chain of connector conditions30 days in advanced hunting by defaultthe audit log
Action centerDefender for Endpoint, Defender for Office 365 or Defender XDR, and a role that can see it; no audit licencethe 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:

ProductThe questionRecord typeLook for
Defender for EndpointWho isolated, scanned or offboarded a device?MSDEResponseActionsIsolateDevice, RunAntiVirusScan, DeviceOffBoarding
Who started Live Response or pulled a file?MSDEResponseActionsRunLiveResponseSession, LiveResponseGetFile
Who added, changed or deleted an indicator?MSDEIndicatorsSettingsAddIndicator, EditIndicator, DeleteIndicator
Who changed an advanced feature or the data retention?MSDEGeneralSettingsSetAdvancedFeatures, ChangeDataRetention
Who changed an MDE role?MSDERolesSettingsAddRole, EditRole, DeleteRole
Defender XDRWho assigned, closed or reclassified an incident?MS365DIncidentAssignUserToIncident, UpdateIncidentStatus, EditIncidentClassification
Who changed a custom detection?MS365DCustomDetectioncreate, edit, delete, status
Who suppressed alerts?MS365DSuppressionRulecreate, enable, disable
What did automated investigation do?AirInvestigationinvestigation actions
Defender for Office 365Who changed a Safe Links, Safe Attachments or anti-phishing policy?ExchangeAdminSet-SafeLinksPolicy, New-AntiPhishRule
Who released a message from quarantine?Quarantinerelease actions
Defender for IdentityWho changed a sensor or an exclusion?MicrosoftDefenderForIdentityAuditsensor and exclusion changes
Sentinel (Defender portal)Who ran KQL on the data lake, and which query?SentinelKQLOnLakeKQLQueryCompleted, with the query text
Security CopilotWho used Security Copilot?CopilotInteractionAppIdentity starting with Copilot.Security; the type holds every Microsoft 365 Copilot chat
The audit itselfWho searched the audit log?AuditSearchAuditSearchCreated, 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:

JSON - An MSDEGeneralSettings record
{
  "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. CreationTime is UTC, without a zone marker.
  • The product fields (SettingName and SettingsNewValue here, IndicatorValue for an indicator) answer what exactly. Keep the whole record, or you keep half the answer.
An audit search result with a SetAdvancedFeatures record opened, showing SettingName and SettingsNewValue in the details
The same record in the portal: the setting and its new value are in the details, not in the list.

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, UserId is empty and UserType is 5. The actor is in AppAccessContext.ClientAppName (Sentinel). Filter on UserId and your automation disappears.
  • ExchangeAdmin is every audited Exchange admin change in the tenant (cmdlets that start with Get-, Search- or Test- 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 UpdateIncidentSeverity and UpdateIncidentResolvingComment. 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 (MSDEIndicatorsSettings versus MSDEIndicatorSettings). 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 $metadata has 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:

AspectWhat Microsoft documents
Modelan asynchronous search job that keeps running when you close the browser
Duration"Broadly-scoped Search jobs may take up to 48 hours"
Concurrency10 jobs per user, one of them unfiltered
Rangeup to 180 days per search, 7 days by default
Results kept30 days
Export50,000 rows with Audit (Standard), 1,000,000 with Audit (Premium)
The Audit page in the Defender portal with one search job queued and one completed
The Audit page is the Purview audit search: every search is a job.

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:

PowerShell - Who isolated a device in the last 24 hours?
# 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:

PowerShell - One search per Defender record 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:

PowerShell - Page through up to 50,000 records in one session
# 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:

LimitValue
Records per call100 by default, -ResultSize up to 5,000
Records per search50,000 with -SessionCommand ReturnLargeSet (unsorted); ReturnNextPreviewPage is sorted, but only 5,000
Record types per callone
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:

The Graph audit log query lifecycle: submit the query, wait for the status to reach succeeded, read the records page by page
Submit, wait, read.

What it needs:

RequirementDetail
PermissionAuditLogsQuery.Read.All: delegated for a person, application for an app or a managed identity, with admin consent
Narrower permissionsAuditLogsQuery-Exchange.Read.All, -Endpoint, -Entra, -SharePoint, -OneDrive, -CRM
The audit logthe same one underneath: Exchange Online and auditing on
Cloudthe 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:

PowerShell - Give a managed identity AuditLogsQuery.Read.All
# 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:

PowerShell - Nine Defender record types in one Graph 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:

LimitValue
Queries per tenantat least 200 per rolling 24 hours
Queued or running at onceat least 50
Records per queryat least 1,000,000
ThrottledHTTP 429 with Retry-After; without it, back off exponentially
"At least 200 a day" is per tenant, not per script. Your scripts, your colleague's scripts, your tools and your connectors all share it. In Microsoft's words: "Tenants with more eligible licenses can receive higher limits, up to the maximum capacity allocated by the service. The calculation used to determine a tenant's allocation isn't published."
The record limit isn't an error. A query that hits it still ends 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-UnifiedAuditLogGraph audit log query API
Calls82 searches, one per record typeone query
Timeabout 7 minutes3 min 19 s: 45 s queued, 2 min running, 26 s to read 2,558 records
Defender records found49all 49, none missing
The recordthe whole AuditDatathe 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.

Endpoint security policies in the Defender portal: antivirus, firewall and attack surface reduction policies
These look like Defender settings. They're Intune endpoint security policies.

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:

One endpoint security policy change: the policy in the Intune audit log, its target group in the Entra ID audit log, nothing in the Unified Audit Log
The policy is in Intune, its target group in Entra ID.

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 changeMade inLogged in
Advanced featuresDefender portal, Settings → EndpointsUnified Audit Log, MSDEGeneralSettings (SetAdvancedFeatures, GA features only)
Tamper protection, as a policyIntune (Antivirus → Windows Security Experience)Intune audit log; the Intune policy wins over the portal toggle
Antivirus, firewall, ASR, EDR and exclusion policiesIntune admin center or Defender portalIntune audit log
MDE rolesDefender portalUnified Audit Log: AddRole, EditRole, DeleteRole

The Intune Audit Log

This is what Microsoft documents about the Intune audit log:

AspectWhat 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 whatthe 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."
WhereIntune admin center → Tenant administration → Audit logs
Graph APIGET /deviceManagement/auditEvents, v1.0 and beta
PermissionDeviceManagementApps.Read.All
Licencethe 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 inApplication in the Intune audit log
Intune admin centerMicrosoft Intune portal extension
Defender portalWindowsDefenderATP (fc780465-2017-40d4-a0c5-307022471b92)
An antivirus policy change in the Intune audit log: the actor, the Intune portal extension, the policy, and its properties with new values and empty old values
An antivirus policy change in the Intune audit log: the new values are there, the old ones are empty.

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".

The export can send rows twice. "The export pipeline might duplicate up to 100% of the data published in a 24-hour period", so deduplicate in your queries.
Intune diagnostic settings with a setting that sends AuditLogs to the Sentinel workspace
One diagnostic setting brings the Intune audit log into Sentinel. Check which workspace it points to.

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):

LogWhat's in itSentinel table
Audit logchanges in the directory: users, groups and their members, roles, apps and consent, devicesAuditLogs
Sign-in loginteractive sign-insSigninLogs
sign-ins without the user, by service principals and by managed identitiesAADNonInteractiveUserSignInLogs, 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):

AzureActivity - A data connector deletion
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.

The Who changed Sentinel query in advanced hunting in the Defender portal, with the data connector deletions in the result
Sentinel's own changes are in AzureActivity, not in the audit log.

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:

OptionDefender portal activity?The catch
Microsoft 365 connector (OfficeActivity)NoExchange, SharePoint and Teams only, and free
Defender XDR connector (incidents, alerts, Device*, Email* …)Notelemetry about devices, mail and identities, not the admin audit. With one exception: CloudAppEvents
CloudAppEventsYes, with Defender for Cloud Appsa chain of conditions, below
Management Activity API (Audit.General)Yes, as a feedcontent stays retrievable for 7 days; you build the ingestion
Community CCF connector ("Microsoft 365 Audit General and DLP")Partlyfixed 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:

#ConditionWhy it matters
1A 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
2At least one assigned Microsoft 365 licenceotherwise the connector fails with AF20012
3Auditing onthe audit log is the source
4The Microsoft 365 app connector connected with Microsoft 365 activitieswithout it, Defender changes don't arrive
5The connector healthy ("Connected")while it isn't connected, it doesn't collect
6No scoped-deployment exclusion"activities generated by excluded users, groups, or apps aren't ingested"
Defender isn't a listed source. Microsoft doesn't list Defender as a supported source for 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:

KQL - Does CloudAppEvents get Defender data?
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).

The CloudAppEvents check in advanced hunting, with MicrosoftDefenderForEndpoint and Microsoft365Defender and their event counts
Before you trust an empty CloudAppEvents, check that it gets Defender data at all.

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 APIsMicrosoft Graph
EndpointDefender XDR: POST /api/advancedhunting/run
Defender for Endpoint: POST /api/advancedqueries/run
on api.security.microsoft.com
POST /v1.0/security/runHuntingQuery
on graph.microsoft.com
PermissionAdvancedHunting.Read.All, AdvancedQuery.Read.AllThreatHunting.Read.All, delegated or application
Statusretirement 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.

The Action center History tab in the Defender portal with device actions in the list
Action center's History tab: the actions taken on devices, with no audit log needed.

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:

SourceWhat you get
MDE machine actionsthe 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 commentsauthor, time, text
Incidentsthe last modifier and the current status, classification and assignment only
Indicators, custom detection rulescreated 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:

APIApplication permissions
Microsoft Defender for Endpoint (WindowsDefenderATP)Machine.ReadWrite.All, Ti.ReadWrite.All (to see indicators created by others), Alert.Read.All
Microsoft GraphSecurityIncident.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:

FieldWhat it tells you
UserIdwho searched: a person, or an app's client id
SearchJobNamethe search's name
CompletionStatus, ResultsCounthow it ended and how many records came back
SearchFiltersJSON 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?
Audit search results filtered on the AuditSearch record type, with AuditSearchCreated and AuditSearchCompleted records of different accounts
Searches in the portal and through Graph are audited themselves; the cmdlet's aren't.

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 huntingIn LAQueryLogs?
AzureActivity, a Sentinel tableyes, as M365D_AdvancedHunting, with the user and the query text
CloudAppEvents, a Defender tableno
union of 45 tables | getschema, which the portal runs itself each time advanced hunting opensyes, 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:

KQL - Who queried the Sentinel workspace
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.

KQL - Who changed Sentinel
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):

KQL - What changed in an analytics rule
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):

KQL - Defender admin activity in CloudAppEvents
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:

KQL - Endpoint security policy changes from Intune
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 investigation tool's report summary: 49 Defender portal events, 3 accounts, 19 targets and 2 products, with filters and the activity over time
The summary: 49 events, by account, target and product, with filters for the whole report.
One event opened in the investigation tool's report: SetAdvancedFeatures with every field of the audit record, including SettingName and SettingsNewValue
One event opened: the whole audit record, with the setting and its new value.
Need the same visibility in your own tenants?
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:

Community:

About the Author

Kaido Järvemets - Microsoft MVP

Kaido Järvemets

Microsoft MVP | Microsoft Hybrid-Cloud Security Expert

With over 15 years of experience in IT, cybersecurity, and Microsoft technologies, Kaido specializes in Microsoft Azure, Microsoft 365, and hybrid-cloud security solutions. As a Microsoft MVP since 2010, he has deep expertise in Configuration Manager, Enterprise Mobility, and Azure Hybrid & Security.

Kaido is a Microsoft Certified Trainer who has been traveling across Europe for the past 12 years, speaking at events including the Microsoft Management Summit and Midwest Management Summit. He founded User Group Estonia and System Center User Group Estonia, building strong communities of Microsoft technology professionals.

🎯 Specializations

Microsoft Security:
  • Microsoft Defender XDR
  • Microsoft Sentinel SIEM & SOAR
  • Microsoft Entra ID (Azure AD)
  • Microsoft Intune
Azure & Hybrid Cloud:
  • Azure Arc Services
  • Azure Log Analytics
  • Azure Automation
  • Hybrid Cloud Management

"I simplify the process and make each change meaningful. It's all about adopting modern solutions that replace archaic ones and make the workplace easier for everyone involved."