Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add ExlucdeFromLatest field to TargetRegion parameter New/Update-AzGalleryImageVersion #24531

Merged
merged 7 commits into from
Apr 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions src/Compute/Compute.Test/ScenarioTests/GalleryTests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -857,6 +857,7 @@ function Test-GalleryVersionWithSourceImageVMId

# Setup Image Version
$imageVersionName = "1.0.0";
$targetRegions = @(@{Name=$loc;ReplicaCount=1;});
$paramNewAzImageVer = @{
ResourceGroupName = $rgname
GalleryName = $galleryName
Expand All @@ -866,11 +867,25 @@ function Test-GalleryVersionWithSourceImageVMId
SourceImageVMId = $vm.Id
ErrorAction = 'Stop'
StorageAccountType = $storageAccountSku
TargetRegion = $targetRegions
}
$galversion = New-AzGalleryImageVersion @paramNewAzImageVer;

# Assert VMId in version was set to the vm.Id value and was created.
Assert-AreEqual $galversion.StorageProfile.Source.VirtualMachineId $vm.Id;
Assert-Null $galversion.PublishingProfile.TargetRegion ExcludeFromLatest;

$targetRegions = @{Name=$loc;ReplicaCount=1; ExcludeFromLatest=$true}

Update-AzGalleryImageVersion -ResourceGroupName $rgname -GalleryName $galleryName `
-GalleryImageDefinitionName $definitionName -Name $imageVersionName `
-TargetRegion $targetRegions;

$galversion = Get-AzGalleryImageVersion -ResourceGroupName $rgname -GalleryName $galleryName `
-GalleryImageDefinitionName $definitionName -Name $imageVersionName;

Assert-AreEqual $galversion.PublishingProfile.TargetRegions.ExcludeFromLatest $true;

}
finally
{
Expand Down

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions src/Compute/Compute/ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
`Get-AzVmss` will no longer allow empty values to `ResourceGroupName` and `VMScaleSetName` to avoid a bug where it will just return nothing.
* Added a new parameter `-SharingProfile` to `New-AzCapacityReservationGroup` and `Update-AzCapacityReservationGroup`.
* Added the new parameter `SourceImageVMId` to the `New-AzGalleryImageVersion` cmdlet. Also added some error messages for this new parameter and the existing parameter `SourceImageId`.
* Updated parameter `-TargetRegion` in `New-AzGalleryImageVersion` and `Update-AzGalleryImageVersion` to accept `ExcludeFromLatest` field.

## Version 7.1.2
* Fixed `New-AzVM` when a source image is specified to avoid an error on the `Version` value.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ public override void ExecuteCmdlet()
Name = (string)t["Name"],
RegionalReplicaCount = (int?)t["ReplicaCount"],
StorageAccountType = (string)t["StorageAccountType"],
ExcludeFromLatest = (bool?)t["ExcludeFromLatest"],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

addressed

};
if (t["Encryption"] != null)
{
Expand Down Expand Up @@ -505,6 +506,7 @@ public override void ExecuteCmdlet()
Name = (string)t["Name"],
RegionalReplicaCount = (int?)t["ReplicaCount"],
StorageAccountType = (string)t["StorageAccountType"],
ExcludeFromLatest = (bool?)t["ExcludeFromLatest"],
};
if (t["Encryption"] != null)
{
Expand Down
Loading