It appears the default three part version is some sort of timestamp. I would like to be able to specify the version number when I generate the image versions. I see only a mention of the version format in a troubleshooting guide but no specifics on how to set it.
e.g. The image version name should follow Major(int).Minor(int).Patch(int) format, for e.g: 1.0.0, 2018.12.1 etc.
I setup the distributor with:
$distributorObjectParameters = @{
SharedImageDistributor = $true
GalleryImageId = $galleryImageId
ReplicationRegion = $Location
ArtifactTag = $tags
RunOutputName = $imageTemplateName
ExcludeFromLatest = $false
}
$distributorObject = New-AzImageBuilderDistributorObject @distributorObjectParameters
Then create the template with:
$templateParameters = @{
ImageTemplateName = $imageTemplateName
ResourceGroupName = $imageResourceGroup
Source = $sourceObject
Distribute = $distributorObject
Customize = $customizerCollection
Location = 'East US 2'
UserAssignedIdentityId = $identityResourceId
BuildTimeoutInMinute = $buildTimeoutInMinute
}
New-AzImageBuilderTemplate @templateParameters
Is there a parameter that I have overlooked for setting the version value?
The following answer was provided by someone from Microsoft on GitHub. https://github.com/MicrosoftDocs/azure-docs/issues/89180#issuecomment-1063218290
The parameter named galleryImageId
for the distributor sets the version. The parameter can be specified as one of two formats:
Automatic versioning - The format is:
/subscriptions/<subscriptionId>/resourceGroups/<resourceGroupName>/providers/Microsoft.Compute/galleries/<sharedImageGalleryName>/images/<imageGalleryName>
Explicit versioning - The format is:
/subscriptions/<subscriptionId>/resourceGroups/<resourceGroupName>/providers/Microsoft.Compute/galleries/<sharedImageGalleryName>/images/<imageGalleryName>/versions/<version - for example: 1.1.1>
For reference: https://learn.microsoft.com/en-us/azure/virtual-machines/linux/image-builder-json#distribute-sharedimage
To test it out, I modified my distributor setup with:
$distributorObjectParameters = @{
SharedImageDistributor = $true
GalleryImageId = "$($galleryImageId)/versions/0.0.1"
ReplicationRegion = $Location
ArtifactTag = $tags
RunOutputName = $imageTemplateName
ExcludeFromLatest = $false
}
$distributorObject = New-AzImageBuilderDistributorObject @distributorObjectParameter