你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

Get-AzVMImage

获取 VMImage 的所有版本。

语法

ListVMImage

Get-AzVMImage
    -Location <String>
    -PublisherName <String>
    -Offer <String>
    -Skus <String>
    [-EdgeZone <String>]
    [-Top <Int32>]
    [-OrderBy <String>]
    [-Expand <String>]
    [-DefaultProfile <IAzureContextContainer>]
    [<CommonParameters>]

GetVMImageDetail

Get-AzVMImage
    -Location <String>
    -PublisherName <String>
    -Offer <String>
    -Skus <String>
    -Version <String>
    [-EdgeZone <String>]
    [-Expand <String>]
    [-DefaultProfile <IAzureContextContainer>]
    [<CommonParameters>]

说明

Get-AzVMImage cmdlet 获取 VMImage 的所有版本。

示例

示例 1:列出 VM 映像对象

Get-AzVMImage -Location "Central US" -PublisherName "MicrosoftWindowsServer" -Offer "windowsserver" -Skus "2025-datacenter"
Version           Location  PublisherName          HyperVGeneration Architecture ImageDeprecationStatus
-------           --------  -------------          ---------------- ------------ ----------------------
26100.2033.241004 centralus MicrosoftWindowsServer
26100.2314.241107 centralus MicrosoftWindowsServer
26100.2605.241207 centralus MicrosoftWindowsServer
26100.2894.250113 centralus MicrosoftWindowsServer
26100.3194.250210 centralus MicrosoftWindowsServer
26100.3476.250306 centralus MicrosoftWindowsServer
26100.3775.250406 centralus MicrosoftWindowsServer

此命令获取与指定值匹配的所有 VMImage 版本。

示例 2:列出具有映像弃用状态的 VM 映像对象

Get-AzVMImage -Location "Central US" -PublisherName "MicrosoftWindowsServer" -Offer "windowsserver" -Skus "2025-datacenter" -Expand properties/imageDeprecationStatus
Version           Location  PublisherName          HyperVGeneration Architecture ImageDeprecationStatus
-------           --------  -------------          ---------------- ------------ ----------------------
26100.2033.241004 centralus MicrosoftWindowsServer V1               x64          Microsoft.Azure.Management.Compute.Mo…
26100.2314.241107 centralus MicrosoftWindowsServer V1               x64          Microsoft.Azure.Management.Compute.Mo…
26100.2605.241207 centralus MicrosoftWindowsServer V1               x64          Microsoft.Azure.Management.Compute.Mo…
26100.2894.250113 centralus MicrosoftWindowsServer V1               x64          Microsoft.Azure.Management.Compute.Mo…
26100.3194.250210 centralus MicrosoftWindowsServer V1               x64          Microsoft.Azure.Management.Compute.Mo…
26100.3476.250306 centralus MicrosoftWindowsServer V1               x64          Microsoft.Azure.Management.Compute.Mo…
26100.3775.250406 centralus MicrosoftWindowsServer V1               x64          Microsoft.Azure.Management.Compute.Mo…

此命令获取与映像弃用状态匹配指定值的所有 VMImage 版本。

示例 3:获取 VMImage 对象

Get-AzVMImage -Location "Central US" -PublisherName "MicrosoftWindowsServer" -Offer "windowsserver" -Skus "2025-datacenter" -Version 26100.2033.241004
Id                     : /Subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/Providers/Microsoft.Compute/Locations/cent
                         ralus/Publishers/MicrosoftWindowsServer/ArtifactTypes/VMImage/Offers/windowsserver/Skus/2025-d
                         atacenter/Versions/26100.2033.241004
Location               : centralus
PublisherName          : MicrosoftWindowsServer
Offer                  : windowsserver
Skus                   : 2025-datacenter
Version                : 26100.2033.241004
FilterExpression       :
Name                   : 26100.2033.241004
HyperVGeneration       : V1
OSDiskImage            : {
                           "operatingSystem": "Windows"
                         }
PurchasePlan           : null
DataDiskImages         : []
ImageDeprecationStatus : {
                           "imageState": "Active",
                           "scheduledDeprecationTime": null,
                           "alternativeOption": null
                         }

此命令获取与指定值匹配的特定 VMImage 版本。

示例 4:获取 VMImage 对象

