Here is a PowerShell script to check the Image or Model versions of each instance in an Azure Virtual Machine Scale Set (VMSS):
$ResourceGroup = "p-we1dep"
$Vmss = "p-we1dep-windows-vmss"
// Find all the instances in the VMSS
$Instances = Get-AzVmssVM -ResourceGroupName $ResourceGroup -Name $Vmss
Write-Host "Instance image versions of VMMS: $Vmss"
// For each instance in the VMSS
foreach ($Instance in $Instances) {
// Get the exact version of the instance
$InstanceInfo = (Get-AzVmssVM -ResourceGroupName $ResourceGroup -Name $Vmss -InstanceId $Instance.instanceId).StorageProfile.ImageReference.ExactVersion
$Id = $Instance.instanceId
// Echo the instance ID and Exact Version
Write-Host "Instance $Id - $InstanceExactVersion"
}
Hi Aidan…Good script. Note this works for the traditional VMSS Uniform orchestration mode. VMSS Flexible Orchestration mode is the more modern version of VMSS that scales up/down with ‘regular’Azure VMs, instead of those more limited scale set instances. So you’d just use regular Get-AzVM instead of Get-AzVmssVm
Interesting. My scenario is a DevOps VMSS which was deployed, following Microsoft guidance as a Uniform set. Get-AzVM returns zero results.