How to find out which image was used for the deployment of an existing Azure VM

You may have deployed a VM in Azure using a marketplace image. Or it was deployed a long time ago. Now you might wonder which exact image was used? Either for documentation purposes – or because you need the details for an automation / PowerShell script or you are just curious if you are using the latest template.

This is how I once found out using PowerShell:

$VM = Get-AzureRmVM -ResourceGroupName MyRG -VMName TheVMName


Result could look like e.g.:

Publisher : veeam
Offer : veeam-backup-replication
Sku : veeam-backup-replication-95
Version : latest
Id :