A hardened build is only hardened on the day it is built: without continuous enforcement, emergency fixes, local admin changes, software installs and failed policy delivery move every host away from its baseline. Configuration drift is the gap between the state you approved and the state that is actually running, and it is where audit findings, failed controls and easy attacker paths come from. This guide explains how to choose a baseline, how the main enforcement engines (Group Policy, Microsoft Intune, PowerShell DSC and Azure Machine Configuration, Ansible) detect and correct drift, how to roll enforcement out without outages, and how to measure whether it is working. It is written for endpoint and server engineers, platform teams and security architects who own configuration across mixed Windows and Linux estates.
Key takeaways
- Start from a published baseline. Microsoft recommends adopting an industry-standard, well-tested configuration such as its security baselines rather than writing your own; CIS Benchmarks and DISA STIGs fill the same role across platforms.
- Know each engine's enforcement mode. Group Policy refreshes every 90 minutes but its extensions reapply settings only when they detect a change; PowerShell DSC defaults to
ApplyAndMonitor, which reports drift without fixing it; Ansible fixes only when it runs. - Audit before you enforce. Use Ansible
--check --diff, DSC Test, Machine Configuration Audit mode or Intune reporting to see the gap before switching to auto-correction. - One owner per setting. Overlapping GPOs, Intune profiles and baselines create conflicts that look like drift; Intune itself does not decide which conflicting default wins.
- Protect the enforcement plane. Whoever can edit a GPO, an Intune baseline or an Ansible inventory can change every host; those identities are some of the most privileged in the estate.
What configuration drift is and where it comes from
Drift has a handful of repeat causes, and each needs a different response.
| Source of drift | Example | Best counter |
|---|---|---|
| Manual change by an administrator | Firewall rule added during an incident and never removed | Auto-correction plus change records; remove standing local admin rights |
| Software installation | Installer enables a service or adds a firewall exception | Baseline covers services and firewall; application allow listing |
| Failed policy delivery | Device off the corporate network, broken MDM enrolment, GPO filtered out by WMI or security filtering | Report on last successful check-in and policy status, not only on assignment |
| Conflicting policy | GPO and Intune both set Defender settings with different values | Single source of authority per setting; conflict reports |
| Baseline ageing | New OS release adds settings the old baseline does not cover | Version baselines; review at each OS feature update |
| Image drift | Golden image built months ago, patched differently from running hosts | Rebuild images on a schedule; immutable infrastructure where practical |
| Malicious change | Attacker disables logging or modifies the firewall | Detection on configuration change, not only periodic scans |
The last row matters: ATT&CK lists T1685 Disable or Modify Tools, T1686 Disable or Modify System Firewall and T1112 Modify Registry as defence impairment techniques, and drift detection is often the first place they show.
Choosing the baseline
- Microsoft security baselines: Published in the Security Compliance Toolkit as GPO backups and as MDM baselines in Intune, for Windows 11, Windows 10 and Windows Server 2016 to 2022. They assume a well-managed organisation where standard users are not administrators, and they enforce a setting only if it mitigates a current threat without causing worse operational problems. See the Microsoft Security Baselines and Security Compliance Toolkit Guide.
- CIS Benchmarks: Cover Windows, Linux distributions, Unix, cloud and applications, with Level 1 and Level 2 profiles. See the CIS Benchmarks Guide.
- DISA STIGs: Required for many government and defence suppliers; stricter and more prescriptive. Intune offers an audit-only STIG baseline in GCC High. See the DISA STIG Guide.
- Vendor built-ins: Some platforms ship their own assessment profiles, such as the Solaris
compliancetool or OpenSCAP content for RHEL. See the OpenSCAP and Linux Compliance Scanning Guide.
Decision guidance: pick one primary baseline per platform, document deviations as a tailoring (not as edits scattered through policies), and map it to the controls auditors ask about. A small organisation running Windows and Microsoft 365 can usually adopt the Microsoft baselines through Intune with few changes. A regulated or mixed estate typically needs CIS or STIG for evidence, with the Microsoft baseline used as the starting point for Windows settings.
Enforcement engines compared
| Engine | Platforms | Model | Drift behaviour | Best fit |
|---|---|---|---|---|
| Group Policy | Domain-joined Windows | Pull, background refresh every 90 minutes plus up to 30 minutes random offset; DCs every 5 minutes | Client-side extensions reapply during refresh only when they detect a change, so a locally changed value can persist until the policy changes or a forced refresh | On-premises AD estates; servers |
| Microsoft Intune (MDM baselines, settings catalog) | Windows 10/11, plus macOS, iOS, Android profiles | Cloud pull at device check-in | Re-delivers assigned settings at check-in; reports per-setting status and conflicts | Cloud-managed and remote endpoints |
| PowerShell DSC (PSDSC with LCM) | Windows (and Linux historically) | Push or pull; LCM checks every ConfigurationModeFrequencyMins (default 15) | ApplyOnly never rechecks; ApplyAndMonitor (default) logs drift; ApplyAndAutoCorrect logs and reapplies | Servers needing exact state with self-healing |
| Microsoft DSC 3.0 | Windows, Linux, macOS | dsc command, JSON or YAML documents; no local configuration manager or service | Get, Test and Set operations; scheduling comes from the orchestrator | Cross-platform declarative resources driven by another tool |
| Azure Machine Configuration | Azure VMs and Azure Arc-enabled servers, Windows and many Linux distributions | Azure Policy guest assignments | Audit, Apply and Monitor, or Apply and Autocorrect per assignment | Hybrid fleets already governed with Azure Policy |
| Ansible (and AWX or Automation Controller) | Linux, Unix, Windows, network devices | Agentless push over SSH or WinRM | Idempotent tasks correct drift on each run; nothing happens between runs | Linux and mixed estates; network devices |
| Configuration Manager compliance settings | Windows | Agent with configuration baselines | Evaluate on schedule, optional remediation | Existing ConfigMgr estates |
Agent-based tools in the same family (Puppet, Chef, Salt) follow the Ansible and DSC pattern: a desired state, a periodic run, and a report of what changed. The choice is usually decided by what the estate already uses. The rule that matters is that each setting has exactly one engine responsible for it.
Engine-specific notes
- Group Policy: Processing order is Local, Site, Domain, OU (LSDOU), with the last applied setting winning; Enforced links override lower GPOs and Block Inheritance does not stop Enforced links. Force a reapply of unchanged settings with
gpupdate /forceorInvoke-GPUpdatewhen investigating. Consider enabling the per-extension option to process policy even if the GPOs have not changed for security-relevant extensions, so local changes are overwritten on the next refresh. See the Group Policy Security Guide. - Intune baselines: When a new baseline version is released, profiles on older versions become read-only; you change a profile's version in place. Different baselines can set the same setting with different defaults and Intune does not pick the best one, so conflicts must be investigated. Microsoft warns that default firewall settings in baselines may stop local and connection security rules from merging with MDM rules. See the Microsoft Intune Guide.
- PSDSC: Set
ConfigurationMode = 'ApplyAndAutoCorrect'only after a period inApplyAndMonitor; decide whetherRebootNodeIfNeededis acceptable for each server class. - Ansible:
ansible-playbook site.yml --check --diff --limit hostpreviews changes; modules without check mode support do nothing and report nothing in check mode, and tasks depending on registered variables may not simulate correctly. Usediff: falseon tasks that template secrets. Schedule runs (for example through AWX) so correction is continuous, not only at deployment. See the Ansible and AWX Security Guide.
Immutable and rebuilt infrastructure
The strongest answer to drift is to stop patching running hosts in place. Cloud instances, containers and VDI pools can be rebuilt from a versioned image or template on every change, so the running state is always the tested state and a drifted host is simply replaced. This works well for stateless tiers and poorly for databases, domain controllers and long-lived application servers, which still need an enforcement engine. Many estates combine both: rebuild where the workload allows it, enforce continuously everywhere else, and use the same baseline definition for image builds and runtime checks so the two never diverge.
Implementing enforcement: a phased rollout
- Inventory and scope: List every platform, management channel (GPO, Intune, ConfigMgr, Ansible, Arc) and which devices each reaches. Devices with no channel are your first finding. See the CIS Control 1 Inventory and Control of Enterprise Assets Guide.
- Select and tailor: Choose the baseline per platform, record each deviation with a reason, owner and review date, and store the tailoring in version control.
- Assign ownership of settings: Decide, area by area (firewall, Defender, BitLocker, user rights, audit policy), which engine is authoritative. Remove duplicate settings from the others. Co-managed Windows devices are the usual conflict zone.
- Measure the gap: Run in audit only: Policy Analyzer comparisons of GPOs against the baseline, Intune baseline reports, DSC Test, Machine Configuration Audit, Ansible check mode, OpenSCAP scans.
- Pilot rings: Apply enforcement to IT devices, then a representative pilot ring (around 5 to 10 percent including each major application owner), then broad deployment. Hold each ring for at least one full patch cycle.
- Switch to auto-correct: Move from monitor to correction once exceptions are agreed: DSC
ApplyAndAutoCorrect, Machine Configuration Apply and Autocorrect, scheduled Ansible runs, Intune assignment. - Roll back cleanly: For GPOs keep backups and unlink rather than delete; for Intune keep the previous profile and reassign; for code-driven tools revert the commit and rerun. Know which settings tattoo (persist after policy removal), because unassigning a policy does not always restore the old value.
- Operate: Review baseline versions at every OS feature update, re-certify exceptions quarterly, and feed drift into vulnerability and risk reporting.
Exceptions and conflicts
- Exceptions as code: Express each approved exception as a scoped group, filter or variable, never as a manual change on the host. Otherwise the enforcement engine will "fix" it, or it will be invisible.
- Expiry: Give every exception an end date and owner; expired exceptions should revert automatically.
- Conflict reporting: Treat Intune conflict states, GPO Resultant Set of Policy surprises and Ansible tasks that report "changed" on every run as defects. A task that changes every run usually means two engines are fighting.
- Small versus large organisations: Small teams should use one engine per platform and accept a near-default baseline. Large estates need a configuration owner per area, a change board for baseline versions, and a pipeline that tests baselines against reference builds before release.
Where identity fits
Enforcement engines are privileged identities with fleet-wide reach. An account that can edit a GPO linked to the domain, modify an Intune security baseline, or push an Ansible playbook as root can disable controls everywhere at once, which is why ATT&CK tracks T1484.001 Group Policy Modification. Limit GPO edit rights and Intune roles with scope tags to small groups using privileged access workstations, store Ansible and DSC credentials in a vault rather than in inventories, and alert on changes to baseline objects. See the Privileged Access Workstations Guide.
Detection and measurement
- Change events: Monitor directory service changes to GPOs (Windows event 5136 on domain controllers when Directory Service Changes auditing is enabled), Intune audit logs for baseline and profile edits, and commits to configuration repositories.
- Host-side signals: DSC drift entries in its operational logs, Machine Configuration non-compliant guest assignments, Ansible "changed" counts per host, and local security policy changes.
- Coverage: Devices that have not checked in or applied policy within the expected window are drift by definition.
| Metric | What it shows | Target |
|---|---|---|
| Baseline conformance per platform | Percentage of settings compliant across in-scope devices | 95% or above, trending up |
| Management coverage | Devices reporting to at least one enforcement engine | 100% of inventory |
| Mean time to correct drift | Time from detected drift to compliant state | Within one enforcement cycle |
| Open exceptions past expiry | Governance health | Zero |
| Settings with conflicts | Overlapping engines | Zero on security settings |
| Baseline version lag | Months since the current vendor baseline was adopted | One release cycle or less |
Framework mapping
| Framework | Reference | Relevance |
|---|---|---|
| NIST SP 800-53 Rev. 5 | CM-2 Baseline Configuration; CM-2(2) Automation Support for Accuracy and Currency; CM-3 Configuration Change Control; CM-6 Configuration Settings | Defines, automates and controls the baseline |
| NIST CSF 2.0 | PR.PS-01 Configuration management practices are established and applied; DE.CM-09 monitoring of computing hardware and software | Outcome statements for enforcement and drift detection |
| CIS Controls v8.1 | Control 4 Secure Configuration of Enterprise Assets and Software | Secure configuration process and its maintenance |
| ISO/IEC 27001:2022 | Annex A 8.9 Configuration management | Requires configurations to be established, documented, implemented, monitored and reviewed |
| MITRE ATT&CK v20 | T1484.001, T1685, T1686, T1112 | Attacker changes that drift detection should catch |
See the CIS Control 4 Secure Configuration of Enterprise Assets and Software Guide.
Common failure patterns
- Monitor mode forever: DSC left at the default
ApplyAndMonitor, Machine Configuration at Audit, or Ansible run only at build time, so drift is reported in dashboards nobody owns. - Two engines, one setting: Group Policy and Intune both manage the firewall or Defender, leaving results that depend on timing. Hosts flip between states and every report shows "changed".
- Assignment counted as compliance: Reports show the policy is assigned to all devices, while offline or broken-enrolment devices never received it.
- Stale baseline: A baseline adopted for an older OS release and never versioned, missing new protections and still enforcing obsolete ones.
- Unprotected enforcement plane: Broad GPO edit rights or a shared Ansible SSH key, so a single compromised admin can push malicious configuration fleet-wide. The same lesson applies to SaaS configuration; see the SaaS Security Guide.
- Exceptions applied by hand: Local changes that the next enforcement run reverts, causing outages and pressure to switch enforcement off.
Practitioner checklist
- Map every device to an enforcement engine and close the coverage gaps first.
- Adopt one published baseline per platform and keep the tailoring in version control.
- Assign a single authoritative engine to each security setting area and remove duplicates.
- Run audit or check mode across the estate and fix the largest gaps before enforcing.
- Roll out through pilot rings, then switch to auto-correction (ApplyAndAutoCorrect, Autocorrect, scheduled Ansible).
- Give exceptions owners and expiry dates, implemented as scoped policy, not manual changes.
- Restrict and monitor who can change GPOs, Intune baselines and playbooks.
- Report conformance, coverage, time to correct and exception expiry monthly.
- Review baseline versions at every OS feature update.
Standards and references
- Microsoft Learn: Security baselines
- Microsoft Learn: Use security baselines to configure Windows devices in Intune
- Microsoft Learn: Group Policy processing
- Microsoft Learn: Configuring the Local Configuration Manager
- Microsoft Learn: Microsoft Desired State Configuration overview
- Microsoft Learn: Azure Machine Configuration overview
- Ansible: Validating tasks with check mode and diff mode
- NIST: SP 800-53 Rev. 5
Related NHI Mgmt Group resources: Microsoft Security Baselines and Security Compliance Toolkit Guide · Group Policy Security Guide · Ansible and AWX Security Guide · CIS Benchmarks Guide · SaaS Security Guide