0

I have created an azure scaleset using custom image. when I try to upgrade the scale set with another custom image using "Azure VMSS: update with immutable machine image" I get the following error

Failed to update image for VMSS testvmssapp. Error: VMSS testvmssapp can not be updated as it uses a platform image. Only a VMSS which is currently using a custom image can be updated.

Is there something I am missing with custom scaleset image?

"storageProfile": {
            "osDisk": {
              "createOption": "FromImage",
              "caching": "ReadWrite",
              "managedDisk": {
                "storageAccountType": "Standard_LRS"
              },
              "diskSizeGB": 127
            },
            "imageReference": {
              "id": "/subscriptions/xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxx/resourceGroups/testvmssdeployment/providers/Microsoft.Compute/images/MyCustomImage"
            }
          },

enter image description here

enter image description here

kumar
  • 8,207
  • 20
  • 85
  • 176
  • I will try over the weekend and let you know – kumar Nov 15 '19 at 13:47
  • How did it go, Any good news? – Levi Lu-MSFT Nov 18 '19 at 05:36
  • Yes the below one does work. but it looks like the Azure Devops "Build immutable machine image" task is outdated and cannot be used when using the defaults packer template = auto generated it does not have setting "managed_image_name": "myPackerImage" hence it does not created managed image but vhd in storage The output of this task is a url to the vhd. Also the task " Azure VMSS: update with immutable machine image" is outdated it only access .vhd image url and no managed image – kumar Nov 18 '19 at 05:59
  • If "Build immutable machine image" task got an issue , you can report it [here](https://github.com/Microsoft/azure-pipelines-tasks/issues). – Levi Lu-MSFT Nov 18 '19 at 06:48

2 Answers2

0

From OS Updates for a scale set, If you use Azure platform images, you can update the image by modifying the imageReference. With platform images, it is common to specify "latest" for the image reference version. If you use custom images, you can update the image by updating the imageReference ID.

Since you have created a scale set with a base image windows-2012-R2-datacenter. It's deployed from platform Images. It's not supported by changing the image from platform to custom. For more information, please read here1 and here2.

In this case, you could directly recreate a scale set with a new custom Image or remove the old scale set. This is the REST API for creating a scale set from a custom image.

Nancy
  • 26,865
  • 3
  • 18
  • 34
0

I opened an issue here about task Azure VM scale set deployment that you track on.

As workaround, You can try updating the image by using azure powershell task or azure cli task in your pipeline to run below script.

Azure Powershell:

Update-AzVmss `
    -ResourceGroupName "myResourceGroup" `
    -VMScaleSetName "myScaleSet" `
    -ImageReferenceId /subscriptions/{subscriptionID}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/images/myNewImage

Azure CLI:

az vmss update \
    --resource-group myResourceGroup \
    --name myScaleSet \
    --set virtualMachineProfile.storageProfile.imageReference.id=/subscriptions/{subscriptionID}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/images/myNewImage

Another workaround to this issue is to create a VHD file, and use this VHD file to create the VSS using this template. And then you will have a Image resource that has a URL which you can use for task Azure VM scale set deployment. Please check here for information

Levi Lu-MSFT
  • 27,483
  • 2
  • 31
  • 43