排查共享映像库问题Troubleshooting shared image galleries

如果在对共享映像库、映像定义和映像版本执行任何操作时遇到问题,请在调试模式下再次运行失败的命令。If you run into issues while performing any operations on shared image galleries, image definitions, and image versions, run the failing command again in debug mode. 若要激活调试模式,可以通过 CLI 来传递 -debug 开关,通过 PowerShell 来传递 -Debug 开关。Debug mode is activated by passing the -debug switch with CLI and the -Debug switch with PowerShell. 确定错误的位置以后,请按本文档的说明来排查错误。Once you've located the error, follow this document to troubleshoot the errors.

可能的原因:Possible causes:

库名称无效。The gallery name is invalid.

允许用于库名称的字符为大写或小写字母、数字、点和句点。Allowed characters for Gallery name are uppercase or lowercase letters, digits, dots, and periods. 库名称不能包含短划线。The gallery name cannot contain dashes. 请更改库名称,然后重试。Change the gallery name and try again.

库名称在订阅中不唯一。The gallery name is not unique within your subscription.

请选取其他库名称,然后重试。Pick another gallery name and try again.

无法创建映像定义。Unable to create an image definition

可能的原因:Possible causes:

映像定义名称无效。image definition name is invalid.

允许用于映像定义的字符为大写或小写字母、数字、点、短划线和句点。Allowed characters for image definition are uppercase or lowercase letters, digits, dots, dashes, and periods. 请更改映像定义名称,然后重试。Change the image definition name and try again.

创建映像定义所需的属性未填充。The mandatory properties for creating an image definition are not populated.

名称、发布者、套餐、sku 和 OS 类型等属性是必需的。The properties such as name, publisher, offer, sku, and OS type are mandatory. 验证是否传递所有属性。Verify if all the properties are being passed.

请确保映像定义的 OSType(Linux 或 Windows)与用于创建映像版本的源托管映像相同。Make sure that the OSType, either Linux or Windows, of the image definition is the same as the source managed image that you are using to create the image version.

无法创建映像版本Unable to create an image version

可能的原因:Possible causes:

映像版本名称无效。Image version name is invalid.

允许用于映像版本的字符为数字和句点。Allowed characters for image version are numbers and periods. 数字必须在 32 位整数范围内。Numbers must be within the range of a 32-bit integer. 格式:MajorVersion.MinorVersion.PatchFormat: MajorVersion.MinorVersion.Patch. 请更改映像版本名称,然后重试。Change the image version name and try again.

找不到要从其创建映像版本的源托管映像。Source managed image from which the image version is being created is not found.

查看源映像是否存在,以及是否与映像版本位于同一区域。Check if the source image exists and is in the same region as the image version.

托管的映像尚未预配完毕。The managed image isn't done being provisioned.

请确保源托管映像的预配状态为“成功”。Make sure the provisioning state of the source managed image is Succeeded.

目标区域列表不包含源区域。The target region list does not include the source region.

目标区域列表必须包含映像版本的源区域。The target region list must include the source region of the image version. 请确保目标区域的列表中已包含源区域。目标区域是需要通过 Azure 将映像版本复制到其中的区域。Make sure you have included the source region in the list of target regions where you want Azure to replicate your image version to.

尚未完成到所有目标区域的复制。Replication to all the target regions not completed.

请使用 --expand ReplicationStatus 标志来检查是否已完成到所有指定目标区域的复制。Use the --expand ReplicationStatus flag to check if the replication to all the specified target regions has been completed. 如果尚未完成,请等待作业完成,最长等待时间为 6 小时。If not, wait up to 6 hours for the job to complete. 如果失败,请再次运行用于创建并复制映像版本的命令。If it fails, run the command again to create and replicate the image version. 如果需要将映像版本复制到许多目标区域,可考虑分阶段进行复制。If there are a lot of target regions the image version is being replicated to, consider doing the replication in phases.

无法创建 VM 或规模集Unable to create a VM or a scale set

可能的原因:Possible causes:

尝试创建 VM 或虚拟机规模集的用户没有映像版本的读取访问权限。The user trying to create a VM or virtual machine scale set doesn't have the read access to the image version.

请联系订阅所有者,要求他们通过基于角色的访问控制 (RBAC) 授予对映像版本或父资源(例如共享映像库或映像定义)的读取访问权限。Contact the subscription owner and ask them to give read access to the image version or the parent resources (like the shared image gallery or image definition) through Role Based Access Control (RBAC).

找不到映像版本。The image version is not found.

验证你要尝试在其中创建 VM 或虚拟机规模集的区域是否已包括在映像版本目标区域的列表中。Verify that the region you are trying to create a VM or virtual machine scale in is included in the list of target regions of the image version. 如果该区域已在目标区域的列表中,则请验证复制作业是否已完成。If the region is already in the list of target regions, then verify if the replication job has been completed. 可以使用 -ReplicationStatus 标志来检查是否已完成到所有指定目标区域的复制。You can use the -ReplicationStatus flag to check if the replication to all the specified target regions has been completed.

创建 VM 或虚拟机规模集需要很长的时间。The VM or virtual machine scale set creation takes a long time.

验证你要尝试从其创建 VM 或虚拟机规模集的映像版本的 OSType 与用于创建映像版本的源托管映像的 OSType 是否相同。Verify that the OSType of the image version that you are trying to create the VM or virtual machine scale set from has the same OSType of the source managed image that you used to create the image version.

无法共享资源Unable to share resources

可以通过基于角色的访问控制 (RBAC) 启用对共享映像库、映像定义、映像版本资源的跨订阅共享。The sharing of shared image gallery, image definition, and image version resources across subscriptions is enabled using Role-Based Access Control (RBAC).

复制速度慢Replication is slow

请使用 --expand ReplicationStatus 标志来检查是否已完成到所有指定目标区域的复制。Use the --expand ReplicationStatus flag to check if the replication to all the specified target regions has been completed. 如果尚未完成,请等待作业完成,最长等待时间为 6 小时。If not, wait for up to 6 hours for the job to complete. 如果失败,请再次触发用于创建并复制映像版本的命令。If it fails, trigger the command again to create and replicate the image version. 如果需要将映像版本复制到许多目标区域,可考虑分阶段进行复制。If there are a lot of target regions the image version is being replicated to, consider doing the replication in phases.

Azure 限制和配额Azure limits and quotas

Azure 限制和配额适用于所有共享映像库、映像定义和映像版本资源。Azure limits and quotas apply to all shared image gallery, image definition, and image version resources. 请确保未超出订阅限制。Make sure you are within the limits for your subscriptions.

后续步骤Next steps

详细了解共享映像库Learn more about shared image galleries.