问题
I am new to azure and I wanted to create new windows 2012 virtual machine from the image i just created using following steps.
1) Created w2k12 virtual machine using following azure cli 2.0 cmd
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
once the virtual machine is successfully created ,RDP to the vm & ran the sysprep script to make the vm as generalized .When vm was in stopped state then i ran the following cmd to deallocate , make the vm state as generalized & verified the state of the vm is vm-genralized
az vm deallocate --resource-group Naresh-test --name W2k12-host
az vm generalize --resource-group Naresh-test --name W2k12-host
I checked the image is in my resource group
[root@Az-test-cli ~]# az image list Location Name
ProvisioningState ResourceGroup ---------- --------------------------- ------------------- --------------- centralus W2k12-Automation-host-image Succeeded NARESH-TEST
when I tried to run the az vm create using following cmd
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
I get the following error
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
I am not sure am I missing any other steps , please suggested me if we have any other guide or document for the windows virtual machine image creation and vm creation using the customized image using azure cli 2.0
回答1:
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
If you are using the image that is not sysprepped (or not correct generalize the VM) to create VM, it could cause the error, so please make sure your image is sysprepped.
More information about Generalize a Windows virtual machine, please refer to this link.
来源:https://stackoverflow.com/questions/42965752/issue-in-creating-windows-virtual-machine-from-customized-image-created-myself-u