Get-AzVMImage -Location "Central US" -PublisherName "MicrosoftWindowsServer" -Offer "windowsserver" -Skus "2025-datacenter" -Version 26100.2* -Expand properties
Version           Location  PublisherName          HyperVGeneration Architecture ImageDeprecationStatus
-------           --------  -------------          ---------------- ------------ ----------------------
26100.2033.241004 centralus MicrosoftWindowsServer V1               x64
26100.2314.241107 centralus MicrosoftWindowsServer V1               x64
26100.2605.241207 centralus MicrosoftWindowsServer V1               x64
26100.2894.250113 centralus MicrosoftWindowsServer V1               x64

此命令获取与指定值匹配的所有 VMImage 版本,并筛选版本。

参数

-DefaultProfile

用于与 Azure 通信的凭据、帐户、租户和订阅。

参数属性

类型:IAzureContextContainer
默认值:None
支持通配符:False
不显示:False
别名:AzContext, AzureRmContext, AzureCredential

参数集

(All)
Position:Named
必需:False
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-EdgeZone

设置 EdgeZone 的扩展位置名称。 如果未设置,将从 Azure 主区域查询 VM 映像。 否则,将从指定的扩展位置查询它

参数属性

类型:String
默认值:None
支持通配符:False
不显示:False

参数集

(All)
Position:Named
必需:False
来自管道的值:False
来自管道的值(按属性名称):True
来自剩余参数的值:False

-Expand

要应用于作的展开表达式。 可能的值包括:“properties”和“properties/imageDeprecationStatus”

参数属性

类型:String
默认值:None
支持通配符:False
不显示:False

参数集

(All)
Position:Named
必需:False
来自管道的值:False
来自管道的值(按属性名称):True
来自剩余参数的值:False

-Location

指定 VMImage 的位置。

参数属性

类型:String
默认值:None
支持通配符:False
不显示:False

参数集

(All)
Position:Named
必需:True
来自管道的值:False
来自管道的值(按属性名称):True
来自剩余参数的值:False

-Offer

指定 VMImage 产品/服务的类型。 若要获取映像产品/服务,请使用 Get-AzVMImageOffer cmdlet。

参数属性

类型:String
默认值:None
支持通配符:False
不显示:False

参数集

(All)
Position:Named
必需:True
来自管道的值:False
来自管道的值(按属性名称):True
来自剩余参数的值:False

-OrderBy

指定返回的结果的顺序。 格式化为 OData 查询。

参数属性

类型:String
默认值:None
支持通配符:False
不显示:False

参数集

ListVMImage
Position:Named
必需:False
来自管道的值:False
来自管道的值(按属性名称):True
来自剩余参数的值:False

-PublisherName

指定 VMImage 的发布者。 若要获取映像发布者,请使用 Get-AzVMImagePublisher cmdlet。

参数属性

类型:String
默认值:None
支持通配符:False
不显示:False

参数集

(All)
Position:Named
必需:True
来自管道的值:False
来自管道的值(按属性名称):True
来自剩余参数的值:False

-Skus

指定 VMImage SKU。 若要获取 SKU,请使用 Get-AzVMImageSku cmdlet。

参数属性

类型:String
默认值:None
支持通配符:False
不显示:False

参数集

(All)
Position:Named
必需:True
来自管道的值:False
来自管道的值(按属性名称):True
来自剩余参数的值:False

-Top

指定返回的最大虚拟机映像数。

参数属性

类型:

Nullable<T>[Int32]

默认值:None
支持通配符:False
不显示:False

参数集

ListVMImage
Position:Named
必需:False
来自管道的值:False
来自管道的值(按属性名称):True
来自剩余参数的值:False

-Version

指定 VMImage 的版本。

参数属性

类型:String
默认值:None
支持通配符:True
不显示:False

参数集

GetVMImageDetail
Position:Named
必需:True
来自管道的值:False
来自管道的值(按属性名称):True
来自剩余参数的值:False

CommonParameters

此 cmdlet 支持通用参数:-Debug、-ErrorAction、-ErrorVariable、-InformationAction、-InformationVariable、-OutBuffer、-OutVariable、-PipelineVariable、-ProgressAction、-Verbose、-WarningAction 和 -WarningVariable。 有关详细信息,请参阅 about_CommonParameters

输入

String

输出

PSVirtualMachineImage

PSVirtualMachineImageDetail