windows - 使用 azure CLI 2.0 从自己创建的自定义镜像创建 Windows 虚拟机时出现问题

标签 windows azure azure-virtual-machine

我是 azure 新手,我想从我刚刚使用以下步骤创建的镜像创建新的 Windows 2012 虚拟机。

1) 使用以下 azure cli 2.0 cmd 创建 w2k12 虚拟机

az vm create -n W2k12-host -g Naresh-test --image MicrosoftWindowsServer:WindowsServer:2012-R2-Datacenter:latest --vnet-name Naresh-test-vnet --subnet default --admin-username Administrator1 --admin-password R@ckware1234 --authentication-type password --storage-account nareshteststorage --use-unmanaged-disk --nsg Naresh-test-nsg

成功创建虚拟机后,RDP 到虚拟机并运行 sysprep 脚本以使虚拟机处于通用状态。当虚拟机处于停止状态时,我运行以下 cmd 来解除分配,使虚拟机状态为通用状态并经过验证虚拟机的状态是虚拟机通用的

az vm deallocate --resource-group Naresh-test --name W2k12-host

az vm generalize --resource-group Naresh-test --name W2k12-host

我检查了该图像是否在我的资源组中

[root@Az-test-cli ~]# az image list Location Name
ProvisioningState ResourceGroup ---------- --------------------------- ------------------- --------------- centralus W2k12-Automation-host-image Succeeded NARESH-TEST

当我尝试使用以下 cmd 运行 az vm create

az vm create -n Test-w2k12 -g Naresh-test --image W2k12-Automation-host-image --vnet-name Naresh-test-vnet --subnet default --admin-username Administrator1 --admin-password R@ckware1234 --authentication-type password --nsg Naresh-test-nsg --debug --verbose

我收到以下错误

At least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/arm-debug for usage details. {
  "status": "Failed",
  "error": {
    "code": "ResourceDeploymentFailure",
    "message": "The resource operation completed with terminal provisioning state 'Failed'.",
    "details": [
      {
        "code": "OSProvisioningTimedOut",
        "message": "OS Provisioning for VM 'Test-w2k12' 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:\r\n * Instructions for Windows: https://azure.microsoft.com/documentation/articles/virtual-machines-windows-upload-image/ 
      }
    ]
  }
}  Correlation ID: 2fa53bea-4aab-46d3-b989-972607754bb7

我不确定我是否遗漏了任何其他步骤,如果我们有任何其他使用 azure cli 2.0 使用自定义镜像创建 Windows 虚拟机镜像和创建虚拟机的指南或文档,请建议我

最佳答案

OS Provisioning for VM 'Test-w2k12' 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

如果您使用未经过系统准备的镜像(或未正确概括虚拟机)来创建虚拟机,则可能会导致错误,因此请确保您的镜像经过系统准备。

有关通用化 Windows 虚拟机的更多信息,请参阅此 link .

关于windows - 使用 azure CLI 2.0 从自己创建的自定义镜像创建 Windows 虚拟机时出现问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42965752/

相关文章:

windows - 有没有办法在暂停状态下启动进程?

sql - MacOS 上的 Azure PowerShell - 运行脚本文件

c# - Azure 离线同步。无法添加项目 "Query execution failed with result: ' MISMATCH'。”

azure - 将对 Azure VM 的访问锁定到特定 IP

mongodb - Azure VM 上的 MongoDb 连接超时

windows - WP CLI Shell 不适用于 Windows

c++ - 带有节点图标和不带图标的项目的 TreeView

windows - VisualC++/vmg/vms 的 G++ 等效项

asp.net - Asp .net core 1.1 网络应用程序发布到 azure 找不到资源

azure - Azure 自定义镜像 VM 上没有 Internet