Komal Nagada
Komal Nagada

Reputation: 109

use azure cli command to change the reference image of vmss and update the vm running under the vmss

I want to use azure cli command to change the reference image of vmss and update the vm running under the vmss.

I used to use UI to update the reference image as shown below.

enter image description here

I tried following https://learn.microsoft.com/en-US/cli/azure/vmss?view=azure-cli-latest#az_vmss_update

but not getting exact command, am I going in wrong direction?

Upvotes: 3

Views: 1990

Answers (2)

kislay
kislay

Reputation: 41

This is the CLI command I have used

az vmss update --name MyScaleSet --resource-group MyResourceGroup --set virtualMachineProfile.storageProfile.imageReference.id=imageID

Upvotes: 4

AjayKumarGhose
AjayKumarGhose

Reputation: 4893

I have tested in my environment to change the reference images of VMSS but it seems not possible using below cmd.

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

enter image description here

If you want to update the version of reference image you can change with the below command.

Update-AzVmss -ResourceGroupName "myResourceGroup" -VMScaleSetName "myScaleSet" -ImageReferenceVersion 16.04.201801090

Upvotes: 1

Related Questions