Skip to main content
  1. Posts/

ARM - Part 2: Azure Quickstart Templates

·528 words·3 mins
Chris Ayers
Author
Chris Ayers
I am a father, nerd, gamer, and speaker.

Time to Dive in
#

I’m one of those guys that likes to learn by doing. Reading the documentation is great, and I do that a lot. But for me to really grok something, I need to play with it, run it, and probably blow it up.

If you missed part 1, read along and come back. I need a WebApp setup for my sample project. I realized I can do it a few ways. Some of the ways are very manual, some are repeatable, but one stood out to me.

  • Create the resources in the Azure Portal
  • Create the resources in Visual Studio when I right-click Publish
  • Create the resources via a Powershell script
  • Create the resources via the Azure CLI
  • Create an ARM Template, create the resources on deploy, or via the CLI

Let’s Write an ARM Template
#

I know what I want to do, write an ARM Template. Do I have any idea what I’m doing or where to start at this point? No. Fortunately for me, Microsoft provides a BUNCH of resources to get you started. There is an entire searchable quickstart page with examples (backed by a GitHub repository) as well the Microsoft Docs on ARM Templates.

Well, I found one in the quickstart: https://learn.microsoft.com/en-us/azure/app-service/quickstart-arm-template?pivots=platform-windows. From this quickstart, I can click Deploy to Azure, fill out some information and I’ve got an App Service Plan and a Web App. This is so cool. Now to tear this thing apart and figure out what it is.

OK, Lets play with an ARM Template
#

In the GitHub repository it looks like there are 2 or 3 files that make up the ARM Template.

Dissection
#

Lets dissect azuredeploy.json. Schema, version, blah…

Parameters
#

My eye is drawn to the Parameters section. I recognize some of these from when I deployed to Azure. Getting a feel for parameters I see you can have metadata describing them, types, lengths, and default values. This gives me lots of ideas and options.

Variables
#

This isn’t your mama’s json. That looks like a function to me! Looks like somebody got their code in my json. I like it. A quick google later and I see a huge list of template functions in Microsoft’s documentation. I’ll come back to that. In the mean time, those variables look a lot like the name of the webapp and AppServicePlan. I can work with this.

Resources
#

Meat and potatoes. Jackpot. This looks like where the resources are defined. Only a few properties on each, an apiVer, type, name, location, sku, and a few others. I also notice one has a “dependsOn” property, I bet I can build up what depends on what and it will do everything in the right order.

Next Steps
#

I’ve got an ARM Template now that works. I’ve poked at it a little. Time to make this thing fly. Lets setup an Azure repository on DevOps and see about trying to deploy this thing and create my webapp on release. I want to be able to check in a change and have it create/update my resources in azure. Next time, we start the feedback loop.

Related

ARM - Part 1: Azure Resource Manager

The Journey Begins # I’ve been an azure developer for years. Originally I worked with “Classic Mode” and Cloud Services. Then I moved to ARM and Web Apps. Lately I’ve been doing DevOps but I only recently started working with ARM Termplates. First, let’s dive into a little history. History # Azure has grown and changed since it was first introduced. Originally, it was a research project called, “Project Red Dog”. Azure has been commercially available since 2010. For four years, there was a limited way to interact with Azure, ASM the Azure Service Manager.