Skip to main content
KBY Technologies Logo

Detect Microsoft 365 Configuration Drift with Tenant Configuration Management: Snapshot, Baseline and Monitor

Snapshot approved Microsoft 365 settings, monitor them against that baseline every six hours, and read each drift through Microsoft Graph.

Financial chart displayed on monitor showcasing stock market trends and analysis.

Underlined words are defined in the KBY Lexicon. Tap or click one to see what it means.

To catch configuration drift without running your own tooling, add the Tenant (TCM) service principal to your tenant, take a snapshot of the settings you care about, and create a monitor that uses that snapshot as its baseline. The monitor compares the live tenant with the baseline and records every difference as a drift you can read through Microsoft Graph.

The constraint that shapes the design: a monitor in monitorOnly mode reports drift and changes nothing, and it runs on a fixed six-hour cycle that you cannot alter.

#The problem: tenant settings change and nobody sees it

A Microsoft 365 tenant is configured through many admin centres and PowerShell modules, by many people. Microsoft’s own description of the problem is that administrators lack visibility into whether the tenant deviates from the desired configuration, and that detecting and resolving drift by hand is slow and error-prone.

A transport rule edited during an incident, a conditional access policy switched to report-only and never switched back, a shared mailbox alias changed during a migration: each one is a small change that stays invisible until something breaks or an auditor asks.

Drift detection answers a narrow, useful question: does the tenant still match the configuration we agreed? It does not tell you whether the agreed configuration is right. That review stays with your change process, which is why the baseline should come from a snapshot of a state you have already approved rather than from a template written from memory.

This article uses the v1.0 endpoints under /admin/configurationManagement. Monitoring and snapshots cover the Defender, Entra, , Intune, Purview and Teams workloads, plus Copilot and Agent resources that are still in preview. Remediation, applyOnce and configuration templates are preview features on the beta endpoint and are left out here on purpose. TCM is available only in the global service, not in national clouds.

#How it works: snapshot, baseline, monitor and drift

Four objects carry the whole workflow, and keeping them apart makes the failures easier to read later.

  • A snapshot job extracts the current settings of the resource types you name. It is asynchronous: you create it, poll its status and, once it succeeds, download the file from resourceLocation.
  • A baseline is the list of resources and properties you want to hold steady. It is attached to a monitor, and it must contain at least one resource with at least one property.
  • A monitor checks the tenant against its baseline. Each run produces a monitoring result that says whether the run succeeded and how many drifts it found.
  • A drift is one deviation. It names the resource, the property, the currentValue and the desiredValue from your baseline, and its status is active or fixed.

The monitoring result carries only a count. To see what drifted you call the drift API, which is why the checks later in this article read both.

Loading diagram...

The open-source Microsoft365DSC project publishes guidance on moving to TCM for snapshot and drift monitoring. The main practical differences are that the work runs on Microsoft’s side instead of in a local PowerShell session, and that configuration is described in JSON rather than as a compiled DSC file. If your estate has DSC configurations, the project’s own guide covers converting simple ones.

#How to set it up: service principal, snapshot and monitor

Do this in a non-production or lab tenant first. Nothing below changes a tenant setting, but the first steps add an enterprise application and grant it permissions, and you should see what the workloads accept before you do that in production.

Closeup of switch in server with connectors and adapters connected to plastic device in dark room on blurred background inside
Photo by Brett Sayles on Pexels

#
Add the service principal

Monitors run as the Tenant Configuration Management service principal, application ID 03b07b79-c5bc-4b5e-9bfa-13acf4a99998. Check whether it already exists, and create it only if it does not. The documentation also asks that the M365 Admin Services service principal, 6b91db1b-f05b-405a-a0b2-e3f60b28d645, is provisioned in the tenant.

1Connect-MgGraph -Scopes 'Application.ReadWrite.All','AppRoleAssignment.ReadWrite.All'
2Get-MgServicePrincipal -Filter "AppId eq '03b07b79-c5bc-4b5e-9bfa-13acf4a99998'"
3# Only if the lookup returns nothing:
4New-MgServicePrincipal -AppId '03b07b79-c5bc-4b5e-9bfa-13acf4a99998'

Then grant the service principal the application permissions the workloads need. The documented example assigns app roles with New-MgServicePrincipalAppRoleAssignment; Exchange monitoring uses the Exchange.ManageAsApp application permission. Which permissions you need depends on the resource types in your baseline, so work them out per resource before granting anything.

