1

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:

  1. Punkt zu master im Alte
  2. Versorgung gewünschtes Ziel für eine Kopie des Master-
  3. Kopieren Sie das Master-Image auf das Ziel
  4. Erstellen Sie die VM
  5. 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'))]" 
     } 
     ] 
    } 
    } 
} 
+0

überprüfen Sie, ob Ihr Image systepped ist? –

+0

+1 für Fred Han. Windows-Images müssen syspreped sein und Linux-Images müssen deprovisioned sein, um ordnungsgemäß zu booten. –

Antwort

2

'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

Wenn Sie ein Image verwenden, das nicht zum Erstellen einer VM sysprep ist, kann dies zu einem Fehler führen. Stellen Sie daher sicher, dass Ihr Image systepped ist.

enter image description here

Cannot attach an existing OS disk if the VM is created from a platform or user image.

Wenn Sie Create angeben anhängen (es wird eine virtuelle Maschine von einem spezialisierten Platte erstellen), geben Sie nicht den SourceImageUri Parameter. Weitere Informationen finden Sie unter "-CreateOption" unter this documentation.

Verwandte Themen