UPDATE 03/31/14: The issue that resulted in some VMs unexpectedly restarting instead of shutting down has been resolved. The normal recommended steps can be used again to run sysprep with Shutdown.
Note that using sysprep with Quit is still a viable method, but you must always remember to shutdown the VM from the portal before you capture the VM. If you restart the VM before capturing, it will not be in the correct state when captured and VMs created from the image will end up in provisioning timeout.
------------------------------
When capturing an image, the guest needs to remain shutdown for it to be captured in the correct state. If you capture a VM that has been started after sysprep has been run, the guest OS is not in the correct state. The capture operation will succeed, but VMs created from the image will fail to provision successfully, and will ultimately show statusProvisioning timed out. This is because the VM was captured when the setup state was IMAGE_STATE _UNDEPLOYABLE instead of the desired IMAGE_STATE_GENERALIZE_RESEAL_TO_OOBE (see alsohttp://technet.microsoft.com/en-us/library/cc721913(v=ws.10).aspx for description of those values).
To workaround this issue, specify Quit instead of Shutdown when running sysprep, and once sysprep completes, shutdown the VM from the Shutdown option in the Windows Azure management portal instead of from within the RDP session.
- Create a second user account that you add to the local Administrators group to use for troubleshooting if needed.
- Run Sysprep, selecting Enter System Out-of-Box Experience (OOBE) andGeneralize checked but select Quit instead of Shutdown.
Or from a command-line:
c:\windows\system32\sysprep\sysprep.exe /generalize /oobe /quit
- Wait for the C:\Windows\System32\sysprep\Sysprep_succeeded.tag file to be created before doing anything else, as that indicates sysprep completed.
- Log off from the VM, leaving it running. Do not shut it down from within the RDP session.
- Click Shutdown for the VM in the Windows Azure management portal.
- When the Status under Quick Glance on the Dashboard of the VM in the portal shows Stopped (Deallocated), then you can clickCapture at the bottom to create the image.