I deployed a scaleset in azure and I need to change the underlying debian-image by credativ to a custom image. I found some good sources that do not really work for me:
- https://msftstack.wordpress.com/2016/05/17/how-to-upgrade-an-azure-vm-scale-set-without-shutting-it-down/
- https://github.com/gbowerman/vmsstools
Both articles referring to either updating the underlying stock-image to a newer version or changing the uri to the custom-image. But I need to change from stock-image to custom-image. That involves changing the json-template from
storageProfile : {
"imageReference" : {
publisher : [variables('imagePublisher')],
offer : [variables('imageOffer')],
sku : [variables('sku')],
version : [variables('imageVersion')]
},
osDisk : {
name : [concat(variables('vmssName'), 'osdisk')],
vhdContainers : [
[concat('https://', variables('uniqueStringArray')[0], variables('newStorageAccountSuffix'), '.blob.core.windows.net/', variables('vhdContainerName'))],
[concat('https://', variables('uniqueStringArray')[1], variables('newStorageAccountSuffix'), '.blob.core.windows.net/', variables('vhdContainerName'))],
[concat('https://', variables('uniqueStringArray')[2], variables('newStorageAccountSuffix'), '.blob.core.windows.net/', variables('vhdContainerName'))],
[concat('https://', variables('uniqueStringArray')[3], variables('newStorageAccountSuffix'), '.blob.core.windows.net/', variables('vhdContainerName'))],
[concat('https://', variables('uniqueStringArray')[4], variables('newStorageAccountSuffix'), '.blob.core.windows.net/', variables('vhdContainerName'))]
],
caching : ReadOnly,
createOption : FromImage
}}
to something like this:
osDisk : {
name : [concat(variables('vmssName'), 'osdisk')],
vhdContainers : [
[concat('https://', variables('uniqueStringArray')[0], variables('newStorageAccountSuffix'), '.blob.core.windows.net/', variables('vhdContainerName'))],
[concat('https://', variables('uniqueStringArray')[1], variables('newStorageAccountSuffix'), '.blob.core.windows.net/', variables('vhdContainerName'))],
[concat('https://', variables('uniqueStringArray')[2], variables('newStorageAccountSuffix'), '.blob.core.windows.net/', variables('vhdContainerName'))],
[concat('https://', variables('uniqueStringArray')[3], variables('newStorageAccountSuffix'), '.blob.core.windows.net/', variables('vhdContainerName'))],
[concat('https://', variables('uniqueStringArray')[4], variables('newStorageAccountSuffix'), '.blob.core.windows.net/', variables('vhdContainerName'))]
],
caching : ReadOnly,
createOption : FromImage,
"osType" : "Linux",
uri : https : //storageaccount.blob.core.windows.net/tstclstrvhd/my.vhd
}
What's the way to do this? Can I redeploy a scaleset with a different image?
Thanks and regards, Timo
Update: Ok, I managed to copy the vhd now.
- Deallocated on of the VMs of the scaleset with CLI: azure vmssvm deallocate
- Copied the blob with azure-cli: azure storage blob copy start --dest-account-key xxx --dest-account-name xxx
I am curious what's in the image. Does deallocate reset the image? Are all my customizations gone?