Skip to main content
emnode
Compliance

Apply guest configuration baselines

One capability across every Windows and Linux machine in the estate: install the machine configuration agent, assign the Azure compute security baseline, and remediate the operating-system settings that drift from it, so 'the inside of the box is configured securely' is something you can prove rather than hope.

15 min·10 sections·AZURE

Last reviewed

Guest configuration baselines: the basics

What does an 'insecurely configured' Azure machine actually look like?

Most Azure security controls live on the control plane: a firewall rule, an encryption flag, a network setting you can see in the portal. Guest configuration is different. It reaches inside the operating system of a running machine and checks the settings that no control-plane property can see: the password policy, the audit log configuration, whether SMBv1 is still enabled, which TLS versions the OS will negotiate, whether anonymous SAM enumeration is blocked. Defender for Cloud measures these against the Azure compute security baseline, the Windows and Linux hardening guides that ship inside the Microsoft Cloud Security Benchmark, and reports every rule a machine fails.

This shows up as a cluster of related recommendations rather than one finding. 'Guest Configuration extension should be installed on machines' is the prerequisite: without the agent and a managed identity, Defender cannot see inside the box at all. 'Machines should be configured securely' and the baseline initiatives ('Windows machines should meet requirements for the Azure compute security baseline', and the Linux equivalent) report the rules a machine fails. 'Machines should be restarted to apply security configuration updates' catches settings that are staged but need a reboot to take effect. On scale sets the same job is 'Virtual machine scale sets should be configured securely', and on Azure Local clusters the application-control variant checks that App Control for Business, formerly Windows Defender Application Control, is enforced consistently across every node.

They read as separate problems on the report, but they are one capability: make the inside of every machine match a known-good baseline, and keep it there. The agent has to be present, the identity has to exist, the baseline has to be assigned, the failing rules have to be remediated, and the machines that need a reboot have to get one. Miss any step and the operating system is configured by whatever the image shipped with and whatever has drifted since, which is exactly the layer attackers probe once they have a foothold.

In this lesson you will learn how Azure measures the inside of a machine against a security baseline, how the machine configuration agent and its managed identity make that possible, and how to deploy the capability across an estate so that operating-system hardening is enforced and provable rather than assumed. The Controls this lesson covers section lists every Defender for Cloud recommendation in this capability, each linking to a deep page with the exact check and a copy-and-paste fix.

Fun fact

The protocol that should have been switched off in 2017

When the WannaCry and NotPetya worms tore through hundreds of thousands of machines in 2017, the shared root cause was an old, insecure file-sharing protocol, SMBv1, that had been left enabled on machines that never needed it. Microsoft had already deprecated it. The hosts that fell were not exotic; they were ordinary servers running whatever their image shipped with, hardened by nobody. The Azure compute security baseline that guest configuration enforces flags exactly that class of setting, legacy protocols, weak ciphers, permissive password and audit policies, because the misconfiguration inside the operating system, not a clever zero-day, is what most intrusions actually ride.

Finding which machines fail the baseline, and why

Priya is the platform security lead at a SaaS company moving from a lift-and-shift estate towards a hardened, audited one. Defender for Cloud shows 'Machines should be configured securely' failing across most of the fleet, and 'Guest Configuration extension should be installed on machines' failing on a chunk of older VMs that pre-date the team's current image pipeline.

Rather than open each machine, Priya starts by separating the machines Defender cannot even see inside (no agent, no managed identity) from the machines it can see but that are failing baseline rules, because those are two different fixes and the first one blocks the second.

Start by finding the machines that have no system-assigned managed identity. Without it, the machine configuration agent cannot authenticate, so Defender is blind to the operating system entirely.

$ az vm list --query "[?identity.type==null || identity.type=='UserAssigned'].{name:name, rg:resourceGroup, identity:identity.type}" -o table
Name Rg Identity
--------------- ------------ -----------
legacy-app-01 prod-apps None
legacy-app-02 prod-apps None
batch-runner-1 batch UserAssigned
# No managed identity means no agent auth, so the baseline is unmeasurable. Fix the identity first.

A machine with no system-assigned identity is invisible to guest configuration. Establish the identity and agent before chasing baseline rules, because until then there is nothing to measure.

How Defender for Cloud decides a machine is not configured securelydeep dive

The machinery has three parts. First, the machine configuration agent (the extension named AzurePolicyforWindows or AzurePolicyforLinux, published by Microsoft.GuestConfiguration, formerly called the Azure Policy guest configuration extension). It runs inside the operating system and evaluates configuration rules locally. Second, a system-assigned managed identity on the machine: the agent uses it to authenticate to the machine configuration service and pull its assigned baseline, which is why a machine with no system-assigned identity is reported as unmeasurable rather than compliant. Third, the Azure compute security baseline itself, a versioned set of operating-system rules (password policy, audit policy, legacy-protocol and cipher settings, and so on) shipped inside the Microsoft Cloud Security Benchmark and delivered through the 'Windows machines should meet requirements for the Azure compute security baseline' and Linux baseline policy initiatives.

Defender for Cloud evaluates the machine against that baseline on a periodic cycle and reports each failed rule, surfaced through 'Machines should be configured securely'. Because these are in-guest checks, the operating-system baseline assessment for Azure VMs is gated on Defender for Servers Plan 2 being enabled. A separate recommendation, 'Machines should be restarted to apply security configuration updates', exists because some settings are written but only take effect after a reboot: the rule is staged, the machine is functionally not yet compliant, and a restart is the remediation. Worth knowing: the older 'Machines should be configured securely' data path that relied on the Log Analytics agent (MMA) was retired in November 2024, so the current capability is built on the machine configuration agent, not the legacy monitoring agent.

