Unable to create new AzureVM using image captured with PowerShell

I am unable to create new Azure VMs using the images I captured via PowerShell.

Here is the situation I am in.

  • I am creating two Windows VMs "mydevbox1" and "mydevbox2" using the latest Windows Server 2012 R2 image in the Azure Gallery
  • I install the required software and configure as the same
  • 3a. I grabbed an image of mydevbox1 called mydevbox1-image-PS using the powershell script below.
  • 3b. I captured a mydevbox2 image called mydevbox2-image-Manual using a manual / portal process (sysprep -> capture image) (of course I am doing this from a separate vm).
  • 4. When I try to create a new vm using mydevbox1-image-PS created with powershell, the virtual machine creation process fails (initialization timeout)
  • 4b. When I try to create a new vm using mydevbox2-image-Manual, created in a manual process, the virtual machine creation is successful.

Please, help.

PowerShell script I am using image capture

Save-AzureVMImage –ServiceName $serviceName_toCapture –Name $vmName_toCapture –ImageName $imageName_Captured_Generalized –OSState "Generalized" -ImageLabel $imageLabel_Captured_Generalized -Verbose

      

+3


source to share


1 answer


It fails because you didn't run sysprep before saving the image. The powershell cmdlet won't do this for you. -OSState only stores the reference that the image has been generalized or specialized. Details in this blog post:

VM Image PowerShell 'How to Send a Blog Post



http://azure.microsoft.com/blog/2014/05/01/vm-image-powershell-how-to-blog-post/

0


source







All Articles