天青:列出操作系统映像 [英] Azure: List OS Images
问题描述
林新到Windows Azure,
香港专业教育学院看着这个文档,对我来说它的工作原理,清单图片在画廊。
https://management.core.windows.net/subscription-id/services/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.
推荐答案
如果您运行PowerShell命令 GET-AzureVMImage
,你会看到的所有图像。正如@Gaurav指出,这关联到我的图片的那些有用户的PublisherName的。因此,再次使用PowerShell中,这里是如何看你刚刚通过管道图像位置对象
:
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' }
如果您希望看到您的控制台图像名称,您可以将其管的foreach对象
:
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 }
请注意:
如果图像的PublisherName的是空的,使用类别-eq用户来代替。
Note: If your image's PublisherName is empty, use Category -eq 'User' instead.
下面的示例输出,从我的订阅:
Here's sample output, from my subscription:
修改
如果你正在使用Mac / Linux的命令行,你会运行一个稍微不同的命令:
EDIT If you're using the Mac/Linux CLI, you'd run a slightly different command:
azure vm image list
或者,要返回JSON:
Or, to return json:
azure vm image list --json
一旦你有了JSON,你可以,例如,管一个命令行工具,如 jsontool 一>让自己的形象的名字(图像名称在名称
键返回):
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
这篇关于天青:列出操作系统映像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!