我正在使用以下配置创建VM,该配置指定-EnableAutoUpdate:
# Create virtual machine
Write-Host "Creating virtual machine '$vmName' in resource group '$resourceGroupName'";
$virtualMachineConfig = New-AzVmConfig -VMName "$vmName" -VMSize "Standard_D2_v3" -IdentityType UserAssigned -IdentityID "$($userAssignedIdentity.Id)" `
| Set-AzVMOperatingSystem -CustomData $encodedScript -Windows -ComputerName "$vmname" -Credential $Credential -ProvisionVMAgent -EnableAutoUpdate `
| Add-AzVMNetworkInterface -Id $nic.Id `
| Set-AzVMSourceImage -PublisherName 'MicrosoftWindowsServer' -Offer 'WindowsServer' -Skus '2016-Datacenter' -Version latest `
| Set-AzVMBootDiagnostics -Enable -ResourceGroupName $resourceGroup.ResourceGroupName -StorageAccountName $bootDiagStorageAccount.StorageAccountName;
但是当我尝试重新映像VM时会出现以下错误:
Invoke-AzVMReimage: The Reimage and OSUpgrade Virtual Machine actions require that the virtual machine has Automatic OS Upgrades enabled.
究竟需要什么才能运行reimage命令?
我依稀记得这个功能已经预览了具有短暂操作系统磁盘的Azure虚拟机。我没有注册预览然后再也无法复制。
https://azure.microsoft.com/en-us/blog/ephemeral-os-disk-limited-public-preview/
希望这能指出你正确的方向。