为 Azure Local 上的 Azure Edition 虚拟机启用 Hotpatch
适用于 Windows Server 2022 Datacenter 的热修补:Azure 本地托管的 Azure Edition 虚拟机(VM)允许在 Azure 本地的 ISO 部署计算机上安装安全更新,而无需在安装后重新启动。 可以将热补丁与桌面体验和 Server Core 结合使用。 本文将介绍如何在使用 ISO 安装或升级操作系统后配置热补丁。
注意
如果使用的是 Azure 市场,请不要遵循本文中的步骤。 请转而使用 Azure 市场中以下可用于热修补的映像:
- Windows Server 2022 Datacenter:Azure Edition Hotpatch - Gen2
- Windows Server 2022 Datacenter:Azure Edition Core - Gen2
在 Azure 本地环境中为通过 ISO 部署的计算机使用 Hotpatch 时,与将 Hotpatch 作为 Azure Automanage for Azure VMs 体验的一部分使用相比,存在一些重要的差异。
这些差异包括:
- 无法通过 Azure 更新管理器使用热补丁配置。
- 无法禁用热补丁。
- 自动修补业务流程不可用。
- 必须手动执行业务流程(例如,通过 SConfig 使用 Windows 更新)。
先决条件
若要启用热补丁,必须在开始之前满足以下先决条件:
- Windows Server 2022 Datacenter:Azure 版本托管在受支持的平台上,例如已启用 Azure 权益的 Azure 或 Azure 本地版。
- Azure 本地版本必须是 21H2 或更高版本。
- 查看“新虚拟机的热补丁”一文的热补丁的工作原理部分。
- 允许 HTTPS (TCP/443) 流量流向以下终结点的出站网络访问或出站端口规则:
go.microsoft.com
software-static.download.prss.microsoft.com
准备计算机
在为 VM 启用热补丁之前,必须使用以下步骤准备计算机:
登录到计算机。 如果正在使用 Server Core,则在 SConfig 菜单中,输入选项 15,然后按 Enter 打开 PowerShell 会话。 如果使用的是桌面体验,请通过远程桌面进入 VM 并启动 PowerShell。
通过运行以下 PowerShell 命令来配置正确的注册表设置,启用基于虚拟化的安全性:
$registryPath = "HKLM:\SYSTEM\CurrentControlSet\Control\DeviceGuard" $parameters = $parameters = @{ Path = $registryPath Name = "EnableVirtualizationBasedSecurity" Value = "0x1" Force = $True PropertyType = "DWORD" } New-ItemProperty @parameters
重新启动计算机。
通过运行以下 PowerShell 命令在注册表中配置热补丁表大小:
$registryPath = "HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management" $parameters = $parameters = @{ Path = $registryPath Name = "HotPatchTableSize" Value = "0x1000" Force = $True PropertyType = "DWORD" } New-ItemProperty @parameters
通过运行以下 PowerShell 命令在注册表中为热补丁配置 Windows 更新终结点:
$registryPath = "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Update\TargetingInfo\DynamicInstalled\Hotpatch.amd64" $nameParameters = $parameters = @{ Path = $registryPath Name = "Name" Value = "Hotpatch Enrollment Package" Force = $True } $versionParameters = $parameters = @{ Path = $registryPath Name = "Version" Value = "10.0.20348.1129" Force = $True } New-Item $registryPath -Force New-ItemProperty @nameParameters New-ItemProperty @versionParameters
准备好计算机后,现在即可安装热补丁服务包。
安装热补丁服务包
注意
Microsoft 更新目录中当前未发布热补丁先决条件知识库。
若要能够接收热补丁更新,需要下载并安装热补丁服务包。 在 PowerShell 会话中,完成以下步骤:
从 Microsoft 更新目录下载 (KB5003508) Microsoft 更新独立程序包,并使用以下 PowerShell 命令将其复制到计算机:
$parameters = @{ Source = "https://go.microsoft.com/fwlink/?linkid=2211714" Destination = ".\KB5003508.msu" } Start-BitsTransfer @parameters
若要安装独立程序包,请运行以下命令:
wusa.exe .\KB5003508.msu
按提示操作。 完成后,选择“完成”。
若要验证安装,请运行以下命令:
Get-HotFix | Where-Object {$_.HotFixID -eq "KB5003508"}
注意
使用 Server Core 时,默认情况下更新设置为手动安装。 你可以使用 SConfig 实用工具更改此设置。
后续步骤
现在,你已针对热补丁对计算机进行了设置,下面是一些可帮助你更新计算机的文章: