我是azure的新手,我想使用以下步骤从刚刚创建的图像创建新的Windows 2012虚拟机。
1)使用以下azure cli 2.0 cmd
创建w2k12虚拟机az vm create -n W2k12-host -g Naresh-test --image MicrosoftWindowsServer:WindowsServer中:2012年R2-数据中心:最新 --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到vm&运行sysprep脚本使vm成为通用。当vm处于停止状态时,我运行以下cmd来解除分配,使vm状态为通用&验证了vm的状态是vm-genralized
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图像列表位置名称
ProvisioningState ResourceGroup ---------- --------------------------- ------------- ------ --------------- centralus W2k12-Automation-host-image成功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 默认--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虚拟机图像和vm,请建议我
答案 0 :(得分:0)
VM的操作系统配置'测试-w2k12'没有完成分配 时间。但是,检测到VM guest虚拟机代理正在运行。这表明 客户操作系统尚未做好充分准备以用作虚拟机映像
如果您使用的是未编译的图像(或不正确地概括VM )来创建VM,则可能会导致错误,因此请确保您的图像是sysprepped。
有关概括Windows虚拟机的详细信息,请参阅此link。