Modifier

Partager via


Update-AzGalleryImageVersion

Update a gallery image version.

Syntax

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

Update a gallery image version.

Examples

Example 1: Change the replication regions and replica count

$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

Update a gallery image version's regions.

Example 2: Change whether an image version should be considered for latest.

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

Update a gallery image version's exclude from latest status. To include an image version in consideration for latest, use -PublishingProfileExcludeFromLatest:$false. To exclude an image version from consideration for latest, use -PublishingProfileExcludeFromLatest.

Example 3: Change the end-of-life date for an image version.

$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

Update a gallery image version's end-of-life date. The image version can still be used to create virtual machines after the end-of-life date.

Example 4: Update to remove TargetExtendedLocations.

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

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

Update a gallery image version to remove existing target extended locations. Pass in an empty array for -TargetExtendedLocation and set -AllowDeletionOfReplicatedLocation to true.

Parameters

-AllowDeletionOfReplicatedLocation

Indicates whether or not removing this Gallery Image Version from replicated regions is allowed.

Type:Boolean
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-AsJob

Run cmdlet in the background

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Confirm

Prompts you for confirmation before running the cmdlet.

Type:SwitchParameter
Aliases:cf
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-DefaultProfile

The credentials, account, tenant, and subscription used for communication with Azure.

Type:IAzureContextContainer
Aliases:AzContext, AzureRmContext, AzureCredential
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-GalleryImageDefinitionName

The name of the gallery image definition.

Type:String
Aliases:GalleryImageName
Position:2
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-GalleryName

The name of the gallery.

Type:String
Position:1
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-InputObject

The PS Gallery Image Version Object.

Type:PSGalleryImageVersion
Aliases:GalleryImageVersion
Position:0
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-Name

The name of the gallery image version.

Type:String
Aliases:GalleryImageVersionName
Position:3
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-PublishingProfileEndOfLifeDate

The end of life date of the gallery Image Version.

Type:DateTime
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-PublishingProfileExcludeFromLatest

If it is set, Virtual Machines deployed from the latest version of the Image Definition won't use this Image Version.

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-ReplicaCount

The number of replicas of the Image Version to be created per region.

Type:Int32
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-ResourceGroupName

The name of the resource group.

Type:String
Position:0
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-ResourceId

The resource ID for the gallery image version.

Type:String
Position:0
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-Tag

Resource tags

Type:Hashtable
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-TargetExtendedLocation

The target extended locations where the Image Version is going to be replicated to. This property is updatable.

Type:Hashtable[]
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-TargetRegion

The target regions where the Image Version is going to be replicated to.

Type:Hashtable[]
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Type:SwitchParameter
Aliases:wi
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

Inputs

String

PSGalleryImageVersion

Hashtable

Int32

SwitchParameter

DateTime

Hashtable[]

Outputs

PSGalleryImageVersion