Azure中从共享镜像创建Windows VM失败求助
Azure中使用Terraform从共享镜像创建Windows VM失败排查求助
以下是用于从Azure共享镜像库创建Windows VM的Terraform代码:
resource "azurerm_virtual_machine" "vm" { name = "myvm" location = "East US" resource_group_name = "MyResGroup" vm_size = "Standard_D4as_v5" network_interface_ids = [azurerm_network_interface.nic.id] storage_image_reference { id = "/subscriptions/4a4.....673/resourceGroups/rg-vm-images/providers/Microsoft.Compute/galleries/vmsgallary/images/testvmimage" } storage_os_disk { name = "my_os_storage_disk" caching = "ReadWrite" create_option = "FromImage" managed_disk_type = "Standard_LRS" } os_profile { computer_name = "myvm" admin_username = "azureuser" admin_password = "MyComplexPassword" } os_profile_windows_config { } }
执行约40-50分钟后触发错误:
OS Provisioning for VM ‘xxx’ did not finish in the allotted time. However, the VM guest agent was detected running. This suggests the guest OS has not been properly prepared to be used as a VM image (with CreateOption=FromImage). To resolve this issue, either use the VHD as is with CreateOption=Attach or prepare it properly for use as an image:
请按照官方指引正确准备Windows或Linux镜像 删除并重新创建虚拟机可能解决该问题
共享镜像相关信息:
- 操作系统类型:Windows
- 操作系统状态:已通用化
- 镜像截图:


补充说明:使用相同代码框架(仅调整Linux相关配置项)可成功创建Linux虚拟机。
使用的工具版本:
- Terraform版本:1.3.9
- azurerm provider版本:3.46.0
内容的提问来源于stack exchange,提问作者Y Pant
相关产品推荐
相关产品推荐

