In Azure marketplace there are many different templates available for OS deployment. These are general purpose templates. But in corporate environment administrators use custom images for their OS deployments. These images are usually fine tuned for corporate requirements. Azure also allow to do the same. In Azure we can create custom images according to our requirements and use it to deploy virtual machines.
- Log in to Azure portal.
2. Create a Virtual Machine with your OS requirements.
3. In my demo, I am using a VM with windows server 2019 datacenter.
4. In this VM, I have installed google chrome, Firefox and created a folder in C:\ called “Testing” inside that folder created a test file and name it as Test.
5. Once customization done, run %windir%\system32\sysprep\sysprep.exe as a administrator from command line. (with in VM) or we can go to that path, and we can right click and click on Run as Administrator.
6. In new window, select OOBE and Generalize option. Also, for shutdown option, select Shutdown. This will generalize the VM image.
7. Once it’s done sysprep, system shutdown the VM.
8. Go to VM properties page (click on relevant virtual machine name from VM list) and click on Capture icon.
9. In new window, provide name for image and select resource group to save the image. Also make sure to select Automatically delete this virtual machine after creating the image. Then click on Create.
We are not sharing this image to a gallery so, that’s why we selected only No, capture only a managed image option.
10. Once job is completed, go to search | and type Images. In there now we can see the image we created. We can see Image name & Source Virtual Machine Name.
11. Click on the image and go to its overview page. Then click on Create VM option.
12. Then create VM with the size and other configurations you need.
13. Once VM is created, lets log in and see if it’s got all the customization we made.
As we can see, it is done the job as expected. This marks the end of this blog post.