我在使用通过 Packer 创建的自定义映像创建虚拟机时遇到一些问题。
我正在使用 Packer 为 Azure 数据工厂自托管集成运行时构建映像。 我的 Packer 模板将下载软件(超过 900 MB - 这是我构建自定义映像的部分原因),然后上传 PowerShell 注册脚本以在后续 Terraform 构建期间简化注册。
图像有一些先决条件,例如:
我的 Packer 模板位于此处,变量位于此处。关键变量是:
location = "Australia East"
source_image_publisher = "MicrosoftWindowsServer"
source_image_offer = "WindowsServer"
source_image_sku = "2022-datacenter"
vm_size = "Standard_D4ls_v5"
adf_shir_msi_url = "https://download.microsoft.com/download/E/4/7/E4771905-1079-445B-8BF9-8A1A075D8A10/IntegrationRuntime_5.36.8726.3.msi"
无论如何,打包程序构建成功,但是当我尝试使用自定义映像创建虚拟机(在 Azure 门户中手动或使用 Terraform)时,它失败了。我收到的错误并没有太大帮助:
{
"code": "DeploymentFailed",
"target": "/subscriptions/ec0dc0a5-5f82-49e9-b568-1863ea08ef7b/resourceGroups/adhoc/providers/Microsoft.Resources/deployments/CreateVm-adf-shir-20240312171357",
"message": "At least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/arm-deployment-operations for usage details.",
"details": [
{
"code": "ResourceDeploymentFailure",
"target": "/subscriptions/ec0dc0a5-5f82-49e9-b568-1863ea08ef7b/resourceGroups/adhoc/providers/Microsoft.Compute/virtualMachines/test",
"message": "The resource write operation failed to complete successfully, because it reached terminal provisioning state 'Failed'."
}
]
}
只是想知道我是否做错了什么明显的事情。 FWIW 我已经从自定义映像中获得了可以运行的 Linux 虚拟机,但这是 Windows。
另一件事(也许相关)是当我使用自己的自定义映像时,我需要指定许可证类型,但我不需要为非自定义 Windows 映像执行此操作。不确定这是为什么,但可能是问题的一部分......
我设法让它在 Windows Server 2019 上运行
source_image_publisher = "MicrosoftWindowsServer"
source_image_offer = "WindowsServer"
source_image_sku = "2019-datacenter"
对于任何 Windows Server 2022 SKU 来说似乎都是一个问题,例如
2022-datacenter
、2022-datacenter-azure-edition-hotpatch
等