Microsoft Defender for Cloud · Virtual Machines
Machines should be restarted to apply security configuration updates
Written and reviewed by Emnode · Last reviewed
What does the recommendation "Machines should be restarted to apply security configuration updates" check?
Flags Linux virtual machines that have applied security configuration or package updates but are still running because a reboot has not happened, so the pending changes are not yet in effect. Defender for Cloud reads this 'reboot required' state through the Azure Monitor Agent, which is why the assessment only covers Linux VMs that have that agent installed. It does not evaluate Windows machines, Arc-connected servers, or any Linux VM without the Azure Monitor Agent, and it is a posture signal with no backing Azure Policy: there is nothing to assign and nothing to deny, only a machine to restart.
Why does "Machines should be restarted to apply security configuration updates" matter?
A kernel patch, an updated openssl, or a hardened sysctl baseline only protects you once the process actually loads the new code or setting. Until the box reboots, the vulnerable libraries stay mapped in memory and the old configuration keeps serving traffic, so your patch reporting says 'fixed' while the running system is still exploitable. That gap is exactly where attackers live after a CVE goes public, and on long-lived servers it can persist for months because nobody wants to take the outage. The business consequence is a false sense of compliance: an audit shows updates installed, yet the live workload remains exposed to the very flaw the update was meant to close.
How do I fix "Machines should be restarted to apply security configuration updates"?
- Confirm the pending reboot, then restart the affected Linux VM during a maintenance window: 'az vm restart --resource-group <rg> --name <vm>', adding '--no-wait' if you are scripting a fleet and tracking completion separately.
- Stop the problem recurring by letting Azure Update Manager handle reboots: set the VM's reboot behaviour to 'IfRequired' (rather than 'Never') so a patch that needs a restart actually gets one inside the scheduled maintenance window, instead of leaving the machine in a pending state.
- For estates you cannot reboot on demand, schedule a recurring maintenance configuration in Azure Update Manager with a reboot window so security updates and the restart that activates them land together on a predictable cadence, and reserve enough window time for the reboot to finish.
Remediation script · bash
# 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" Full walkthrough (console steps, edge cases and verification) in the lesson Apply guest configuration baselines.
Is "Machines should be restarted to apply security configuration updates" a false positive?
A machine that is intentionally held open before a coordinated cut-over (for example a database node draining connections ahead of a planned failover, or a release frozen pending a change ticket) will flag while it waits, even though the delay is deliberate and controlled. That is a correct exception: track it against the change record and reboot at the agreed time rather than forcing an unplanned restart just to clear the recommendation.
More Virtual Machines controls
- Adaptive application controls for defining safe applications should be enabled on your machines
- Allow list rules in your adaptive application control policy should be updated
- Authentication to Linux machines should require SSH keys
- Azure Backup should be enabled for virtual machines
- EDR configuration issues should be resolved on virtual machines
- EDR solution should be installed on Virtual Machines
- File integrity monitoring should be enabled on machines
- Guest Attestation extension should be installed on supported Linux virtual machines
- Guest Attestation extension should be installed on supported Windows virtual machines
- Linux virtual machines should enable Azure Disk Encryption or EncryptionAtHost
- Linux virtual machines should enforce kernel module signature validation
- Linux virtual machines should use only signed and trusted boot components