Azure Resource Manager (ARM) Templates
Cloud Empowerment is a topic that should be important to anyone that owns or manages Azure cloud resources, or that creates products that run in an Azure-hosted environment. Automation is crucial to success in this new world order of cloud computing whether deploying a data center infrastructure, or a new application environment for development or production.
With that in mind, I want to introduce you to an important part of Microsoft’s Azure automation story; Azure Resource Manager (ARM) Templates. ARM Templates enable you to automate the creation and maintenance of the Azure environments which host your cloud-based applications. They are easy to use, for even the most basic Azure solution – perhaps for a single Web App and storage; But they are also powerful enough to provision large and complex systems that are hosted in Azure which may include an App Service Environment (ASE), Web Apps, Storage Accounts, a Service Bus, Event Hub, etc.
Recently I’ve been consulting on a project which is hosted in a complex Azure environment. Our team managed three such environments within a single subscription – one for Development, one for QA and a third for Staging. As part of this project, one of my responsibilities was to automate the creation and maintenance of these environments. My initial path was to use PowerShell to create and provision them. Fortunately, I was shown a better way. That’s where I began to learn about ARM Templates and that they are an excellent choice for Azure automation. As I now see it, here are some compelling advantages for using this technology.
- ARM Templates are supported in the recent versions of Visual Studio. They are manifested as Visual Studio projects that typically reside in a Visual Studio solution housing your application code. A benefit of this kind of solution structure is that the definition of the Azure environment remains consistent with the project code that it hosts. When the Visual Studio solution is managed within source control, the application code and the definition of its azure environment remain in lockstep as the overall solution evolves.
- ARM Templates are declarative – you define how you want your Azure environment to look. When the template is processed, its declaration is compared with the target Azure environment. Azure resources are only created/ removed/ configured when there are differences. This is an important aspect of Templates, particularly in the situations where provisioning an Azure resource can take hours, for example with an ASE. During automation, we only want to spend time updating an Azure environment when there is really something to update!
- Templates are parameterized so that the same template can be used to generate different environments based on the input parameter values. For example, in my case, I used the same template to create Dev, QA, and Staging environments for a subscription, differentiating them only via input parameters.
ARM Templates fit nicely into automated build/deploy scenarios. If done properly, one can be assured that the Azure environment has been appropriately provisioned prior to deploying code to the cloud. With this brief introduction describing the benefits of ARM Templates, check out additional posts for details and insight into creating, managing, and executing them.