Introduction to Azure Resource Manager
Template Deployment & Advanced Concepts
The course is part of these learning pathsSee 7 more
During this lecture, we will briefly review the high-level process for authoring Azure Resource Manager (ARM) JSON Templates. Typically, you will look at an example declaration of a particular Resource Type (eg. Virtual Network or Virtual Machine) in the Azure Quickstart Templates repository on GitHub, and then cut and paste that component into your own, custom template.
Hello and welcome to Microsoft Azure Resource Manager authoring ARM JSON templates. In this lecture, we're going to explore the ARM JSON template authoring process.
The first thing you'll want to do before you start authoring an ARM JSON template is to determine your Cloud architecture. Your application may consist of infrastructure service resources like virtual networks and virtual machines or your application may be more PAAS focused where you have services such as read as cache, app service, SQL database, and many other platform services to support your application. So you'll want to diagram your architecture before you start writing the template. Once you're prepared to start writing a JSON template, simply create a new JSON file using your text editor of choice. You can use tools such as Visual Studio Code, the Adam Editor from GitHub or the Full Visual Studio IDE on the Windows platform.
Once you've created your JSON file, you'll want to copy and paste a template from the Azure Quick Start templates page to get the basic framework of your Azure Resource Manager template in place. Once you've gotten the basic structure in place, including the schema and parameters and resources and outputs and variables sections defined, you'll want to go ahead and find other templates that define the types of resources that you need to deploy based on your Cloud architecture that you started with. You'll copy and paste these into your JSON template file and fill out the properties for them as appropriate. So you can use variables or you can hard code values into your ARM JSON template and define those properties on your objects. Once you've defined all of the different resources such as virtual machines or read as caches or SQL databases or web applications, you'll want to connect to the dependent resources together.
The Azure Resource Manager API does parallel deployment so you can deploy a web application and a SQL database at the same time. However, if there is a dependency on one or the other resource, you can define that using the depends on property. That helps to instruct the Azure Resource Manager API that it needs to deploy the dependency prior to deploying the item that depends on it. Next you'll want to add any input parameters to your Azure JSON template file. So if you want to variabilize the deployment of that JSON template, simply declare input parameters and then reference those input parameters inside of your JSON template.
The final step is to deploy your Azure Resource Manager template. So let's take an example diagram such as this where we have a virtual network, a single subnet, an availability set containing two Azure virtual machines with their own network interfaces. We also have a load balancer that has an internal nick as well as a public nick with a public IP address bounced to it. On the back end, to support the virtual machines, we have a storage account that will contain the VHD blobs or the virtual hard disk files that the virtual machines use to boot. So we'll go ahead and look at the process in our demonstration of how we would build this, our infrastructure, using ARM JSON templates.
About the Author
Trevor Sullivan is a Microsoft MVP for Windows PowerShell, and enjoys working with cloud and automation technologies. As a strong, vocal veteran of the Microsoft-centric IT field since 2004, Trevor has developed open source projects, provided significant amounts of product feedback, authored a large variety of training resources, and presented at IT functions including worldwide user groups and conferences.