0

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:

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.

  1. Deallocated on of the VMs of the scaleset with CLI: azure vmssvm deallocate
  2. 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?

1

Currently changing the VMSS model from platform image to custom image isn't supported (this might change in the future as model changes are opened up more).

One way to do this with minimal downtime would be to create the new scale set, and then change the load balancer settings (i.e. a manual form of VIP swap, like disassociate the IP address from one LB, associate it with another which points to the new scale set).

Re: stop deallocate, deallocate doesn't reset the image, so the VHD will be the OS drive in the state it was in when it was shut down. You could then follow these steps to make another scale set from it: https://msftstack.wordpress.com/2016/06/20/how-to-convert-an-azure-virtual-machine-to-a-vm-scale-set/ - note you'd need to generalize the image before capturing it (see notes on that page).

  • I couldn't really test it, because I will stick with the scripted deployment now. But I guess it is right. Thanks! – Timo Jul 18 '16 at 9:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.