Clone Windows Azure Virtual Machine – Unable To Capture Image:“Endpoint Not found: There was no endpoint listening at…” Workaround

Background

Having recently begun the process of migrating some of our backend activities from Amazon AWS EC2 to Windows Azure, I began looking for how to create a base machine image to be used to create new Virtual Machines within Windows Azure.

I found several blog posts, including this and this, explaining how to perform this task, utilising the capture functionality built into the Windows Azure management portal. This process is as follows:

  1. When the existing machine is in the state you wish to preserve to create clones, if it is a Windows VM, run the Sysprep tool. When you run Sysprep (%windir%\system32\sysprep), select the “Generalise” option to ensure that each clone you create will have its own unique Security ID. If it is a Linux VM, you need to use the Windows Azure Linux Agent.

  2. After the Sysprep has completed, locate the VM in the Azure Management Portal, and with the VM selected, click the Capture button, on the toolbar at the bottom of the screen. This will launch a wizard which will allow you to enter your desired name for the Image, and a checkbox confirming that you have already run Sysprep aginst the machine.

  3. However, when you click the tick button, an error occurs.

Problem

The problem which occurs on attempting to capture the machine, is shown in the status bar at the bottom of the Management Portal and is as follows:

Endpoint Not found: There was no endpoint listening at https://management.core.windows.net:8443/4321d1e8-da89-46f6-a36f-879c82a4321f/services/hostedservices/myvm/deployments/myvm/roleInstances/myvm/Operations that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details.

This error occurred for me, no matter how many times I attempted the capture process and it left me stuck until I located a workaround posted in the Windows Azure support forums.

Solution

The steps detailed within the above forum post, as a workaround are as follows:

  1. Run Sysprep (%windir%\system32\sysprep) or the Linux Agent as determined the OS within the VM to be cloned.

  2. Locate the Virtual Machine within the Management Portal and select it to open the Dashboard screen. Within the Disks section, write down the Name and VHD URL of the disk.

  3. Still on the VM Dashboard screen, click the Delete button, to delete the VM. This action will notdelete the VHD that you are attempting to clone.

  4. Back on the Virtual Machines section of the Management Portal, click on the Disks tab, locate the disk that you wrote down in step 2 and click Delete Disk on the toolbar at the bottom of the screen. This does not delete the VHD data, it just un-registers it as a disk.

  5. Switch to the Images tab of the Virtual Machines section of the Management portal and click the Create Image button on the toolbar. On the dialog box that pops up, browse to the location of the VHD that you wrote down in step 2, select Windows or Linux as the OS as appropriate and check the box to confirm that you have already run Sysprep.

  6. Once that has completed successfully, you can create a new VM, select the From Gallery option, and the image should be located within the My Images section.

Hopefully, Microsoft will eventually fix the bug in the Management Portal that is causing this bug, but until then, this is a method that should work.