Azure Image Builder - 如何指定 VM 映像版本
看来默认的三部分版本是某种时间戳。我希望能够在生成图像版本时指定版本号。我在故障排除指南中只看到版本格式的提及,但没有详细说明如何设置它。
例如 镜像版本名称应遵循Major(int).Minor(int).Patch(int)格式,例如:1.0.0、2018.12.1等。
我设置了分配器:
$distributorObjectParameters = @{
SharedImageDistributor = $true
GalleryImageId = $galleryImageId
ReplicationRegion = $Location
ArtifactTag = $tags
RunOutputName = $imageTemplateName
ExcludeFromLatest = $false
}
$distributorObject = New-AzImageBuilderDistributorObject @distributorObjectParameters
然后创建模板:
$templateParameters = @{
ImageTemplateName = $imageTemplateName
ResourceGroupName = $imageResourceGroup
Source = $sourceObject
Distribute = $distributorObject
Customize = $customizerCollection
Location = 'East US 2'
UserAssignedIdentityId = $identityResourceId
BuildTimeoutInMinute = $buildTimeoutInMinute
}
New-AzImageBuilderTemplate @templateParameters
是否有一个我在设置版本值时忽略的参数?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
以下答案是来自微软的人在 GitHub 上提供的。
https://github.com/MicrosoftDocs/azure-docs/issues/ 89180#issuecomment-1063218290
发行商的名为
galleryImageId
的参数设置版本。该参数可以指定为以下两种格式之一:自动版本控制 - 格式为:
/subscriptions//resourceGroups//providers/Microsoft.Compute/galleries//images/
显式版本控制 - 格式为:
/subscriptions//resourceGroups//providers/Microsoft.Compute/galleries//images//versions/;
供参考:
https://learn.microsoft.com/en-us/azure/virtual-machines/linux/image-builder-json#distribute-sharedimage" microsoft.com/en-us/azure/virtual-machines/linux/image-builder-json#distribute-sharedimage
为了测试它,我修改了我的分发服务器设置:
并得到以下内容 结果:
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:
and got the following result:
我不认为你可以从 Azure 获得这个选项。在我们的项目中,我们使用 bash 和 az-cli 自行计算版本。
我们将初始版本实例化为
1.0.0
(第一次)&一旦设置,我们只需在下一次构建迭代中增加..I don't think you can have that option from Azure. In our projects, we compute versions ourselves with
bash
andaz-cli
.We instantiate the initial version to
1.0.0
(for the first time) & once set, we just increment in next build iterations..