Capturing Image of Windows Azure Virtual Machine and creating an new Virtual Machine with the Image

In my previous post I showed how to provision a Virtual Machine in Windows Azure. The Virtual Machine was used to create a BizTalk 2010 Development environment. Now in this post I would like to go into creating an image of this Virtual Machine and then use it to create a new Virtual Machine.
An image is a virtual hard disk (VHD) file that is used as a template for creating a virtual machine. This can be useful when you want to create multiple virtual machines that are set up the same way. Another reason can be to capture the image as you do not want to use it for a while and prevent incurring costs.

Capturing a Virtual Machine


To capture a Virtual Machine you need to perform a few steps. One is to sysprep the virtual machine. For Window Server 2008 R2, like my BizTalk Development environment, I followed instructions from article "How to Capture an Image of a Virtual Machine Running Windows Server 2008 R2". After sysprepping your machine you need to capture it. Sysprepping the machine according to the article will shutdown the virtual machine and changes the status of the machine in the Management Portal to Stopped. Capturing the VM means selecting it. You will then fill some details in dialog box.
21. Capture Image
Now notice the name I gave to the image. This name was deemed invalid after I clicked check mark. The error was:

Failed to capture image BizTalk_Development of virtual machine BTS2010.
The image name is invalid.

I renamed it to BizTalkDev. It went trough and took a while before image was captured.

22. Capturing Image

That is basically it. Image is created and Virtual Machine is deleted and you’ll not be billed.

Creating a virtual machine from the Image


If you want to create a new virtual machine you can select your image from the Gallery. Steps below a similar if you create a Windows 2008 R2 machine from scratch. From My Images you will see images you have created. In my case only BizTalkDev is available.


image

Next step (2) is filling in details for the VM Configuration.

image

Following step (3) is filling in details for VM mode.

image

Last step (4) is selecting the availability set in case you require a group a virtual machine in case of outages (i.e. higher availability).

image

Click the check mark and Virtual Machine is being provisioned. This may take a while before it is up and running. When it is up and running I can connect to machine again through remote desktop. You will then run into some issues with access to SQL Server database.

Update 24-06-2012:

Post from Johan Hedberg (Fellow BizTalk MVP): "Creating a new BizTalk machine from a sysprep image in Windows Azure Virtual Machines, and making it work":

The problem when logging on to SQL Server after the name change is that you no longer have access with the administrative account, Administrator, since this is really oldmachine\administrator. So you need another administrative account, ie SYSTEM to fix your login for you.

The post will explains how to fix the problem. I myself first thought I made an error somehow. Since I installed SQL Server in mixed mode I could log into SQL Server using the sa account. I removed administator account and then added it again with sysadmin role. I could thenm fire up BizTalk administration, SQL Server and Visual Studio without a problem.

image

This way I can spin up a Virtual Machine with BizTalk when I want it and remove it when I done. I can use it to spin up a few machines in case I want to work with a team or for training purposes at a client. There can be many more useful scenario’s than the ones I mention here.

If you are experiencing problems with Virtual Machines you can ask questions in the Windows Azure Virtual Machines for Windows forum or study the online documentation.

My experience so far with Virtual Machines and the Windows Azure Portal are positive. However, there is a glitch as you can read. Virtual Macines have potential, yet there is still work to do. The User Experience (UX) with Portal is very satisfactory to me. I must say Microsoft Windows Azure team have done a good job.

Finally I also like to thank Thiago Almeida (Microsoft New Zealand) for giving me some tips that lead to this post.

Cheers,

- Steef-Jan

Labels: , ,