Microsoft 365 | Tenant Configuration Management

Microsoft 365 | Tenant Configuration Management

Monitor configuration drift in Microsoft 365 using PowerShell.

A colleague loosens the anti-phishing policy for a test, a service provider adds an accepted domain, someone disables an authentication method to close a ticket. None of these changes trigger an alert. They usually only come to light during the next audit or the next incident. Up to now, anyone wanting to check if the tenant still matches the target state has had to run Microsoft365DSC, maintain their own export scripts, or license a third-party tool.

Microsoft now provides its own interface for this: Tenant Configuration Management, previously known in beta as Unified Tenant Configuration Management (UTCM).

The APIs have been generally available since spring 2026 and, according to Microsoft, cover over 200 settings across six workloads: Defender, Entra, Exchange Online, Intune, Purview, and Teams. SharePoint and OneDrive are missing.

The structure follows the principle of APIs: You capture the current state as a snapshot, derive a baseline from it, run a monitor against it, and receive any deviation as drift.

How TCM works

Four components work together. A snapshot reads the current state of selected resource types and saves it as a file. A baseline declaratively describes the desired state, i.e., which resource should exist with which properties. A monitor regularly compares the tenant against the baseline. Any deviation is recorded as drift, including the current and desired values.

The principle is familiar from Desired State Configuration, except Microsoft handles the execution: the monitors run in the background in the Microsoft cloud, so you don’t need a server or runbooks for the comparison itself. The trade-off is fixed limits that you need to be aware of before designing your solution.

  • maximum of 30 monitors per tenant
  • each monitor runs fixed every six hours, at 0, 6, 12, and 18 GMT, the interval cannot be changed
  • maximum of 800 monitored resources per day and tenant, across all monitors
  • Snapshots: maximum of 20,000 resources per month, maximum of 12 visible snapshot jobs, retention 7 days
  • resolved drifts are deleted 30 days after resolution
  • a modified baseline deletes all previous results and drifts of the monitor
  • only the global cloud, not GCC High, DoD, or 21Vianet

The 800 resources per day limit your design the most. Since each monitor runs four times a day, you can only monitor 200 resources across all monitors at the same time. That’s enough for a tenant’s security-critical policies, but not for every mailbox.

Step by step

1: Create the TCM service principal

TCM operates within the tenant using its own Microsoft identity. You need to create this as a service principal once. Additionally, the service principal 'M365 Admin Services' with the app ID 6b91db1b-f05b-405a-a0b2-e3f60b28d645 must exist; if it is missing, you create it in the same way.

Connect-MgGraph -Scopes 'Application.ReadWrite.All', 'AppRoleAssignment.ReadWrite.All' -NoWelcome

New-MgServicePrincipal -AppId '03b07b79-c5bc-4b5e-9bfa-13acf4a99998'

if (-not (Get-MgServicePrincipal -Filter "AppId eq '6b91db1b-f05b-405a-a0b2-e3f60b28d645'")) {
    New-MgServicePrincipal -AppId '6b91db1b-f05b-405a-a0b2-e3f60b28d645'
}

After that, "Tenant Configuration Management" appears under Enterprise Applications.

Assign rights per workload

The service principal reads the configuration with its own permissions. Anything it is not allowed to read will not appear in the snapshot or the monitor. Since monitors currently only run in monitorOnly mode—meaning they do not write back—read permissions are sufficient. Therefore, do not assign a write role to the service principal, even if the documentation lists it for update scenarios.

For Entra resources, you assign Graph application permissions. Microsoft’s own example uses User.ReadWrite.All and Policy.Read.All. The first permission is excessive for read-only access, as Tony Redmond already criticized during the beta. For policies, authentication contexts, and authentication methods, read permissions are sufficient:

$Berechtigungen = 'Policy.Read.All', 'Policy.Read.ConditionalAccess', 'Policy.Read.AuthenticationMethod', 'Group.Read.All'
$Graph = Get-MgServicePrincipal -Filter "AppId eq '00000003-0000-0000-c000-000000000000'"
$TCM   = Get-MgServicePrincipal -Filter "AppId eq '03b07b79-c5bc-4b5e-9bfa-13acf4a99998'"