#
Take the snapshot

Name only the resource types you intend to monitor. The documented example snapshots Exchange shared mailboxes and transport rules; the project’s guide uses Entra conditional access policies and named locations the same way. Your calling identity needs ConfigurationMonitoring.ReadWrite.All, delegated or application.

1POST https://graph.microsoft.com/v1.0/admin/configurationManagement/configurationSnapshots/createSnapshot
2Content-Type: application/json
3
4{
5  "displayName": "Exchange baseline 2026-12-02",
6  "description": "Approved Exchange Online settings",
7  "resources": [
8    "microsoft.exchange.sharedmailbox",
9    "microsoft.exchange.transportrule"
10  ]
11}

The response is a job with status notStarted and an empty resourceLocation. Poll GET /admin/configurationManagement/configurationSnapshotJobs/{id} until the status is succeeded, then request the URL in resourceLocation and save the JSON. Snapshots are kept for at most seven days and the service is not file storage, so commit the file to source control the same day, with the approval reference.

#
Create the monitor

Build the monitor body from the saved snapshot. The baseline needs a display name and a resources array whose entries carry a displayName, a resourceType and the properties to hold. Trim each resource to the properties you actually care about: every extra property is one more thing that can drift, and each resource counts against the daily quota.

1POST https://graph.microsoft.com/v1.0/admin/configurationManagement/configurationMonitors
2Content-Type: application/json
3
4{
5  "displayName": "Exchange drift monitor",
6  "description": "Compares live Exchange Online settings with the approved snapshot",
7  "baseline": {
8    "displayName": "Exchange baseline 2026-12-02",
9    "resources": [
10      {
11        "displayName": "Accepted domain",
12        "resourceType": "microsoft.exchange.accepteddomain",
13        "properties": {
14          "Identity": "contoso.onmicrosoft.com",
15          "DomainType": "InternalRelay",
16          "Ensure": "Present"
17        }
18      }
19    ]
20  }
21}

A successful call returns 201 Created and the monitor in monitorOnly mode with status active. Monitors are picked up at 06:00, 12:00, 18:00 and 00:00 GMT, so a new monitor first runs within six hours.

#How to verify the monitor is running and the drift is real

Do not wait for the first scheduled run to find a mistake. Work through these checks after the first cycle, and again after any baseline change.

  1. List the monitoring results for your monitor and confirm runStatus is successful. A result of partiallySuccessful or failed means the run did not complete cleanly, and its errorDetails, which need $select, say why.
  2. Read driftsCount. A count of zero on a first run against a baseline that was snapshotted minutes earlier is the expected outcome.
  3. List the drifts with a filter on the monitor, selecting driftedProperties so you can see each property’s current and desired value.
  4. Prove the pipeline end to end once, in a lab tenant: change one monitored property by hand, wait for the next cycle, and confirm that a drift appears with the old value as desiredValue. Then put the setting back and confirm the drift’s status changes to fixed.

Following along? Tap a step’s number to tick it off.

1GET https://graph.microsoft.com/v1.0/admin/configurationManagement/configurationMonitoringResults?$filter=monitorId eq '{monitorId}'&$orderby=runCompletionDateTime desc&$top=5
2GET https://graph.microsoft.com/v1.0/admin/configurationManagement/configurationDrifts?$filter=monitorId eq '{monitorId}'&$select=id,resourceType,status,firstReportedDateTime,resourceInstanceIdentifier,driftedProperties

A drift that stays active after you corrected the setting usually means the corrected value does not match the baseline exactly, for example a different letter case or a different order in a list. Compare the currentValue with the desiredValue character by character before assuming the service is wrong. Where the monitored resource is an Exchange mail-flow control, see blocking automatic external email forwarding in Exchange Online for an example of a setting worth baselining.

A man celebrates success at a multi-monitor workstation while analyzing stock charts.
Photo by AlphaTradeZone on Pexels

#What goes wrong: quotas, empty baselines and silent gaps

