Ich habe ein Bild in Azure gespeichert, das ich mehrere VMs aus spin. Ich habe eine Vorlage erstellt, die die notwendigen Ressourcen für mich schafft und alle erfolgreich sind, außer der VM-Erstellung.Erstellen von Azure-VM aus benutzerdefiniertem Image
CreateOption.FromImage Mit läuft der Einsatz für etwa 40 Minuten, bis ich den Fehler:
'OS Provisioning for VM 'vmName' 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
Ändern CreateOption.FromImage
zu CreateOption.Attach
gibt mir die folgende Fehlermeldung sofort:
Cannot attach an existing OS disk if the VM is created from a platform or user image.
Was ich bin versuchen, durch die Vorlage zu erreichen:
- Punkt zu master im Alte
- Versorgung gewünschtes Ziel für eine Kopie des Master-
- Kopieren Sie das Master-Image auf das Ziel
- Erstellen Sie die VM
- Bringen Sie die Kopie an die VM
Unten ist der VM Teil die Vorlage ich verwende zu implementieren:
{
"apiVersion": "2015-06-15",
"type": "Microsoft.Compute/virtualMachines",
"name": "[parameters('vmName')]",
"location": "[resourceGroup().location]",
"tags": {
"displayName": "VirtualMachine"
},
"dependsOn": [
"[concat('Microsoft.Network/networkInterfaces/', parameters('nicName'))]"
],
"properties": {
"osProfile": {
"computerName": "[parameters('vmName')]",
"adminUsername": "[parameters('adminUsername')]",
"adminPassword": "[parameters('adminPassword')]"
},
"hardwareProfile": {
"vmSize": "[variables('vmSize')]"
},
"storageProfile": {
"osDisk": {
"name": "[parameters('OSDiskName')]",
"osType": "windows",
"caching": "ReadWrite",
"createOption": "FromImage",
"image": {
"uri": "[concat('https://', parameters('storageAccountName'), '.blob.core.windows.net/', parameters('sourceStorageContainerName'), '/', parameters('sourceVHDName'), '.vhd')]"
},
"vhd": {
"uri": "[concat('https://', parameters('storageAccountName'), '.blob.core.windows.net/', parameters('vhdStorageContainerName'), '/', parameters('OSDiskName'), '.vhd')]"
}
}
},
"networkProfile": {
"networkInterfaces": [
{
"id": "[resourceId('Microsoft.Network/networkInterfaces', parameters('nicName'))]"
}
]
}
}
}
überprüfen Sie, ob Ihr Image systepped ist? –
+1 für Fred Han. Windows-Images müssen syspreped sein und Linux-Images müssen deprovisioned sein, um ordnungsgemäß zu booten. –