Skip to content
SysAndDB
Go back

Automated Patching for SQL Server on Azure VMs: Setup, Always On Guardrails & Azure Update Manager Migration

Unscheduled Windows and SQL Server restarts are one of the fastest ways to trigger unexpected failovers or corrupt an overnight ETL batch on cloud-hosted databases. For teams running SQL Server on Azure Virtual Machines (IaaS), Automated Patching establishes a strict maintenance window so OS and database updates—and any required reboots—only occur during an approved timeframe[cite: 13].

However, before enabling legacy Automated Patching on any production Azure SQL VM, DBAs need to account for two critical operational constraints: Microsoft is retiring the Automated Patching feature on September 17, 2027, and the legacy feature only installs updates marked as Important or Critical (skipping standard Cumulative Updates)[cite: 13].

Below is a complete technical breakdown of how Automated Patching works under the hood, how to configure it via the Azure Portal and PowerShell (Update-AzSqlVM), how to prevent simultaneous Always On Availability Group reboots, and when to use Azure Update Manager instead[cite: 13, 14, 15, 17, 18].


1. Critical Limitations & Prerequisites to Know First

Before touching VM settings, verify how Automated Patching fits into your patching lifecycle:

  • Scheduled Retirement (September 17, 2027): Microsoft has scheduled Automated Patching for retirement on September 17, 2027. Avoid deploying it in brand-new environments, and plan your migration to Azure Update Manager well ahead of that deadline[cite: 13].
  • Important & Critical Updates Only (No Automatic CUs): Legacy Automated Patching only downloads and installs Windows and SQL Server patches categorized as Important or Critical. Standard SQL Server Cumulative Updates (CUs) and Service Packs not flagged as Important/Critical must be applied manually—or automated using Azure Update Manager, which natively supports SQL Server CUs[cite: 13, 18].
  • Single Orchestrator Rule: Never run Automated Patching alongside Azure Update Manager or Automatic VM Guest Patching on the same VM. Overlapping patching engines frequently collide, lock the Windows Update agent, and cause failed patch runs or unscheduled reboots outside your maintenance window[cite: 14, 18].
  • SQL Server IaaS Agent Extension: Automated Patching depends on the SQL Server IaaS Agent Extension (pre-installed on current Azure Marketplace SQL Server gallery images) and supports SQL Server 2012 on Windows Server 2012 and newer[cite: 13].
  • Extended Security Updates (ESUs): If you rely on Extended Security Updates without using Automated Patching, configure updates directly through the built-in Windows Update channel[cite: 14].

2. Automated Patching Configuration Parameters

Whether you configure the feature through the Azure Portal or Azure PowerShell, four core parameters govern the maintenance window[cite: 14]:

SettingAllowed ValuesOperational Behavior
Automated PatchingEnable / Disable (Default: Disabled)Toggles the SQL IaaS Agent Automated Patching schedule on or off[cite: 14].
Maintenance ScheduleEveryday, or specific day (Monday–Sunday)Defines the recurrence cadence for downloading and installing updates[cite: 14].
Maintenance Start Hour0 – 24 (VM Local Time)Local hour when the VM begins downloading and applying patches[cite: 14, 15].
Maintenance Window Duration30 – 180 minutesMaximum time permitted to finish downloading, installing, and rebooting (e.g., 60 or 120 minutes)[cite: 14, 17].
Patch CategoryImportant (includes Critical)Restricts automated installation strictly to Important and Critical severity updates[cite: 13, 14].

3. Configuring Automated Patching in the Azure Portal

Option A: During New SQL VM Provisioning

When deploying a new SQL Server VM through the Azure Resource Manager model:

  1. Navigate to the SQL Server settings tab in the Create a virtual machine wizard[cite: 15].
  2. Under Automated patching, select Change configuration[cite: 15].
  3. Toggle Automated patching to Enable, select your Maintenance schedule (e.g., Sunday), set Maintenance start hour (local time) (e.g., 02:00), and adjust the Maintenance window duration slider (e.g., 60 minutes)[cite: 15].

Option B: On an Existing SQL Server VM

  1. Open your SQL virtual machines resource (not the base Compute VM blade) and select Updates under Settings[cite: 15, 16].
  2. If you have never activated Azure Update Manager on that VM, toggle Automated patching to Enable, configure your schedule and duration, and click Apply / OK[cite: 15, 16].
  3. (Note: If your VM was previously switched to the new Azure Update Manager interface, click Leave new experience at the top of the Updates blade to return to the legacy Automated Patching controls[cite: 16].)

Agent Provisioning Delay: When enabling Automated Patching for the first time on an existing VM, Azure installs and configures the SQL Server IaaS Agent extension in the background. Allow several minutes before refreshing the portal to verify the active configuration[cite: 16, 17].


