共用方式為


Update-AzGalleryImageVersion

更新資源庫映像版本。

語法

Update-AzGalleryImageVersion
      [-ResourceGroupName] <String>
      [-GalleryName] <String>
      [-GalleryImageDefinitionName] <String>
      [-Name] <String>
      [-AsJob]
      [-PublishingProfileEndOfLifeDate <DateTime>]
      [-PublishingProfileExcludeFromLatest]
      [-ReplicaCount <Int32>]
      [-Tag <Hashtable>]
      [-TargetRegion <Hashtable[]>]
      [-TargetExtendedLocation <Hashtable[]>]
      [-AllowDeletionOfReplicatedLocation <Boolean>]
      [-DefaultProfile <IAzureContextContainer>]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]
Update-AzGalleryImageVersion
      [-ResourceId] <String>
      [-AsJob]
      [-PublishingProfileEndOfLifeDate <DateTime>]
      [-PublishingProfileExcludeFromLatest]
      [-ReplicaCount <Int32>]
      [-Tag <Hashtable>]
      [-TargetRegion <Hashtable[]>]
      [-TargetExtendedLocation <Hashtable[]>]
      [-AllowDeletionOfReplicatedLocation <Boolean>]
      [-DefaultProfile <IAzureContextContainer>]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]
Update-AzGalleryImageVersion
      [-InputObject] <PSGalleryImageVersion>
      [-AsJob]
      [-PublishingProfileEndOfLifeDate <DateTime>]
      [-PublishingProfileExcludeFromLatest]
      [-ReplicaCount <Int32>]
      [-Tag <Hashtable>]
      [-TargetRegion <Hashtable[]>]
      [-TargetExtendedLocation <Hashtable[]>]
      [-AllowDeletionOfReplicatedLocation <Boolean>]
      [-DefaultProfile <IAzureContextContainer>]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]

Description

更新資源庫映像版本。

範例

範例 1:變更復寫區域和複本計數

$rgName = "myResourceGroup"
$galleryName = "myGallery"
$imageName = "myImage"
$versionName = "1.0.0"
$region1 = @{Name='West US';ReplicaCount=1}
$region2 = @{Name='East US';ReplicaCount=2}
$region3 = @{Name='Central US'}
$targetRegions = @($region1,$region2,$region3)
Update-AzGalleryImageVersion -ResourceGroupName $rgname -GalleryName $galleryName -GalleryImageDefinitionName $imageName -Name $versionName -ReplicaCount 2 -TargetRegion $targetRegions

更新資源庫映像版本的區域。

範例 2:變更映射版本是否應考慮為最新版本。

$rgName = "myResourceGroup"
$galleryName = "myGallery"
$imageName = "myImage"
$versionName = "1.0.0"
Update-AzGalleryImageVersion -ResourceGroupName $rgname -GalleryName $galleryName -GalleryImageDefinitionName $imageName -Name $versionName -PublishingProfileExcludeFromLatest:$false

更新資源庫映像版本的排除狀態。 若要納入最新考慮的映像版本,請使用 -PublishingProfileExcludeFromLatest:$false。 若要將映像版本排除在最新考慮中,請使用 -PublishingProfileExcludeFromLatest

範例 3:變更映射版本的生命週期結束日期。

$rgName = "myResourceGroup"
$galleryName = "myGallery"
$imageName = "myImage"
$versionName = "1.0.0"
$endOfLifeDate = "2024-08-02T00:00:00+00:00"
Update-AzGalleryImageVersion -ResourceGroupName $rgname -GalleryName $galleryName -GalleryImageDefinitionName $imageName -Name $versionName -PublishingProfileEndOfLifeDate $endOfLifeDate

更新資源庫映像版本的生命週期結束日期。 映像版本仍可用於在生命周期結束日期之後建立虛擬機。

範例 4:更新以移除 TargetExtendedLocations。

$rgName = "myResourceGroup"
$galleryName = "myGallery"
$imageName = "myImage"
$versionName = "1.0.0"

