How do I use a template to create VMs in Azure IaaS v2 (ARM)?

How do I use a template to create VMs in Azure IaaS v2 (ARM)?

Q. How do I use a template to create VMs in Azure IaaS v2 (ARM)?

A. Using a JSON template provides a repeatable and resumable way to create one VM or multiple VMs which can even make up a multi-tiered services. Services inside a template are deployed in parallel unless there are dependencies. The resource at the bottom of the dependency stack is deployed first and then the resources that depend on that resource and so on.

While you can create your own templates using any JSON editor, including a regular text editor or more advanced tools such as Visual Studio, the best way is to look at existing templates which are available from GitHub. The GitHub template resource (https://github.com/Azure/azure-quickstart-templates) is the library for Azure Resource Manager (ARM) templates and a better formatted version is available at http://azure.microsoft.com/en-us/documentation/templates/. A great template to start with is the 101-simple-windows-vm which deploys a single VM. Notice there are a number of files for all templates: