Azure: OS Image List

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

But this is not what I am looking for. Is there a way to list My images in my account, not images in the gallery.

+4
source share
3 answers

If you run the PowerShell cmdlet Get-AzureVMImage , you will see all the images. As pointed out by @Gaurav, those that correlate with My Images are named Publisher User . So, again, using PowerShell, here's how to see only your images piped to Where-Object :

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

If you want to see the image names in the console, you can send it to ForEach-Object :

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

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

Here is an example of output from my subscription:

Output of 'My Images'

EDIT If you use the CLI for Mac / Linux, you can run a slightly different command:

 azure vm image list 

Or to return json:

 azure vm image list --json 

Once you have json, you can, for example, plug in a command line tool like 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 
+9
source

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

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

+1
source

Try the command below. It works with the category as a user, not with the name of the publisher.

Decision:

 Get-AzureVMImage | Where-Object { $_.Category -match 'User'} | ForEach-Object { Write-Host $_.ImageName } 
0
source

Source: https://habr.com/ru/post/1494453/


All Articles