How can I find the name of the VM image used to create an Azure VM using PowerShell?

Oliver Bock picture Oliver Bock · Sep 7, 2015 · Viewed 10.3k times · Source

If I use Get-AzureVM (PowerShell cmdlet) to fetch a running VM then the fields I get back are

DeploymentName
Name
Label
VM
InstanceStatus
IpAddress
InstanceStateDetails
PowerState
InstanceErrorCode
InstanceFaultDomain
InstanceName
InstanceUpgradeDomain
InstanceSize
HostName
AvailabilitySetName
DNSName
Status
GuestAgentStatus
ResourceExtensionStatusList
PublicIPAddress
PublicIPName
PublicIPDomainNameLabel
PublicIPFqdns
NetworkInterfaces
VirtualNetworkName
ServiceName
OperationDescription
OperationId
OperationStatus

However I cannot see the name of the image used to create the VM. I can see this information using the Azure portal (under Settings > Properties > SOURCE IMAGE NAME). How can I get the source image name using PowerShell?

Answer

thecloudguy picture thecloudguy · Jan 20, 2020

If you want to check the source image without using cmd/Powershell, then follow these steps: How to find the running VM image version.

> Go to azure portal
> Select the running/stopped VM whose image you want to identify
> Go to export template option
> On the right side of the screen, you will see the template window will open in JSON format.
> Ctrl+F (search) > imageReference > you will get your image version in the template.