I have created a VMSS on Azure using the vhd of my Azure VM.
How can I change the source vhd of VMSS to a new vhd ?
Get the following error:
I have created a VMSS on Azure using the vhd of my Azure VM.
How can I change the source vhd of VMSS to a new vhd ?
Get the following error:
We can use Update-AzureRmVmss
and Update-AzureRmVmssInstance
to upgrade VMSS instance.
If we want to use custom image to upgrades Azure VMSS instances, we should make sure this VMSS create by custom image.
If we create VMSS from Azure marketplace, we can’t use custom image to upgrades Azure VMSS instances.
Here is my test:
1.I create VMSS by custom image, and use VMSS template to create it(managed disk).
2, create another VM image, and use this script to get the $vmss, and use Powershell to upgrades VMSS instances:
$rgname = "vmsss"
$vmssname = "jasonvmss"
$instanceid = "1"
$newimagereference = "/subscriptions/5384xxxx-xxxx-xxxx-xxxx-xxxxe29axxxx/resourceGroups/jasonwin/providers/Microsoft.Compute/images/myImage"
$vmss = Get-AzureRmVmss -ResourceGroupName $rgname -VMScaleSetName $vmssname
$vmss.virtualMachineProfile.storageProfile.imageReference.id = $newImageReference
Update-AzureRmVmss -ResourceGroupName $rgname -Name $vmssname -VirtualMachineScaleSet $vmss
Update-AzureRmVmssInstance -ResourceGroupName $rgname -VMScaleSetName $vmssname -InstanceId $instanceId
Here is my screenshot:
Also we can find the status of VMSS instances:
So, as a workaround, we can use template or PowerShell to create Azure VMSS with custom image, then use this script to upgrades Azure VMSS instances.
Note: In my test, I am use template create VMSS was managed disk, so we should use $vmss.virtualMachineProfile.storageProfile.imageReference.id
If you create VMSS was un-managed disk, we should use this $vmss.virtualMachineProfile.storageProfile.osDisk.image.uri= $newURI
.
Here is the official article about upgrades VMSS instances, please refer to it.
AS per the FAQ on VMSS and VM in general, the VMSS runs on top of VHD. So, if you have a new VHD, then you could simply delete the old VMSS, and create a new VMSS.
here is how I picture your situation to be.
the issue itself seems straightforward, unless you are asking for something else, and I am making a fool of myself :)
if the issue is something else, then the question needs to be explained a little more so other, more experience azure folks can help you.