Figuring out Image version number of Virtual machine

sns 9,251 Reputation points
2023-12-04T18:52:21.4666667+00:00

I created a VM from one of the custom image from particular version

But I want to know which image version i have used to create VM. is it possible ? if yes how?

Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
0 comments No comments
{count} votes

Answer accepted by question author
  1. TP 144.4K Reputation points Volunteer Moderator
    2023-12-04T20:31:25.47+00:00

    Hi,

    You can use powershell code similar to below:

    $vm = Get-AzVM -ResourceGroupName myResourceGroup -Name myVM 
    $vm.StorageProfile.ImageReference|fl
    
    

    Please click Accept Answer and upvote if the above was helpful.

    Thanks.

    -TP

    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Dillon Silzer 60,686 Reputation points Volunteer Moderator
    2023-12-04T22:21:53.8466667+00:00

    Hi sns,

    Another solution is running the following PS command:

    (Get-AzureVM -ServiceName serviceName -Name vmName).VM.OSVirtualHardDisk.SourceImageName
    

    Cited from https://stackoverflow.com/questions/32431186/how-can-i-find-the-name-of-the-vm-image-used-to-create-an-azure-vm-using-powersh


    If this is helpful please accept answer.

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.