Hello, @sns !
How do I automate the VM creation process?
You are correct, VM Image Builder would be the recommended solution for automating VM image creation when configuring security, settings, and necessary software. VM Image Builder only requires that you create a configuration that describes your image and the service takes care of the rest:
(Management when using VM Image Builder)
To create a Windows VM, you would do the following at a high level. While initially this looks like a lot of steps, most of this is initial setup, resource group configuration, and verification:
https://learn.microsoft.com/en-us/azure/virtual-machines/windows/image-builder
- Register the providers: This registers the VM Image Builder feature.
- Set variables: These will be used to store configuration settings.
- Create a resource group: This will be used to store the image configuration template artifact and the image.
- Create a user-assigned identity and set permissions for the resource group: VM Image Builder uses user-identity to inject the image in the resource group.
- Create a user-assigned managed identity and grand permissions: This allows VM Image Builder to access the storage account where the script is stored.
- Download the image configuration template: We've created a JSON configuration template that is used with the variables created above.
- Create the image: Submit the image configuration to the VM Image Builder service.
- Start the image build: Starts the image-building process.
- Create the VM: Creates the VM.
- Verify the customization: RDP to the VM to verify the customization.
Additional reading:
- Azure VM Image Builder overview
- Azure blog: Streamline your custom image building process with Azure VM Image Builder service
- Use infrastructure automation tools with virtual machines in Azure
I hope this has been helpful! Your feedback is important so please take a moment to accept answers.
If you still have questions, please let us know what is needed in the comments so the question can be answered. Thank you for helping to improve Microsoft Q&A!