1. 总体流程(每节点)

官方原文:"Prepare Azure Local machines for disconnected operations by completing these steps to ensure proper setup and configuration."

每台 Azure Local 节点都要做:

  1. 下载 Azure Local ISO(与断开操作 control plane 版本匹配,例 2601)
  2. 安装 OS,配置节点网络(详见 Azure Stack HCI OS 安装)
  3. 安装 OEM 固件/驱动
  4. 重命名网卡
  5. 创建虚拟交换机(按网络规划)
  6. 重命名节点
  7. 管理集群专用:确保部署盘空间 ≥ 600 GB
  8. 拷贝根 CA 公钥到本地
  9. 拷贝根 CA 公钥到 %APPDATA%\AzureLocal\AzureLocalRootCert.cer
  10. 导入公钥到本地 LocalMachine\Root 证书库
  11. 设置 DISCONNECTED_OPS_SUPPORT Machine Environment Variable
  12. 加入域(强烈推荐)并加入部署用户到本地 Administrators
  13. 选定 seed node(节点名排序第一个)

2. 重命名网卡

⚠️ 命名一致性:所有节点必须使用相同的命名约定,避免后续 Network ATC intent 错乱。本指南统一使用 ethernet / ethernet 2(注意 ethernet 后跟空格 + 数字,非 ethernet 1 / ethernet 2)。

Rename-NetAdapter -Name "Mellanox #1" -NewName "ethernet"
Rename-NetAdapter -Name "Mellanox #2" -NewName "ethernet 2"
# 其他示例:"storage port 0"

每节点保持相同命名——这是 Network ATC 根据网卡名称Intent 绑定到目标网卡的前提。


3. 创建虚拟交换机

3.1 全融合(ManagementComputeStorage)

如果你的网络计划把管理/计算/存储合在一起:

$networkIntentName = 'ManagementComputeStorage'

New-VMSwitch -Name "ConvergedSwitch($networkIntentName)" `
    -NetAdapterName "ethernet","ethernet 2" `
    -EnableEmbeddedTeaming $true `
    -AllowManagementOS $true

# 重命名 VMNetworkAdapter(创建时 Hyper-V 用 vSwitch 名)
Rename-VmNetworkAdapter -ManagementOS `
    -Name "ConvergedSwitch($networkIntentName)" `
    -NewName "vManagement($networkIntentName)"

# 重命名 NetAdapter —— 使用 **指定名称**,不要 wildcard
Rename-NetAdapter -Name "vEthernet (ConvergedSwitch($networkIntentName))" `
    -NewName "vManagement($networkIntentName)"

⚠️ 最佳实践:重命名 vNIC 时使用指定名称,不要 Get-NetAdapter -Name "vEthernet*" 通配符——后者会同时匹配系统已存在的 vEthernet (Default Switch)vEthernet (Storage) 等虚拟网卡,导致误改或失败。

3.2 后续扩展 vSwitch 上的 vNIC

如需再为集群 / 存储 / 计算添加 vNIC,继续使用指定名称

