(This blog post originally appeared on Cooper’s Cloud.)
Getting Started with ARM Templates
I’ve spent a considerable amount of time developing ARM Templates and have been working to put together a series of posts to help you master ARM Templates, whether you’re just getting started with Azure or have been developing ARM Templates since their inception. Beyond simplifying your deployments, you can learn so much about Azure’s inner workings and more complex features through ARM Template development.
ARM Templates are Azure’s built-in infrastructure-as-code (IAC) toolset. This means that I can create or modify resources within Azure (Virtual Machines, Virtual Networks, etc.) by creating a configuration file and letting Azure handle the provisioning. ARM Templates enable you to create consistent and repeatable deployments within your Azure environment.
ARM Templates Basics
The Azure team has provided a public GitHub repository with a number of reference ARM Templates to get you started. This is where I always start when developing a new template.
VS Code is a light-weight editor that’s perfect for developing ARM Templates. VS Code has built-in integrations with This is my recommended tool for a large majority of your ARM Templating needs, and one of my favorite features is the ability to auto-format JSON!
Visual Studio has built-in auto-formatting and some other great features for helping develop and deploy complex ARM Templates. Using Visual Studio can be overwhelming for getting started but I will provide plenty of information and resources about Visual Studio in the coming weeks.
Armviz is a browser-based ARM Template development tool. Armviz has a fairly decent feature that allows you to generate a design view of the Azure resources inside your template. Big catch for this tool, its a Public project hosted on GitHub that hasn’t been updated in a couple years. I’ll use this tool for quick and simple templates sometimes, but don’t recommend it for every day use.
Using a version control service is the recommended method of storing ARM Template code. If you don’t have much of a development background these tools can take some getting used to, so I wouldn’t worry about them too much when getting started.
Azure Portal resource deployment – within Azure you’re able to perform a one-time deployment of an ARM Template by creating a new resource “Template deployment”.
PowerShell – the AzureRM PowerShell modules have a “New-AzureRMResourceGroupDeployment” command to deploy templates.
Templates Blade – the Azure Portal has a “Templates” blade that allows you to store your templates within Azure and easily deploy.
Visual Studio – one of the value propositions for using Visual Studio to develop ARM Templates is the ability to deploy your template directly to Azure.
Deploy to Azure – azuredeploy.net is a great tool to easily deploy ARM Templates from a public GitHub repository to your Azure environment. Azuredeploy.net cannot be used for Private GH repositories.
First ARM Template
We’ll start with an ARM Template that creates a new VNet with 2 Subnets.
To start, log into Azure and then browse to the following link:
Deploy to Azure
Click the Blue “Deploy to Azure button” provided in the GitHub link.
- Directory and Subscription should refer to your Azure account information. This will be auto-populated since you’re already logged in.
- Resource Group – you may choose to use an existing Resource Group, or “Create New” and provide a “Resource Group Name” if you don’t already have one in your subscription.
- Virtual Network name – this is auto-populated using then “Default Value” in our template, seen here:
After filling out the settings, click “Next”
After the deployment has completed, click the “Manage” link or open your Azure Portal.
Review Deployment in Azure Portal
Our Virtual Network has successfully been deployed to Azure. It contains the two subnets that our template defined, along with the proper network address spaces.
Stay tuned for Episode 2 of “Mastering ARM Templates” and check out AHEAD’s 2018 Azure Innovation Days series below to see if the tour is coming to a city near you!