Skip to main content
emnode
Compliance

Enable file integrity monitoring

One capability for your servers: detect, and keep a tamper-evident record of, every change to the operating system files, binaries and registry keys an attacker has to touch to gain persistence, so a quiet change to a critical file stops being invisible.

14 min·10 sections·AZURE

Last reviewed

Remediates Microsoft Defender for Cloud: azure-file-integrity-monitoring-machines

File integrity monitoring: the basics

What does 'File integrity monitoring should be enabled on machines' actually check?

File integrity monitoring, or FIM, watches the files and registry keys that should almost never change on a healthy server: operating system binaries, system libraries, boot files, scheduled-task definitions and the Windows registry run keys an attacker has to modify to gain persistence. When one of those changes, FIM records what changed, when, and on which machine, and surfaces it for review. Defender for Cloud expresses the gap as a single recommendation, 'File integrity monitoring should be enabled on machines', and it fails for every virtual machine, scale set or Azure Arc-connected server in scope that does not have FIM collecting change events.

This is a Microsoft Defender for Servers Plan 2 capability, not a free posture check. The recommendation only clears once the machine is covered by Defender for Servers Plan 2, the Defender for Endpoint agent on it is reporting change data, and the subscription has FIM enabled against a Log Analytics workspace where the change events are stored. Because the data collection moved to the Defender for Endpoint agent, the older Log Analytics agent and Change Tracking extension path is retired: support for the Microsoft Monitoring Agent ended in November 2024, so a machine still relying on it is not a passing configuration, it is a migration you have not finished.

The point of the control is not to stop changes, changes are normal, it is to make unauthorised changes visible. A server where FIM is off can have its sshd binary swapped, a new admin run key added or a system library replaced, and nothing in the platform will tell you. A server where FIM is on turns each of those into a recorded, queryable event. The work in this lesson is to get FIM collecting on every server in scope, point it at a workspace you actually review, and tune the default rules so the signal is useful rather than noise.

In this lesson you will learn what file integrity monitoring detects, how Defender for Cloud decides a machine is covered, and how to enable FIM across a subscription without drowning in noise from legitimate change. The Controls this lesson covers section lists the Defender for Cloud recommendation in this capability, linking to a deep page with the exact check and a copy-and-paste path to remediation.

Fun fact

The change nobody saw for months

The reason file integrity monitoring is written into PCI DSS, as a required change-detection mechanism on critical files, is that supply-chain and persistence attacks almost always leave their fingerprints in exactly the files FIM watches: a modified system binary, a new service, an altered startup script. In several of the most damaging intrusions on record, the malicious change sat on production servers for months because no control was comparing those files against a known-good baseline. FIM does not prevent the change. It makes sure that when investigators finally look, there is a dated record of precisely what changed and when, instead of a shrug.

Finding which servers have no file integrity monitoring

Priya is the security lead at a payments company moving from a single flat subscription to a governed landing zone ahead of a PCI DSS assessment. Defender for Cloud flags 'File integrity monitoring should be enabled on machines' across most of the server fleet, because FIM was never switched on after Defender for Servers was enabled.

Before turning anything on, Priya checks which subscriptions even have Defender for Servers Plan 2, since FIM is a Plan 2 capability and the recommendation cannot clear on a machine that is only covered by Plan 1 or by no plan at all.

Start by checking the Defender for Servers plan on the subscription. FIM needs Plan 2 ('P2'); Plan 1 will not satisfy the recommendation.

$ az security pricing show -n VirtualMachines --query "{tier:pricingTier, subPlan:subPlan}" -o table
Tier SubPlan
-------- --------
Standard P1
# Plan is on, but it is Plan 1. FIM is a Plan 2 capability, so the
# recommendation cannot clear until this subscription moves to P2.

FIM is gated behind Defender for Servers Plan 2. A subscription on Plan 1, or with no plan, can never pass this recommendation no matter how the machines are configured. Confirm the plan first.

How Defender for Cloud decides a machine has file integrity monitoringdeep dive

The recommendation resolves to a chain of conditions, and all of them have to hold. First, the machine must be covered by Microsoft Defender for Servers Plan 2, because FIM is a Plan 2 feature; a machine on Plan 1, or on no plan, fails regardless of anything else. Second, the Defender for Endpoint agent on the machine must be present and recent enough to report change data: on down-level Windows that means MDE agent version 10.8799 or later, and on Linux it means version 30.124082 or later. Third, FIM must be enabled at the subscription level and pointed at a Log Analytics workspace, which is where the change events are stored and queried.

The data collection model changed, and this matters when you read an old runbook. FIM used to rely on the Log Analytics agent or the Azure Monitor Agent plus a Change Tracking extension. That path is retired: the Microsoft Monitoring Agent reached end of support in November 2024, and FIM now collects through the Defender for Endpoint agent that Defender for Servers already deploys. A machine that looks like it has FIM but is still on the legacy agent is not a healthy state, it is an unfinished migration, and it will eventually stop reporting.