# 加 storage vNIC
Add-VMNetworkAdapter -ManagementOS -Name "vStorage($networkIntentName)" -SwitchName "ConvergedSwitch($networkIntentName)"
Rename-NetAdapter -Name "vEthernet (ConvergedSwitch($networkIntentName))" `
    -NewName "vStorage($networkIntentName)"

4. VLAN 配置

⚠️ 关键区分:VLAN 配置命令取决于目标对象——Physical NIC 还是 vSwitch 上的 vNIC,两者使用不同 cmdlet。

目标对象

推荐 cmdlet

说明

vSwitch 上的 vNIC(management OS)

Set-VMNetworkAdapterVlan

Hyper-V 虚拟化管理 VLAN

Physical NIC

Set-NetAdapterSet-NetAdapterAdvancedProperty

物理交换机端口的 VLAN tag

4.1 Physical NIC VLAN

⚠️ Set-NetAdapter -VlanID 不是通用 cmdlet——只有部分 OEM 驱动在高级属性中暴露 VlanID 时才生效。生产推荐用 OEM 驱动提供的方法,或 Set-NetAdapterAdvancedProperty 显式设置 VLANID 关键字:

# 方法 A:OEM 驱动提供的 VLAN cmdlet(首选)
# 具体名称因 OEM/驱动而异,例如:
#   Set-IntelNetAdapterVlan ...
#   Set-MellanoxAdapterVlan ...

# 方法 B:通用 Set-NetAdapterAdvancedProperty
Set-NetAdapterAdvancedProperty -Name "ethernet 2" -RegistryKeyword "VLANID" -RegistryValue "10"

不推荐使用 Set-NetAdapter -VlanID——它在不同 OEM 驱动上行为不一致,可能静默失败

4.2 vSwitch vNIC VLAN(推荐)

如果已建好 vSwitch(如 ConvergedSwitch(ManagementComputeStorage))并要配置 management OS vNIC 的 VLAN:

Set-VMNetworkAdapterVlan `
    -ManagementOS `
    -VMNetworkAdapterName "vManagement(ManagementComputeStorage)" `
    -Access `
    -VlanId 10

文档 §3 vSwitch 部分属于 vSwitch 场景——若同段需要配 VLAN,应使用 Set-VMNetworkAdapterVlan,避免读者误用 Set-NetAdapter


5. 重命名节点

按命名约定,如 azlocal-n1/n2/n3

Rename-Computer -NewName "azlocal-n1" -Restart

6. 管理集群:保证 ≥ 600 GB 部署空间

官方原文:"Make sure you have at least 600 GB of free space on the drive you plan to use for deployment. If your drive has less space, use a data disk on each node and initialize it so each node has the same available data disks for deployment."

如果启动盘 < 600 GB,把一块数据盘初始化为 D:

$availableDrives = Get-PhysicalDisk | Where-Object { $_.MediaType -eq "SSD" -or $_.MediaType -eq "NVMe" } | where -Property CanPool -Match "True" | Sort-Object Size -Descending
$driveGroup = $availableDrives | Group-Object Size | select -First 1
$biggestDataDrives = $availableDrives | select -First $($driveGroup.Count)
$firstDataDrive= ($biggestDataDrives | Sort-Object DeviceId | select -First 1).DeviceId

Initialize-Disk -Number $firstDataDrive
New-partition -disknumber $firstDataDrive -usemaximumsize | format-volume -filesystem NTFS -newfilesystemlabel Data
Get-partition -disknumber $firstDataDrive -PartitionNumber 2 | Set-Partition -NewDriveLetter D

⚠️ 企业最佳实践:生产环境不要按 DeviceId 选择盘——DeviceId 在多节点 / 重启后会变化,导致各节点挑到不同的盘。应按 SerialNumber / 物理 Slot 稳定识别,例如:

# 企业推荐:通过 SerialNumber(首选) 或 LocationPath(次选)锁定目标盘
# SerialNumber 最稳;LocationPath 在某些 OEM/RAID 控制器上同样会因重启变化
$targetSerial = "<目标数据盘的 SerialNumber>"
$disk = Get-Disk | Where-Object { $_.SerialNumber -eq $targetSerial }
Initialize-Disk -Number $disk.Number
New-Partition -DiskNumber $disk.Number -UseMaximumSize | 
    Format-Volume -FileSystem NTFS -NewFileSystemLabel Data
Get-Partition -DiskNumber $disk.Number -PartitionNumber 2 | 
    Set-Partition -NewDriveLetter D

# LocationPath 方式(仅在 SerialNumber 不可读时作为备选)
# $targetLocation = "PCI Slot 5 : ... : Disk 0"
# $disk = Get-Disk | Where-Object { $_.LocationPath -eq $targetLocation }

7. 部署根 CA 公钥(每节点)

$applianceConfigBasePath = "C:\AzureLocalDisconnectedOperations\"
$applianceRootCertFile = "$applianceConfigBasePath\applianceRoot.cer"

New-Item -ItemType Directory $applianceConfigBasePath
Copy-Item \\fileserver\share\azurelocalcerts\publicroot.cer $applianceRootCertFile

# 副本放到 APPData(Arc appliance 部署要用)
New-Item -ItemType Directory "$($env:APPDATA)\AzureLocal" -force
Copy-Item $applianceRootCertFile "$($env:APPDATA)\AzureLocal\AzureLocalRootCert.cer"

# 导入到本机证书库
Import-Certificate -FilePath $applianceRootCertFile -CertStoreLocation Cert:\LocalMachine\Root -Confirm:$false

如果 management 证书用了不同的根,重复 import 一次到 LocalMachine\Root。


8. 启用断开操作支持开关(Machine Environment Variable)

[Environment]::SetEnvironmentVariable("DISCONNECTED_OPS_SUPPORT", "true", [System.EnvironmentVariableTarget]::Machine)

⚠️ 注意:这是 Machine Environment Variable不是 OS Feature / 注册表项 / 开关。

存的是字符串 "true"(环境变量本质是字符串,不是布尔)。重启后可用 [Environment]::GetEnvironmentVariable("DISCONNECTED_OPS_SUPPORT", "Machine") 验证。

删除/重置该环境变量的正确方法不是 Remove-Item——环境变量不在文件路径上):

# 推荐:SetEnvironmentVariable (原生 PowerShell,跨平台一致)
[Environment]::SetEnvironmentVariable("DISCONNECTED_OPS_SUPPORT", $null, [System.EnvironmentVariableTarget]::Machine)

# 备选:reg delete
reg delete "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" /v DISCONNECTED_OPS_SUPPORT /f

9. 加入域(推荐)

$credential = Get-Credential
Add-Computer -DomainName contoso.com -Credential $credential -Restart
# 也可指定 OU:
# Add-Computer -DomainName contoso.com -credential $credential -OUPath 'OU=AzureLocal,DC=contoso,DC=com' -restart 

加完域后,部署用户要加入本地 Administrators(OU 如果没指定,迁移到正确位置):

$deploymentUser = "contoso.com\lcmuser"
try {
    Add-LocalGroupMember -Group "Administrators" -Member $deploymentUser -ErrorAction Stop
} catch {
    Write-Host "Error: $_"
}

# 如果上面 Add-Computer 没指定 OU,这里移动到正确 OU
# 注意:Move-ADObject 需要 Active Directory PowerShell 模块(RSAT-AD-PowerShell)
# 实务上推荐:在 Domain Controller 上执行 Move-ADObject,而非 Azure Local 节点
$computerName = $env:COMPUTERNAME
$domain = "contoso.com"
$ou = "OU=AzureLocal,DC=contoso,DC=com" 
# Move-ADObject -Identity "CN=$computerName,CN=Computers,DC=contoso,DC=com" -TargetPath $ou

⚠️ 企业最佳实践

  • Move-ADObject 不是部署必需步骤——如果没提前指定 OU,完全不影响断开操作部署本身;只是方便后续 Group Policy 推送
  • 需要 Active Directory PowerShell 模块(RSAT-AD-PowerShell Feature),官方默认不需要每台 Azure Local 节点都装此模块——推荐在 Domain Controller 或 AD 管理机上执行 OU 移动

10. 选 Seed Node(部署发起节点)

$seednode = @('azlocal-1', 'azlocal-2','azlocal-3')|Sort|select –first 1
$seednode

Seed node = 名字排序最小的节点。所有后续 OperationsModule 部署命令都在这里发起。


11. Air-gapped 模式的额外步骤:NTP

官方原文:"For fully air‑gapped deployments with no outbound internet access, complete these actions on each Azure Local node and configure a local time server for time synchronization."

每节点执行(指向 DC,不要用 /reliable:yes——Azure Local 节点不是时间源,/reliable:yes 会让节点自称可靠时间源):

w32tm /config /manualpeerlist:"dc.contoso.com" /syncfromflags:manual /update
net stop w32time
net start w32time
w32tm /resync /rediscover
w32tm /query /peers

关于 /reliable:yes:只有时间服务器本身(如 PDC Emulator DC)才应配置 reliable:yes。Azure Local 节点作为客户端时不要配置,否则会扰乱整个林的时间层级。

Limited connectivity 模式下不强制(Microsoft NTP 可达),但强烈建议统一指向内网时间源。


12. 准备 Checklist

12.1 节点层

  • ISO 与 appliance 文件版本匹配
  • 所有节点网卡命名一致(如 ethernet / ethernet 2
  • vSwitch 已建、VLAN 已配(区分 Physical NIC / vNIC)
  • 节点已重命名、已重启
  • 部署盘可用空间 ≥ 600 GB(管理集群),按 SerialNumber/Slot 选择
  • 根 CA 公钥已 copy 到 3 个位置(base path / APPData / LocalMachine\Root)
  • DISCONNECTED_OPS_SUPPORT=true Machine Environment Variable 已设
  • 节点已加域、部署用户已加本地管理员
  • Seed node 已选定(按节点名排序最小)
  • Air-gapped 模式:NTP 已指向域控(不要 /reliable:yes
  • BIOS 时间与系统时间一致且已同步(证书验证 / Cluster 时间一致前提)
  • Secure Boot 已启用(默认安全启动要求)

12.2 版本一致性(硬性要求

⚠️ 官方反复强调:以下组件版本必须一致,否则部署验证直接失败:

  • Appliance Bundle Version(下载的 manifest 对应的 build)
  • Azure Local Version(ISO / LCM build)
  • Operations Module VersionOperationsModule\Azure.Local.DisconnectedOperations.psd1
  • Arc Resource Bridge Version(如部署 ARB,则版本需匹配断开操作支持矩阵;不部署 ARB 可不填)

任意一个版本不匹配 → 部署直接失败。部署前逐项核对。

详细对应关系参见 deploy-acquire.md §7 版本对应表。


13. "官方没明说"的事项

  • 生产节点选择数据盘:文档没说"如何严格保证多节点用同一块盘"——按 SerialNumber/Slot(不要 DeviceId)是企业最佳实践
  • DISCONNECTED_OPS_SUPPORT 验证:文档没说"如何验证已生效"——重启后可用 [Environment]::GetEnvironmentVariable("DISCONNECTED_OPS_SUPPORT", Machine) 验证字符串值
  • 删除环境变量:不要 Remove-Item(环境变量不在文件路径上)——推荐 [Environment]::SetEnvironmentVariable(..., $null, "Machine")
  • Workgroup 部署:官方没明确禁止,但官方所有示例(Operations Module / Lifecycle Manager / bootstrap 脚本)默认 Domain Joined——理论上 Workgroup 可能工作,但生产强烈不建议尝试
  • Move-ADObject 执行位置:官方没说"在哪执行"——按 RSAT 最小化原则推荐在 DC / AD 管理机上执行,而非 Azure Local 节点
  • VLAN 配置对象混淆:Hyper-V vSwitch vNIC 用 Set-VMNetworkAdapterVlan,Physical NIC 用 Set-NetAdapter——文档 §3 vSwitch 段如果同时配置 VLAN 应使用前者
  • 重命名 vNIC 风险:不要对 vEthernet* 使用 wildcard 重命名,会误改系统默认虚拟网卡——使用指定名称
Logo

DAMO开发者矩阵,由阿里巴巴达摩院和中国互联网协会联合发起,致力于探讨最前沿的技术趋势与应用成果,搭建高质量的交流与分享平台,推动技术创新与产业应用链接,围绕“人工智能与新型计算”构建开放共享的开发者生态。

更多推荐