Reputation: 6281
I'm creating VM using the following configuration which specifies -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;
But when I try to reimage VM get the following error:
Invoke-AzVMReimage: The Reimage and OSUpgrade Virtual Machine actions require that the virtual machine has Automatic OS Upgrades enabled.
What exactly need to be able to run reimage command?
Upvotes: 0
Views: 615
Reputation: 1706
I vaguely remember this feature been in preview for Azure VMs with ephemeral OS Disk. I didn't sign up for preview back then to can't repro.
https://azure.microsoft.com/en-us/blog/ephemeral-os-disk-limited-public-preview/
hope this points you in right direction.
Upvotes: 1