Once enabled, FIM applies a set of default rules covering the files and registry keys most worth watching: core operating system binaries and libraries, boot and startup files, and on Windows the registry run keys used for persistence. You can add custom rules for application-specific paths, within the platform's validation limits: a path may contain at most three asterisks, wildcards are only allowed at the start or end of a path segment, and Windows registry rules must begin with HKLM. Defender for Cloud assesses the recommendation on a periodic cycle, so enabling FIM clears the finding on the next assessment rather than instantly. One known behavioural nuance: on Linux, FIM does not distinguish a file being created from a file being modified, it logs both as a modify event, which is worth knowing before you build alerting on top of the data.

What is the impact of leaving file integrity monitoring off?

The direct impact is a blind spot at exactly the layer attackers operate. Persistence, privilege escalation and defence evasion almost all involve touching files or registry keys that should be stable: replacing a system binary, dropping a malicious library, adding a startup entry, altering a scheduled task. Without FIM, those changes leave no platform-level record, so an intrusion can live on a server for as long as it stays quiet. With FIM, each of those becomes a dated, attributable event you can find later, which is often the difference between scoping an incident in hours and reconstructing it from guesswork.

The second-order impact is incident response. When something does go wrong, the first questions are what changed, when, and on which hosts. A server with FIM enabled can answer those questions from its change log. A server without it cannot, which lengthens dwell time, widens the apparent blast radius because you cannot rule machines out, and makes a confident all-clear almost impossible to give.

On the compliance side, file integrity monitoring is not optional decoration. PCI DSS explicitly requires a change-detection mechanism on critical system, configuration and content files, configured to compare them at least weekly, and frameworks such as ISO 27001 and SOC 2 expect equivalent integrity controls. A clean 'File integrity monitoring should be enabled on machines' across the in-scope fleet is the artefact that demonstrates the requirement is met, rather than asserted.

How do you enable file integrity monitoring safely?

Work the capability in order. FIM cannot run without the right plan and a workspace to store its data, so get those in place first, then enable the capability, then tune it so the change log stays useful rather than becoming noise nobody reads.

1. Confirm Defender for Servers Plan 2 on the in-scope subscriptions

FIM is a Plan 2 capability, so the first move is to make sure the subscriptions holding the servers you care about are on Plan 2, not Plan 1 or no plan. Prioritise the subscriptions in regulatory scope, where the change-detection requirement is non-negotiable, before broadening to the rest of the estate.

2. Enable FIM and point it at a workspace you review

Turn on file integrity monitoring in the Defender for Servers plan settings and select the Log Analytics workspace where change events will be stored. Choose a workspace the security team actually queries, because FIM only delivers value if someone reads the change log. Make sure the Defender for Endpoint agent on each machine meets the minimum version, since older agents will not report change data.

3. Accept the default rules, then tune for noise

Start with the default rules covering OS binaries, boot files and Windows registry run keys, which is the high-value set, then add custom rules for application paths that matter to you. Identify the legitimate change sources, a configuration-management tool or a patch window, so expected churn is understood rather than treated as suspicious. Remember that on Linux a create and a modify both log as a modify event when you build any alerting.

4. Ratchet it shut with Azure Policy

Assign the built-in policy for this recommendation so new and existing machines are continuously assessed for FIM coverage, and your governance reports the gap instead of relying on someone to check. Look the policy up by its exact display name at assignment time rather than pasting a definition ID, so you are always binding to the current built-in.

# 1. Ensure the subscription is on Defender for Servers Plan 2 (subplan P2).
#    FIM is a Plan 2 capability; Plan 1 cannot satisfy the recommendation.
az security pricing create \
  --name VirtualMachines \
  --tier standard \
  --subplan P2

# 2. Enable file integrity monitoring and select the workspace that stores
#    change events. This is configured in the Defender for Servers plan
#    settings (Azure portal or the Microsoft.Security/pricings REST API);
#    there is no dedicated 'az' flag to toggle FIM itself. Point it at a
#    Log Analytics workspace the security team actually reviews, and confirm
#    the Defender for Endpoint agent meets the minimum version on each host
#    (Windows down-level 10.8799+, Linux 30.124082+).

# 3. Ratchet it shut: assign the built-in policy by EXACT display name so the
#    fleet is continuously assessed for FIM coverage. Look the id up at
#    runtime rather than hardcoding a definition GUID.
pid=$(az policy definition list \
  --query "[?displayName=='File integrity monitoring should be enabled on machines'].name" \
  -o tsv)

az policy assignment create \
  --name require-fim-on-machines \
  --display-name "Require file integrity monitoring on machines" \
  --policy "$pid" \
  --scope "/subscriptions/00000000-0000-0000-0000-000000000000"

Quick quiz

Question 1 of 5

Defender for Cloud shows 'File integrity monitoring should be enabled on machines' across most of a subscription's servers. What is the first thing to confirm?

You can now treat file integrity monitoring as one capability rather than a scatter of findings: confirm the in-scope subscriptions are on Defender for Servers Plan 2, enable FIM against a Log Analytics workspace the security team reviews, accept the default rules and tune out the known change sources, and ratchet it shut with an audit policy. The Controls this lesson covers section below links the recommendation in this group to its deep page and the path to remediation.

Back to the library