foreach ($Wert in $Berechtigungen) {
    $Rolle = $Graph.AppRoles | Where-Object { $_.Value -eq $Wert }
    New-MgServicePrincipalAppRoleAssignment -ServicePrincipalId $TCM.Id -BodyParameter @{
        AppRoleId   = $Rolle.Id
        ResourceId  = $Graph.Id
        PrincipalId = $TCM.Id
    }
}

For Exchange Online, the service principal requires the application permission Exchange.ManageAsApp and a reader role. For most Exchange resources, this is Global Reader; for anti-phishing and ATP policies, it is Security Reader.

$EXO = Get-MgServicePrincipal -Filter "AppId eq '00000002-0000-0ff1-ce00-000000000000'"
New-MgServicePrincipalAppRoleAssignment -ServicePrincipalId $TCM.Id -PrincipalId $TCM.Id -ResourceId $EXO.Id -AppRoleId 'dc50a0fb-09a3-484d-be87-e023b12c6440'

foreach ($Name in 'Global Reader', 'Security Reader') {
    $RoleId = (Get-MgRoleManagementDirectoryRoleDefinition -Filter "DisplayName eq '$Name'").Id
    New-MgRoleManagementDirectoryRoleAssignment -PrincipalId $TCM.Id -RoleDefinitionId $RoleId -DirectoryScopeId '/'
}

For Teams, Intune, and Purview, Microsoft lists the required roles in the respective resource overviews. Only include the workloads that you are actually monitoring.

3: Connect as admin with TCM

To call the APIs, you need the delegated permission ConfigurationMonitoring.ReadWrite.All and a privileged Entra role. For automation, a dedicated app receives the application permission of the same name, while ConfigurationMonitoring.Read.All suffices for read-only queries.

Connect-MgGraph -Scopes 'ConfigurationMonitoring.ReadWrite.All' -NoWelcome
$Basis = 'https://graph.microsoft.com/v1.0/admin/configurationManagement'

The Graph PowerShell SDK has included its own TCM cmdlets since version 2.36.1. However, the following examples still use Invoke-MgGraphRequest so that you can directly recognize the endpoints from the documentation and avoid dependency on a specific SDK version.

4: Secure the current state as a snapshot

A snapshot is the starting point because it provides you with the exact property names and values you’ll need later for the baseline. You specify the resource types you’re interested in:

$Body = @{
    displayName = 'Snapshot Exchange Sicherheit'
    description = 'Istzustand vor Einführung des Drift-Monitorings'
    resources   = @(
        'microsoft.exchange.accepteddomain'
        'microsoft.exchange.antiphishpolicy'
        'microsoft.exchange.authenticationpolicy'
        'microsoft.exchange.transportrule'
    )
}
$Job = Invoke-MgGraphRequest -Method POST -Uri "$Basis/configurationSnapshots/createSnapshot" -Body $Body

The job runs asynchronously. You poll the status until it reports succeeded. The properties resourceLocation and errorDetails are only returned by the API upon explicit request via $select, and the status partiallySuccessful only with the header Prefer: include-unknown-enum-members.

do {
    Start-Sleep -Seconds 30
    $Status = Invoke-MgGraphRequest -Method GET -Uri "$Basis/configurationSnapshotJobs/$($Job.id)?`$select=status,resourceLocation,errorDetails" -Headers @{ Prefer = 'include-unknown-enum-members' }
} while ($Status.status -in 'notStarted', 'running')

Invoke-MgGraphRequest -Method GET -Uri $Status.resourceLocation -OutputFilePath ".\snapshot-$(Get-Date -Format yyyyMMdd).json"

Microsoft only describes resourceLocation as the URL where the snapshot file is located. Community modules like UTCM.Tools use Invoke-MgGraphRequest with the Graph token to retrieve it, but the official documentation does not specify the download method. Therefore, test it manually before automating it.

Store the file in an archive outside the tenant. Microsoft deletes snapshots after seven days, and these files are your evidence to an auditor of the state at any given time. If the job ends with failed or partiallySuccessful, first check the service principal's permissions for the affected resource types; the details are in errorDetails.

Create a monitor with a baseline

The baseline defines the target state for each resource. Use the property names from your snapshot instead of guessing. Microsoft’s reference example for an accepted domain looks like this, and this resource type is a good starting point because an undetected added domain is a classic way for spoofing from within your own tenant:

