Review Windows VM automatic updates

Do not disable automatic updates without a replacement patching process; verify actual results.

Description

Choose OS-managed updates or a separate patching process for Windows VMs and scale sets. If automatic updates are off, the remaining process must still meet your security-update deadlines.

Potential impact

Failed updates can leave known vulnerabilities unpatched. Unplanned restarts can interrupt workloads.

Remediation

For OS-managed updates, set automatic_updates_enabled = true with a compatible patch mode. Older AzureRM versions use enable_automatic_updates. Schedule maintenance and reboots, then check actual patch installation results and failures.

Examples

The excerpts cover a Windows VM. Supply the OS image and disk. Use Manual for manual patching or AutomaticByOS for OS-managed updates. Changing the automatic-updates flag replaces the VM, so review the plan before applying it to an existing machine.

Before

hcl
resource "azurerm_windows_virtual_machine" "example" {
  name                = "example-vm"
  resource_group_name = azurerm_resource_group.example.name
  location            = azurerm_resource_group.example.location
  size                = "Standard_F2"
  admin_username      = var.admin_username
  admin_password      = var.admin_password
  network_interface_ids = [azurerm_network_interface.example.id]

  automatic_updates_enabled = false
}

After

hcl
resource "azurerm_windows_virtual_machine" "example" {
  name                = "example-vm"
  resource_group_name = azurerm_resource_group.example.name
  location            = azurerm_resource_group.example.location
  size                = "Standard_F2"
  admin_username      = var.admin_username
  admin_password      = var.admin_password
  network_interface_ids = [azurerm_network_interface.example.id]

  automatic_updates_enabled = true
}

References