Creating a virtual machine template in Azure is pretty quick and easy process. Before we jump in to the process let me warn you about the Virtual machine that we are choosing to create a template. You must not choose a production Virtual machine to capture a template. The capturing process will break the generalised Virtual machine and it will not boot again.
- The 1st step in the process is generalizing the Virtual machine by running the Sysprep.exe (Run the sysprep.exe as Administrator) from below mentioned location and In System Cleanup Action, select Enter System Out-of-Box Experience (OOBE) and make sure that Generalize is checked. In Shutdown Options, select Shutdown.Click OK to shutdown the Virtual machine.
2. Once the server is shutdown you will see the Virtual Machine as below.
- Once the VM is shutdown click on the Stop button to deallocate the Virtual Machine completely. Then click on the Capture button to initiate the template creation process.
A deallocated Virtual Machine will show as below. The deallocated vm will not have a public IP Assigned.
3. On the next screen you can assign a Name for the Virtual Machine image and then select a Resource Group from an existing list or create a new group. Then if you wish to automatically delete the virtual machine after creating the image make sure you select the check box.
4. Once the image has been captured you can see the captured template under the resource group that you have selected during the capture process.
5. Now you have a working template available. Click on the template and you will get option called Create VM to create a new VM out of it. From there onwards the options are similar to the OS deployment you usually perform on the Azure.
That’s it if you have any questions or comments please write below.