How to detect configuration drift in Microsoft 365
Published
Three ways to find out that a setting changed: alerts on the audit logs, a scheduled export with a diff, and Microsoft's own configuration monitors. What each one catches, what it misses, and what it takes to keep running.
This is the practical companion to Configuration drift in Microsoft 365, which covers why tenants drift. Here the question is how to notice.
What detection needs
- A baseline. The configuration you agreed to, captured at a known date.
- A comparison. Today's configuration against the baseline, setting by setting, without timestamps and counters that change on their own.
- A schedule. The comparison runs whether or not anyone remembers.
- Somewhere for the result to go. An email, a ticket or an alert that a person reads.
Option 1: the audit logs
Microsoft 365 records administrative changes as events, in more than one place:
- The Microsoft Entra audit log, under Entra ID > Monitoring & health > Audit logs in the Microsoft Entra admin center. It is kept for 7 days with Microsoft Entra ID Free and 30 days with P1 or P2.
- The unified audit log, under Audit in the Microsoft Purview portal. Audit (Standard) keeps records for 180 days. Audit (Premium) keeps Exchange, SharePoint, OneDrive and Microsoft Entra records for one year for users with an E5 license or an eligible add-on, and up to 10 years with the 10-year retention add-on.
- The Intune audit log, under Tenant administration > Audit logs in the Intune admin center.
To be told about a change, rather than search for it, you have two routes. Alert policies in the Microsoft Defender portal, under Email & collaboration > Policies & rules > Alert policy, raise an alert when an activity matches and can email a list of recipients. A new policy can take up to 24 hours before it triggers, and with E1 or E3 a policy can only alert on every occurrence; thresholds and unusual-activity alerts need E5 or an add-on.
The second route is Log Analytics. Under Entra ID > Monitoring & health > Diagnostic settings, send the AuditLogs category to a Log Analytics workspace, then create an Azure Monitor log search alert rule on a query. This one finds every Conditional Access policy that was added, changed or deleted:
AuditLogs
| where OperationName in~ ("Add Conditional Access policy", "Update Conditional Access policy", "Delete Conditional Access policy")
| extend Actor = coalesce(tostring(InitiatedBy.user.userPrincipalName), tostring(InitiatedBy.app.displayName))
| extend Policy = tostring(TargetResources[0].displayName)
| project TimeGenerated, OperationName, Actor, Policy, Result, Changes = TargetResources[0].modifiedProperties
The names are as Microsoft's activity reference spells them; in~ ignores case. Run the rule every 15 minutes over the last 15 minutes and alert when it returns any rows, with an action group that emails you. For Conditional Access, the modifiedProperties hold the old and new policy as JSON, so the alert can show what changed.
What this catches, and what it misses:
- It is fast and names the person. Who changed what, and when.
- Retention is short unless you pay for longer. Thirty days in the Entra admin center, 180 days in Audit (Standard). Routing to Log Analytics keeps what you send there for the workspace's retention.
- An event is not always a before and after. Conditional Access records both values. Do not assume every service does: open a sample record from each service you care about before you build on it.
- It watches changes, not state. An alert that was missed, or an event older than the retention, leaves nothing that tells you today's tenant differs from the one you signed off.
- Each kind of change needs its own query or policy.
Option 2: export and diff on a schedule
This compares state instead of events. The script below exports Conditional Access policies with Get-MgIdentityConditionalAccessPolicy, removes the created and modified timestamps, sorts every property by name so two days line up, and compares today's folder with the most recent earlier one. It needs the Microsoft Graph PowerShell module Microsoft.Graph.Identity.SignIns and the permission Policy.Read.All, and it changes nothing in the tenant.
# Microsoft Graph PowerShell SDK (Microsoft.Graph.Identity.SignIns). Read-only: it reads policies and writes local files.
param(
[string] $Root = '.\ca-drift'
)
Connect-MgGraph -Scopes 'Policy.Read.All' -NoWelcome
# Properties that change without a setting changing. Add others you see in your own diffs.
$volatile = @('CreatedDateTime', 'ModifiedDateTime')
# The same object with its properties in name order and the volatile ones removed, so two days compare line by line.
function ConvertTo-Normalized($InputObject) {
if ($InputObject -is [System.Management.Automation.PSCustomObject]) {
$sorted = [ordered]@{}
foreach ($name in ($InputObject.PSObject.Properties.Name | Sort-Object)) {
if ($volatile -notcontains $name) { $sorted[$name] = ConvertTo-Normalized $InputObject.$name }
}
return [pscustomobject]$sorted
}
if ($InputObject -is [System.Collections.IEnumerable] -and $InputObject -isnot [string]) {
return ,@($InputObject | ForEach-Object { ConvertTo-Normalized $_ })
}
return $InputObject
}
# 1. Today's export: one file per policy, named by its id.
$today = Join-Path $Root (Get-Date -Format 'yyyy-MM-dd')
New-Item -ItemType Directory -Path $today -Force | Out-Null
foreach ($policy in Get-MgIdentityConditionalAccessPolicy -All) {
$plain = $policy | ConvertTo-Json -Depth 20 | ConvertFrom-Json
ConvertTo-Normalized $plain | ConvertTo-Json -Depth 20 |
Out-File -FilePath (Join-Path $today "$($policy.Id).json") -Encoding utf8
}
# 2. The most recent earlier export.
$previous = Get-ChildItem -Path $Root -Directory |
Where-Object Name -lt (Split-Path $today -Leaf) | Sort-Object Name | Select-Object -Last 1
if (-not $previous) { "First export written to $today. The next run has something to compare with."; return }
# 3. Added, removed and changed policies. '<=' lines are the earlier value, '=>' lines today's.
$old = @{}; Get-ChildItem -Path $previous.FullName -Filter '*.json' | ForEach-Object { $old[$_.Name] = $_.FullName }
$new = @{}; Get-ChildItem -Path $today -Filter '*.json' | ForEach-Object { $new[$_.Name] = $_.FullName }
$report = foreach ($file in (@($old.Keys) + @($new.Keys) | Sort-Object -Unique)) {
$path = if ($new.ContainsKey($file)) { $new[$file] } else { $old[$file] }
$name = (Get-Content -Path $path -Raw | ConvertFrom-Json).DisplayName
if (-not $old.ContainsKey($file)) { [pscustomobject]@{ Policy = $name; Change = 'Added'; Lines = '' }; continue }
if (-not $new.ContainsKey($file)) { [pscustomobject]@{ Policy = $name; Change = 'Removed'; Lines = '' }; continue }
$diff = Compare-Object (Get-Content $old[$file]) (Get-Content $new[$file]) -CaseSensitive
if ($diff) {
$lines = $diff | ForEach-Object { "$($_.SideIndicator) $($_.InputObject.Trim())" }
[pscustomobject]@{ Policy = $name; Change = 'Changed'; Lines = $lines -join "`n" }
}
}
# 4. Somewhere for the result to go: a file, and an exit code your scheduler or monitoring can act on.
if ($report) {
$report | Export-Csv -Path (Join-Path $today 'changes.csv') -NoTypeInformation -Encoding utf8
$report | Format-List
exit 1
}
"No changes since $($previous.Name)."
A changed policy shows the lines that differ, for example "State": "enabled" against "State": "enabledForReportingButNotEnforced". If you prefer Git, commit each day's folder to a repository and read git diff between two commits instead of step 3.
To run it unattended, create an app registration with the application permission Policy.Read.All, grant admin consent, add a certificate, and replace the sign-in line with Connect-MgGraph -ClientId $appId -TenantId $tenantId -CertificateThumbprint $thumbprint -NoWelcome. Run it daily from Task Scheduler, and have something watch for exit code 1 or changes.csv.
This shows old and new values and needs no extra license. The cost is upkeep: one script per kind of setting (Conditional Access above; Intune, Exchange and Teams each have their own modules and shapes), more volatile properties as you find them, and changes when Microsoft changes its APIs.
Option 3: Microsoft's own configuration tooling
Tenant Governance configuration monitors. In the Microsoft Entra admin center, Tenant Governance > Monitors compares the tenant with a baseline you upload or import from a snapshot, through the Tenant Configuration Management APIs in Microsoft Graph. Monitors can cover Microsoft Entra, Intune, Exchange, Defender, Purview and Teams resources. As Microsoft Learn documents them in November 2026:
- Each monitor runs every six hours, a fixed interval. A tenant can have up to 30 monitors and 800 monitored resources per day.
- A drift record names the resource and property, with the current value and the desired value from the baseline.
- It reports drift; you fix it in the admin center that owns the setting. Changing a monitor's baseline deletes that monitor's earlier results and drifts, and fixed drifts are deleted 30 days after they are resolved.
- Snapshots are kept for seven days, so keep your own copy of the baseline JSON.
- Licensing: monitoring and snapshots need Microsoft Entra P1 or P2 (P1 is included in Microsoft 365 E3 and Business Premium); Microsoft Entra ID Governance licenses add capacity. Microsoft Entra ID Free does not include them.
The Learn pages describe results in the admin center and through Microsoft Graph; they do not describe an email or alert when a drift appears. If you need one, read the drift list from Graph on a schedule.
Microsoft365DSC. An open-source project on GitHub, led by Microsoft engineers and maintained by the community. Export-M365DSCConfiguration takes a snapshot of a tenant's configuration as a PowerShell Desired State Configuration file, and New-M365DSCDeltaReport compares two configurations and lists the differences. Applied as a desired state, the DSC engine checks the tenant every 15 minutes by default and logs drift to the M365DSC log in Event Viewer, and it can be set to correct drift as well. It expects you to know DSC.
Secure Score is a signal, not drift detection
Microsoft Secure Score measures how many of Microsoft's recommended actions you have taken. A change that touches one of them can move the score, but a change to anything else, or a deliberate exception you accepted, does not. Microsoft also notes that Entra and Teams recommendation states refresh weekly and monthly. Watch it for trends, not for changes.
The options side by side
| Option | What it watches | Old and new value? | Alerting | Effort to keep running |
|---|---|---|---|---|
| Alert policies (Defender portal) | Activities in the unified audit log | Depends on the service | Email per alert | Low, one policy per activity |
| Entra audit log in Log Analytics | Entra changes you query for | Yes for Conditional Access | Azure Monitor alert rule | Moderate: a workspace and a query per kind of change |
| Scheduled export and diff | Whatever you export | Yes | What you build | High: scripts follow Microsoft's API changes |
| Tenant Governance monitors | Resources in the baseline, every six hours | Yes, current and desired | None documented; poll the drift list | Low within the quotas |
| Microsoft365DSC | Resources in your configuration | Yes, in the delta report | Event Viewer entries | High: DSC skills and upkeep |
| Secure Score | Microsoft's recommended actions | No | No | None |
Where GlacierPoint Snapshot fits
GlacierPoint Snapshot takes the export-and-diff approach without the scripts. It backs up 484 setting types across 9 admin centers, on demand or on a daily or weekly schedule from a computer you choose. You compare any two backups, or a backup with the tenant as it is now, setting by setting with the old value beside the new, and restore what you pick after a preview, with a rollback.
On the Professional and MSP plans, the portal can email the members who ask for it what each scheduled backup found compared with the one before: the number of settings added, changed and removed per workload, with a link to the comparison. The email never contains a setting value. Because it follows the backup schedule, it tells you within a day, not within minutes; for the few settings that need minutes, add an audit log alert. The user guide shows the schedule, the comparison and the notification settings.
Checked against
These Microsoft Learn pages, read on November 11, 2026, and the Microsoft365DSC documentation:
- Microsoft Entra data retention
- Microsoft Entra audit log activity reference (Conditional Access)
- Troubleshoot Conditional Access policy changes
- Azure Monitor Logs reference: AuditLogs
- Manage audit log retention policies (Microsoft Purview)
- Alert policies in the Microsoft Defender portal
- Audit changes and events in Microsoft Intune
- Use the Tenant Configuration Management APIs in Microsoft Graph; configurationDrift and driftedProperty resource types
- Create a configuration monitor; View monitor results and manage monitors; Licensing for Microsoft Entra Tenant Governance
- Microsoft Secure Score
- Microsoft365DSC: overview and Monitoring drifts