We're trying to create a template Windows 2012 R2 image for a virtual machine in Azure. Our goal is to clone it into several instances. Unfortunately, we aren't able to connect via RDP to any of the cloned images.

To narrow down a test, I've done these steps:

  1. Create the instance in the portal. (old portal)
  2. Use RDP to connect to the image.
  3. To keep my test simple, I'm creating a sample directory called C:\ImageTest.
  4. Run SysPrep.
  5. Inside the (old) Azure Portal, run capture on the machine image.

Those steps create an image and I am able to select the image when creating the next instance.

  1. For my test, I'm shutting down the first (base) instance. I've also tried leaving it running.
  2. Then we create another cloned instance from the image created in step 5.
  3. Wait for it to start up.

The new image appears as running in the portal - but we are unable to connect via RDP to the new image. We receive this error:

enter image description here

Additional troubleshooting steps we've tried:

A. Verified the RDP endpoint for the new instance. I've also removed and recreated the RDP endpoint for the new instance. Same message.

B. This article mentions a sysprep bug where the virtual machine may restart before the image capture, invalidating the image. But the workaround doesn't change anything for me. I've also tried every combination of options in SysPrep such as Reboot, Shutdown, Quit.

C. I've been trying to figure out how to do this in the new Azure portal, but so far (Oct 2015), I don't see an option to capture an image.

D. I've tried waiting a long time (days) for the new image to start up, just in case it needed more time.

My goal is to just set up a base image with 80% of our normal configuration, so we can easily create instances within a load balanced set. Am I missing an easier way to do this?

Thank you for any ideas or tips.

  • What exact command did you run to Sysprep? To troubleshoot locally, you can download the VHD and try to boot it locally using Hyper-V.
    – proteus
    Oct 5, 2015 at 22:28
  • Out-of-Box Experience + Generalize. And I've tried each of the shutdown options... all give the same result.
    – Ender2050
    Oct 6, 2015 at 1:15

1 Answer 1


I think the best way to create an image is to use Powershell, the command is easy and straight forward:

Save-AzureVMImage -ServiceName "service-name" -Name "VM-name" -ImageName "image-name" -Osstate "Generalized/Specialized" -Verbose

Be careful about the Osstate option, if you want to create a template, you can choose Generalized, it will delete the existing vm and create a template image. If you want to create a snapshot image, you can choose Specialized, it will keep the existing vm and create an image -- it's just like the checkpoint in Hyper-V.

Besides, I also found one link to tell you how to use portal to capture azure image, but I'm not sure whether it is working for the old azure portal.

  • Trying this - I'll write back when I get it working. Thank you so much.
    – Ender2050
    Oct 6, 2015 at 2:04
  • This solution works. What I've learned is - use PowerShell instead of the portals. I'm coming from EC2-land where creating AMIs is so easy - so this took some adjustment. Thanks again.
    – Ender2050
    Oct 8, 2015 at 14:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.