Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Azure: List OS Images

Im new to windows azure, Ive looked to this documentation, to me it works, Listing Images on gallery. https://management.core.windows.net/subscription-id/services/images

But this isnt what Im looking for, Is there a way to list the My Images on my account and not the images on gallery.

like image 610
Villapando Cedric Avatar asked Dec 25 '22 23:12

Villapando Cedric


2 Answers

If you run the PowerShell cmdlet Get-AzureVMImage, you'll see all images. As stated by @Gaurav, The ones that correlate to My Images have a PublisherName of User. So, again, using PowerShell, here's how to see just your images by piping to Where-Object:

Get-AzureVMImage | Where-Object { $_.PublisherName -eq 'User' }

If you wanted to see the image names in your console, you could pipe it to ForEach-Object:

Get-AzureVMImage | Where-Object { $_.PublisherName -eq 'User' } |
ForEach-Object { Write-Host $_.ImageName }

Note: If your image's PublisherName is empty, use Category -eq 'User' instead.

Here's sample output, from my subscription:

Output of 'My Images'

EDIT If you're using the Mac/Linux CLI, you'd run a slightly different command:

azure vm image list

Or, to return json:

azure vm image list --json

Once you have json, you could, for example, pipe to a command line tool such as jsontool to get your own image names (the image name is returned in the Name key):

azure vm image list --json | json -a -c 'this.Category == "User"' Name
like image 133
David Makogon Avatar answered Jan 05 '23 17:01

David Makogon


You would still use the same operation. The operation returns both system defined (i.e. gallery) and user defined images. To see only the user defined images, you would need to filter on PublisherName which would be User for user defined images. This is what the documentation states:

PublisherName: The name of the publisher of the image. All user images have a publisher name of User.

like image 33
Gaurav Mantri Avatar answered Jan 05 '23 18:01

Gaurav Mantri