The strongest position pairs the assessment with deployment policy. The built-in initiative 'Deploy prerequisites to enable Guest Configuration policies on virtual machines' adds the system-assigned managed identity and installs the agent automatically on eligible machines, with a DeployIfNotExists effect, so new machines are brought into measurement without anyone remembering to add the extension. Assigning that, plus the baseline initiatives, is the difference between knowing today's machines are hardened and guaranteeing tomorrow's are measured from the moment they exist.

What is the impact of leaving the operating-system layer unhardened?

The direct impact is a softer inside. A machine running default configuration tends to carry the settings attackers rely on after the first foothold: legacy protocols such as SMBv1 still enabled, weak or permissive password and lockout policies, broad audit gaps that hide the intrusion, cipher suites and TLS versions that should have been disabled years ago. None of these is visible from the control plane, so a perimeter that looks immaculate can sit in front of machines that are trivial to move through once reached. This is the layer that the well-known self-propagating worms rode, and the layer that most lateral movement still exploits.

The second-order impact is blast radius and dwell time. An unhardened operating system both makes the initial escalation easier and weakens the audit and logging configuration that would let you detect it, so the same drift that lets an attacker in also helps them stay. Applying the baseline shrinks both: fewer ways in, and better visibility when someone tries. On Azure Local, the application-control variant matters specifically because a single node out of policy in an otherwise enforced cluster is the soft spot that undermines the whole posture.

On the compliance side, every serious framework, ISO 27001, SOC 2, the CIS Benchmarks, PCI DSS, HIPAA, expects documented secure-configuration baselines for systems and evidence they are enforced. 'We follow a hardening standard' is an assertion; a passing Azure compute security baseline across the fleet, with the agent deployed by policy, is the artefact that turns the assertion into evidence an auditor will accept.

How do you apply the baseline across the estate safely?

Work the capability as one loop, in order, rather than chasing individual baseline rules. The sequence matters because each step depends on the one before it: you cannot measure a machine you cannot see inside, and you should not remediate at scale until you can see the whole fleet.

1. Establish identity and agent everywhere first

Make sure every machine has a system-assigned managed identity and the machine configuration agent. Until both exist, the machine is unmeasurable, not compliant. Do this with the built-in 'Deploy prerequisites to enable Guest Configuration policies on virtual machines' initiative so it self-heals for new machines, rather than installing the extension by hand.

2. Assign the Azure compute security baseline

Assign the 'Windows machines should meet requirements for the Azure compute security baseline' and the Linux equivalent initiatives so Defender evaluates every machine against the operating-system rules. Confirm Defender for Servers Plan 2 is enabled on the relevant subscriptions, since the operating-system baseline assessment for Azure VMs depends on it.

3. Remediate failing rules, highest impact first

Read the failing rules per machine and fix the dangerous ones first: legacy protocols such as SMBv1, weak TLS and ciphers, blank or weak password policies, missing audit policy. Prioritise machines that hold or can reach sensitive data over isolated test boxes. Most fixes are configuration changes; a few stage a setting that needs a reboot.

4. Restart staged machines and keep it enforced

Clear the 'machines should be restarted to apply security configuration updates' findings with a scheduled maintenance window rather than ad hoc reboots. Keep the deploy-prerequisites and baseline initiatives assigned at the management-group level so every new machine is measured from creation, and on Azure Local confirm App Control for Business is enforced consistently across every node.

# Step 1: give a machine the system-assigned identity the agent needs to authenticate.
az vm identity assign --resource-group prod-apps --name legacy-app-01

# Install the machine configuration agent (instance name MUST be AzurePolicyforWindows / AzurePolicyforLinux).
az vm extension set \
  --resource-group prod-apps --vm-name legacy-app-01 \
  --publisher Microsoft.GuestConfiguration \
  --name ConfigurationforLinux \
  --extension-instance-name AzurePolicyforLinux \
  --enable-auto-upgrade true

# Step 2: assign the deploy-prerequisites initiative so identity + agent self-heal across the scope.
# Look the initiative up by its EXACT display name rather than pasting a GUID.
scope="/subscriptions/00000000-0000-0000-0000-000000000000"
setid=$(az policy set-definition list \
  --query "[?displayName=='Deploy prerequisites to enable Guest Configuration policies on virtual machines'].name" -o tsv)
az policy assignment create \
  --name deploy-gc-prereqs \
  --policy-set-definition "$setid" \
  --scope "$scope" \
  --location uksouth \
  --mi-system-assigned

# Assign the Windows compute security baseline initiative (look it up by display name too).
baseid=$(az policy set-definition list \
  --query "[?displayName=='Windows machines should meet requirements for the Azure compute security baseline'].name" -o tsv)
az policy assignment create \
  --name assign-win-baseline \
  --policy-set-definition "$baseid" \
  --scope "$scope"

Quick quiz

Question 1 of 5

Defender for Cloud shows 'Guest Configuration extension should be installed on machines' failing on a set of older VMs, alongside 'Machines should be configured securely' on others. Why fix the extension finding first?

You can now treat operating-system hardening as one capability rather than a wall of separate baseline findings: establish the identity and agent everywhere first, assign the Azure compute security baseline, remediate the failing rules highest-impact first, restart the machines that need it on a schedule, and keep the whole thing enforced by policy so new machines are measured from creation. The Controls this lesson covers section below links every recommendation in this group to its deep page and fix.

Back to the library

Controls this lesson covers

One capability, many Microsoft Defender for Cloud recommendations. This lesson is the shared playbook; each control below keeps its own deep page with the exact check, severity and a copy-and-paste fix.