Blog Post

Azure Compute Blog
3 MIN READ

VMSS- Reimage-Activity logs analysis

Shikhaghildiyal's avatar
Nov 14, 2024

In this blog, we will explore different options to reimage a Virtual Machine Scale Set (VMSS) and its instances. We’ll analyze how the activity logs appear after reimaging a VMSS or when reimaging individual instances.

 

When a VMSS is reimaged, three main events are logged in the Activity Log: Accepted, Started, and Succeeded. There are several methods available to reimage a VMSS instance, and each method may result in different activity log operation names and outcomes. Reference document on reimage can be found here- Reimage a virtual machine in a scale set - Azure Virtual Machine Scale Sets | Microsoft Learn

 

Let's take a closer look at the various options for reimaging:

 

Option1Re-Image using Azure Portal

 

Go to Virtual Machine Scale Set resource. Click on Overview Blade and click on "Reimage". It will reimage all instances.

 

 

Observations on Activity Logs once Reimage is successful

 

Activity logs does not show which particular instances are reimaged. It only shows that Reimage has happened.

 

Activity Log – Operation Name: Reimage Virtual Machine Scale Set

 

 

Option2Re-Image using Azure Portal under Instances Blade

 

Select Instances from table by checking the boxes next to the instances to be reimaged, then click on Reimage button. All selected images will reimage.

 

 

Observations on Activity Logs once Reimage is successful

 

Activity Log – Operation Name: Reimage Virtual Machine Scale Set

 

Only the VMSS shows that a Reimage occurred. Instance specific information is not in the details. Ideally It should show the details listing all of the Instance names and/or IDs at the time of the reimage, but it does not show.

 

Option3: Re-Image using Azure Portal under Instances Blade. Click the link to any instance in the list and only one instance will be displayed. Then click on "Reimage" button.

 

 

Observations on Activity Logs once Reimage is successful

 

Activity Log – Operation Name: Reimage Virtual Machine in a Virtual Machine Scale Set

 

The selected Instance is reimaged, and the Instance name and Id are included in the Activity Log details

 

 

 

 

Option4: Using PowerShell command to reimage VMSS instances

 

Command: Set-AzVmssVM -ResourceGroupName "myResourceGroup" -VMScaleSetName "myScaleSet" -InstanceId instanceId -Reimage

 

 

Observations on Activity Logs once Reimage is successful

 

The selected Instance is reimaged, and the Instance name and Id are included in the Activity Log details

 

 

Option5: Using CLI command to reimage VMSS instances

 

Command: az vmss reimage --resource-group myResourceGroup --name myScaleSet --instance-ids instanceId

 

Please make a note that "instanceids" is used instead of "instanceid" as instanceid is deprecated.

 

Observations on Activity Logs once Reimage is successful

 

Activity Log – Operation Name: Reimage all Disks for a Virtual Machine Scale Set


Log Results Incorrectly reports that the command is issued for all disks in a VMSS when it is only one instance. It should show the details listing all of the Instance names and/or IDs at the time of the reimage.

 

 

Note: As per the observations, we have seen that the Activity logs are not showing correct instance details in activity logs and there are chances of improvement. For now, if we want to fetch correct details under "activity logs" we can always use PowerShell as it is capturing correct details.

 

Updated Nov 01, 2024
Version 1.0
No CommentsBe the first to comment