共用方式為


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>]

Description

Get-AzVMImage Cmdlet 會取得 VMImage 的所有版本。

範例

範例 1:列出虛擬機器映像物件

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:列出具有映像棄用狀態的虛擬機器映像物件

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