When I am scaling up a scaleset I want to specify the image version to use. Right now it always uses the latest image from the compute gallery. I think that is what this az CLI command does: az vmss update -- resource-group myResourceGroup --name myScaleSet --set virtualMachineProfile.storageProfile.imageReference.version=0.235.102011129
Now I want to do the same in Java with the Azure Resource Manager SDK. ChatGPT gave this suggestion
// Resource group and scale set names
final String resourceGroupName = "myResourceGroup";
final String scaleSetName = "myScaleSet";
// Retrieve the scale set
VirtualMachineScaleSet scaleSet = azureResourceManager.virtualMachineScaleSets()
.getByResourceGroup(resourceGroupName, scaleSetName);
// Update the image reference version
VirtualMachineScaleSetUpdate updateParams = scaleSet.update()
.withVirtualMachineProfileStorageProfile(new VirtualMachineScaleSetUpdateStorageProfile()
.withImageReference(new ImageReference()
.withVersion("0.235.102011129")))
.apply();
But the problem is that withVirtualMachineProfileStorageProfile does not exist for scaleSet.update().
Does anyone know how to do this?