Create Linux Custom Image – Azure Resource Manager
To see Create Windows Custom Image on Azure Resource Manager – Follow this link
This post will show you how to create Custom Image on Azure new portal also known as Azure Resource Manager portal (https://portal.azure.com), this post focuses on creating Linux Image that can be used to deploy multiple VMs in the future using template based deployment.
- First Deploy the Virtual Machine from Microsoft gallery and then login to it using SSH. The VM will require a Public IP Address.
2. Once done, then execute below command –
sudo waagent -deprovision+user
This command will do the following –
- Delete all SSH host keypair from this Virtual Machine
- Delete /etc/resolv.conf file
- Disables Root password
- Purges the DHCP cache
- Stops the Azure Agent
This is similar to running sysprep on the Windows Machine.
3. Now, Stop the Azure VM by running below command
4. Now you need to Generalize the Virtual Machine.
Please note that Generalied VMs can’t be started.
5. Once VM is generalized, Save the Image in a Storage Account by running command shown below, which also generates JSON file that can be used in the ARM template for future deployments.
6. JSON File. The Image URI shown in Green border can be used in your Image Deployments as source Image.