$Monitor = @{
    displayName = 'Exchange Domains und Richtlinien'
    description = 'Sollzustand akzeptierte Domains, Stand Freigabe CAB'
    baseline    = @{
        displayName = 'Baseline Exchange'
        description = 'Freigegebene Domains'
        resources   = @(
            @{
                displayName  = 'Primaere Domain'
                resourceType = 'microsoft.exchange.accepteddomain'
                properties   = @{
                    Identity   = 'contoso.de'
                    DomainType = 'Authoritative'
                    Ensure     = 'Present'
                }
            }
        )
    }
}
Invoke-MgGraphRequest -Method POST -Uri "$Basis/configurationMonitors" -Body ($Monitor | ConvertTo-Json -Depth 10) -ContentType 'application/json'

Add further resources such as the anti-phishing default policy following the same pattern, copying the identity and relevant properties from the snapshot. Only include properties whose modification poses a security risk—do not add every property. Each extra property creates drift from harmless changes, and a monitor that reports meaningless deviations daily will quickly be ignored.

Carefully plan the baseline before creating it. Any subsequent change to the baseline will delete the entire monitoring history. For a clean audit trail, it is therefore better to create a new monitor for major changes and deactivate the old one.

6: Query and forward drifts

The monitor runs after the next six-hour window. You retrieve active drifts with filtering. The API only returns the list of differing properties via $select.

$Filter = "status eq 'active'"
$Select = 'resourceType,baselineResourceDisplayName,driftedProperties,firstReportedDateTime,monitorId'
$Drifts = (Invoke-MgGraphRequest -Method GET -Uri "$Basis/configurationDrifts?`$filter=$Filter&`$select=$Select").value

foreach ($Drift in $Drifts) {
    foreach ($Prop in $Drift.driftedProperties) {
        [pscustomobject]@{
            Ressource   = $Drift.baselineResourceDisplayName
            Typ         = $Drift.resourceType
            Eigenschaft = $Prop.propertyName
            Ist         = $Prop.currentValue
            Soll        = $Prop.desiredValue
            Seit        = $Drift.firstReportedDateTime
        }
    }
}

A deleted resource appears as drift on the Ensure property with an actual value of Absent and a desired value of Present. The results of individual monitoring runs, including failed ones, can be found under configurationMonitoringResults. If you only query drifts, you won’t notice when a monitor stops running due to missing permissions.

For operation, you package the query in a runbook with Managed Identity that starts shortly after each monitoring run and generates an email or ticket in case of new drifts.

What TCM cannot do

Drift tells you what has changed, but not who—Tony Redmond already pointed this out during the beta. To identify the culprit, you still need the audit log, for Exchange via Search-UnifiedAuditLog in the time window before the first occurrence. TCM does not correct any deviations; the only mode is monitorOnly. To adopt an intentional change, you adjust the baseline, with the described loss of history. Additionally, the fixed six-hour interval means that a briefly opened and then closed gap may go unnoticed.

Microsoft does not provide licensing details in its technical documentation. Verify this with your licensing partner before deploying in production, especially if you plan to build processes around a feature that may later require an add-on.

Conclusion

Tenant Configuration Management fills a gap that Microsoft has left to the community for years. Microsoft365DSC has proven that declarative configuration management for Microsoft 365 works, but it required its own server, extensive module maintenance, and patience with every version update. TCM shifts the comparison to the Microsoft cloud and delivers the results via a documented v1.0 API. For mid-sized tenants without their own DSC expertise, this is the simpler path to reliable drift monitoring.

The limits are tight, though. 200 simultaneously monitored resources, a fixed interval of six hours, and a baseline that deletes its own history when changed force you to make a selection. And you should make that selection anyway: Monitor the configurations an attacker would exploit—Conditional Access, authentication methods, accepted domains, anti-phishing, and authentication policies. Anyone trying to map the entire tenant will hit the quotas and generate noise.

For ISO 27001 audits or under NIS2, TCM provides reliable evidence for configuration management. Two things you must handle yourself: archive the snapshot files before the seven-day expiry and link every drift to the monitoring log so that a technical alert becomes a documented change or a documented incident. The open licensing issue must be resolved before rollout. And the service principal only gets read permissions—because a configuration monitor with write access to Conditional Access is itself a prime target.

Share:
No comments yet

Be the first to start the discussion with a helpful comment.

Leave a comment

Comments are reviewed briefly before they are published — factual, respectful and to the point is just right here.

Your email address will not be published.