4. Automating Configuration with Azure PowerShell

For multi-VM estates, configuring maintenance windows via the Portal does not scale. Use the Update-AzSqlVM cmdlet from the Az.SqlVirtualMachine module to enforce standardized maintenance windows across your resource groups[cite: 13, 17].

Enable Automated Patching on an Existing SQL VM

# Ensure the latest Az PowerShell modules are installed
# Install-Module -Name Az.SqlVirtualMachine -Scope CurrentUser

$ResourceGroup = "rg-prod-sqldb-01"
$VmName        = "sqlprod-vm-01"

Update-AzSqlVM `
    -ResourceGroupName $ResourceGroup `
    -Name $VmName `
    -AutoPatchingSettingEnable `
    -AutoPatchingSettingDayOfWeek Thursday `
    -AutoPatchingSettingMaintenanceWindowStartingHour 11 `
    -AutoPatchingSettingMaintenanceWindowDuration 120

In this example, Azure begins installing Important/Critical updates every Thursday at 11:00 AM (VM local time) and enforces a hard 120-minute ceiling (completing by 1:00 PM)[cite: 17].

Disable Automated Patching (Before Migrating to Azure Update Manager)

Before onboarding a SQL VM onto Azure Update Manager, explicitly disable legacy Automated Patching so the two orchestrators do not conflict[cite: 14, 17, 18]:

Update-AzSqlVM `
    -ResourceGroupName "rg-prod-sqldb-01" `
    -Name "sqlprod-vm-01" `
    -AutoPatchingSettingEnable:$false

5. Production Guardrails: Always On AGs & Common Errors

Legacy Automated Patching operates strictly at the individual VM level—it has zero awareness of Always On Availability Groups (AG) or Windows Server Failover Clusters (WSFC)[cite: 18].

  • Stagger Schedules Across AG Replicas: If two SQL Server VMs belong to the same Always On Availability Group (across Availability Zones or within an Availability Set) and share the exact same patching schedule, both nodes can reboot simultaneously—causing an immediate database outage[cite: 14, 18]. Always configure different days or non-overlapping maintenance windows for primary and secondary replicas (for example, Secondary on Saturday 02:00 and Primary on Sunday 02:00)[cite: 14, 18].
  • Verify Reboots via Event Viewer: Because Automated Patching reboots the guest OS automatically whenever an installed Windows or SQL patch requires it, confirm post-maintenance reboot timestamps in the Windows System Event Log (Event ID 1074 / 6006) to verify restarts occurred inside your permitted window[cite: 18].
  • Fix Invalid Default Data/Log Directory Paths: A common cause of silent or failed SQL Server patch installations on Azure VMs is a missing or invalid default database file path (The user data or log directory is invalid)[cite: 18]. Before your maintenance window, verify in SSMS (Server Properties $\rightarrow$ Database Settings) or via T-SQL (SERVERPROPERTY('InstanceDefaultDataPath') and InstanceDefaultLogPath) that both folders physically exist on attached storage[cite: 18].

6. Legacy Automated Patching vs. Azure Update Manager

Because Automated Patching retires on September 17, 2027, new Azure SQL VM deployments should standardize directly on Azure Update Manager[cite: 13].

CapabilityLegacy Automated PatchingAzure Update Manager
Lifecycle StatusRetiring September 17, 2027[cite: 13]Active / Strategic Microsoft Standard[cite: 13, 18]
SQL Server Cumulative Updates (CUs)Not installed automatically (Important/Critical only)[cite: 13]Supported natively across SQL VMs[cite: 13, 18]
Multi-VM Governance & ReportingPer-VM configuration only[cite: 14, 18]Centralized fleet compliance, pre/post scripts, and scheduling[cite: 18]
DependencySQL Server IaaS Agent Extension[cite: 13]Azure VM Guest Agent / Arc-enabled server agent
  1. Audit Existing SQL VMs: Query your subscriptions with Get-AzSqlVM to identify any VMs still relying on AutoPatchingSettingEnable = $true. 2. Enforce Staggered Windows on AGs: Immediately separate maintenance days/hours on any clustered replicas still using Automated Patching[cite: 14, 18]. 3. Migrate to Azure Update Manager: Disable legacy Automated Patching (-AutoPatchingSettingEnable:$false) and onboard your SQL VMs to Azure Update Manager to gain automated Cumulative Update coverage well before the September 2027 cutoff[cite: 13, 17, 18].


Previous Post
Migrating Off Expensive Managed Databases: Real-World Cost & IOPS Comparison (AWS RDS vs. DigitalOcean Managed PostgreSQL)
Next Post
Automating SQL Server Patching with PowerShell: A Safe-Stop Blueprint for Standalone & Clustered Estates