The documented limits are the most common reason a monitor behaves unexpectedly, so plan the baseline around them.

  • Daily resource quota. You can monitor up to 800 resources per day per tenant across all monitors. A monitor with 50 resources runs four cycles a day and uses 200 of them. A broad baseline of every conditional access policy and every transport rule can exhaust the quota before a second monitor is created.
  • Monitor count. A tenant can have up to 30 monitors, each fixed at a six-hour interval. A change made and reverted between two runs is never seen.
  • Baseline edits erase history. Updating a monitor’s baseline deletes every monitoring result and drift it had produced. Export the drift list before you edit, because the evidence is gone afterwards.
  • Snapshot limits. Snapshots extract at most 20,000 resources per tenant per month, only 12 snapshot jobs are visible at once, and each file is purged after seven days. Delete finished jobs you no longer need, once the file is stored.
  • Fixed drifts disappear. A drift marked fixed is deleted 30 days later, so keep your own record if you need longer.
  • Partial runs. A run that is only partiallySuccessful can hide a gap, because the resources it could not read are not compared. Treat it as a failure to investigate, not as a clean result.

Drift detection also has a blind spot you should say out loud in your change process. It watches the properties in the baseline and nothing else. A new transport rule that is not in the baseline is not a drift. If you need to notice additions, snapshot the resource type again on a schedule and compare the file against the stored one.

#Permissions: least privilege for the monitor and its caller

Two separate identities are involved, and they should never share a credential. The first is the caller that manages monitors and reads drifts. For reading, ConfigurationMonitoring.Read.All is enough; creating or updating monitors, deleting them and taking snapshots needs ConfigurationMonitoring.ReadWrite.All. Give the dashboard or ticketing integration that only reads drifts the read permission and keep the write permission with the small group that owns the baseline.

The second identity is the Tenant Configuration Management service principal, which is what actually reads your workloads when a monitor runs. Whatever you grant it applies to every monitor in the tenant. The documentation’s PowerShell example assigns User.ReadWrite.All and Policy.Read.All; it is an example of the mechanism and not a recommended set. Start from the resources in your baseline, grant only what those resources need, and prefer a read permission wherever the workload offers one.

Snapshot files can hold sensitive configuration, such as user principal names in conditional access exclusions. Store them in a repository with the same access rules as your other infrastructure code, and do not paste them into tickets. Remediation and applyOnce use delegated grants and are previews; leave them off until you have read the documentation’s separate permission model for them.

#Rollback: removing the monitor and its access

Everything in the monitor-only setup is reversible without touching a tenant setting, because TCM only reads. Undo it in the reverse order you built it.

  1. Export the current drift list and the last monitoring results to your repository, as above. They are removed along with the monitor.
  2. Delete the monitor. This is permanent and a deleted monitor cannot be restored, so confirm the baseline file is in source control and you can recreate it from that file.
  3. Delete finished snapshot jobs, once their files are stored.
  4. If you no longer need TCM at all, revoke the service principal’s access. Deactivating the enterprise application stops token issuance while preserving its configuration, and deleting it moves it to the recycle bin, where it can be restored for 30 days.
1DELETE https://graph.microsoft.com/v1.0/admin/configurationManagement/configurationMonitors/{monitorId}
2DELETE https://graph.microsoft.com/v1.0/admin/configurationManagement/configurationSnapshotJobs/{snapshotJobId}

Each call returns 204 No Content. To restore monitoring, create the monitor again from the stored baseline and wait for the next fixed run.

#Readiness checks before you rely on the drift feed

Before anyone treats an empty drift list as good news, confirm the feed can actually fail loudly. Check that the latest monitoring result for every monitor completed within the last six to twelve hours, that its status is successful, and that the number of resources in the baseline is what you meant to monitor. Send an alert on a result that is missing, late or not successful; an absent result is the failure the drift API will never report.

Agree who owns each drift. For every active drift, someone either puts the setting back or approves the change, takes a new snapshot and rebuilds the baseline, following the same review as any other change. Group settings are another candidate for a baseline; see setting a Microsoft 365 group naming policy with Graph PowerShell.

The next safe decision is to start with one workload and a few resources, run it for a fortnight, and widen the baseline only once the quota and the alert path look healthy.

About this page

Credited to

Dates

Published

Sources

This page lists no external sources.

Corrections

No corrections are listed for this page. Some review sweeps corrected pages without naming each one; those are in the corrections log.

Found this useful? Follow KBY for more like it.

Reader Interaction

Comments

Add a thoughtful note on Detect Microsoft 365 Configuration Drift with Tenant Configuration Management: Snapshot, Baseline and Monitor. Comments are checked for spam and held for moderation before appearing.

Loading comments...

Engineering insights, direct to you.

Receive the latest Systems Engineering tutorials, production guides, Engineering Labs and operational best practices.