Update-AzGalleryImageVersion -ResourceGroupName $rgname -GalleryName $galleryName -GalleryImageDefinitionName $imageName -Name $versionName -TargetExtendedLocation @() -AllowDeletionOfReplicatedLocation $True

更新資源庫映像版本以移除現有的目標擴充位置。 針對 -TargetExtendedLocation 傳入空陣列,並將 -AllowDeletionOfReplicatedLocation 設定為 true。

參數

-AllowDeletionOfReplicatedLocation

指出是否允許從復寫區域移除此資源庫映像版本。

類型:Boolean
Position:Named
預設值:None
必要:False
接受管線輸入:True
接受萬用字元:False

-AsJob

在背景執行 Cmdlet

類型:SwitchParameter
Position:Named
預設值:None
必要:False
接受管線輸入:False
接受萬用字元:False

-Confirm

在執行 Cmdlet 之前,提示您進行確認。

類型:SwitchParameter
別名:cf
Position:Named
預設值:None
必要:False
接受管線輸入:False
接受萬用字元:False

-DefaultProfile

用於與 Azure 通訊的認證、帳戶、租用戶和訂用帳戶。

類型:IAzureContextContainer
別名:AzContext, AzureRmContext, AzureCredential
Position:Named
預設值:None
必要:False
接受管線輸入:False
接受萬用字元:False

-GalleryImageDefinitionName

資源庫映像定義的名稱。

類型:String
別名:GalleryImageName
Position:2
預設值:None
必要:True
接受管線輸入:True
接受萬用字元:False

-GalleryName

資源庫的名稱。

類型:String
Position:1
預設值:None
必要:True
接受管線輸入:True
接受萬用字元:False

-InputObject

PS 資源庫映像版本物件。

類型:PSGalleryImageVersion
別名:GalleryImageVersion
Position:0
預設值:None
必要:True
接受管線輸入:True
接受萬用字元:False

-Name

資源庫映像版本的名稱。

類型:String
別名:GalleryImageVersionName
Position:3
預設值:None
必要:True
接受管線輸入:True
接受萬用字元:False

-PublishingProfileEndOfLifeDate

資源庫映像版本的生命週期結束日期。

類型:DateTime
Position:Named
預設值:None
必要:False
接受管線輸入:True
接受萬用字元:False

-PublishingProfileExcludeFromLatest

如果已設定,從最新版映像定義的虛擬機不會使用此映像版本。

類型:SwitchParameter
Position:Named
預設值:None
必要:False
接受管線輸入:True
接受萬用字元:False

-ReplicaCount

要為每個區域建立之映像版本的複本數目。

類型:Int32
Position:Named
預設值:None
必要:False
接受管線輸入:True
接受萬用字元:False

-ResourceGroupName

資源群組的名稱。

類型:String
Position:0
預設值:None
必要:True
接受管線輸入:True
接受萬用字元:False

-ResourceId

資源庫映像版本的資源識別碼。

類型:String
Position:0
預設值:None
必要:True
接受管線輸入:True
接受萬用字元:False

-Tag

資源標籤

類型:Hashtable
Position:Named
預設值:None
必要:False
接受管線輸入:True
接受萬用字元:False

-TargetExtendedLocation

要復寫映像版本的目標擴充位置。 這個屬性是可更新的。

類型:Hashtable[]
Position:Named
預設值:None
必要:False
接受管線輸入:True
接受萬用字元:False

-TargetRegion

要復寫映像版本的目標區域。

類型:Hashtable[]
Position:Named
預設值:None
必要:False
接受管線輸入:True
接受萬用字元:False

-WhatIf

顯示 Cmdlet 執行時會發生什麼事。 Cmdlet 未執行。

類型:SwitchParameter
別名:wi
Position:Named
預設值:None
必要:False
接受管線輸入:False
接受萬用字元:False

輸入

String

PSGalleryImageVersion

Hashtable

Int32

SwitchParameter

DateTime

Hashtable[]

輸出

PSGalleryImageVersion