Introducing Azure Resource Manager Templates and Azure Resource Explorer (Preview)

One of the main things I’m looking to learn at the moment is how best to manage my Azure environment. The first rules I’ve set myself are as follows:

  • Use Azure Resource Manager where possible, as Azure Service Management is being deprecated by Microsoft
  • Think carefully about grouping Azure resources into Resource Groups based on their management life-cycle – there’s no hard and fast rule around creating Resource Groups, but try to strike a balance between granularity and complexity
  • Define and create all Azure resources from Azure Resource Manager Templates (and store these templates outside of Azure) to make the creation, recreation and modification of resources simple
  • Treat Azure management, deployment and administration as a DevOps process to gain operational efficiency
  • Version control all changes to your Azure deployment so you can rebuild your environment if the worst was to happen

Now I’m no developer and a lot of this stuff is fairly alien to me, but I’ve just started using Visual Studio 2015 RC Community integrated with GitHub to develop and my Azure Resource Manager Templates, and I have to say it was a lot simpler than I expected. I’m going to write a separate post covering this as it’s a topic in itself, so let’s get on and discuss the biggest challenge I’ve faced so far… Understanding the Azure Resource Manager Templates and what I should put in them to deploy my resources.

Azure Resource Manager Templates

Resource Manager Templates are JSON files which contain the configuration details of resources you wish to deploy into Azure. Each template file typically represents a single Resource Group and can contain the details of multiple Azure resources as required to create the desired application deployment.

Microsoft describes Resource Manager Templates as:

Azure applications typically require a combination of resources (such as a database server, database, or website) to meet the desired goals. Rather than deploying and managing each resource separately, you can create an Azure Resource Manager template that deploys and provisions all of the resources for your application in a single, coordinated operation. In the template, you define the resources that are needed for the application and specify deployment parameters to input values for different environments. The template consists of JSON and expressions which you can use to construct values for your deployment.

Each template must be formatted in accordance with the Azure Resource Manager Schema (which is used to author and validate Resource Manager Templates) and templates are uploaded to Azure through the Resource Manager Rest API either programmatically or using PowerShell.

The Azure Resource Manager Rest API consists of multiple Resource Providers. Resource providers are services that provide resources for your application, such as Web Apps, Batch, Virtual Machines, Virtual Networks, etc.

At the time of writing, the following Resource Providers are available in Azure:

  • Microsoft.ADHybridHealthService
  • Microsoft.ApiManagement
  • Microsoft.AppService
  • Microsoft.Authorization
  • Microsoft.Automation
  • Microsoft.Batch
  • Microsoft.BizTalkServices
  • Microsoft.Cache
  • Microsoft.ClassicCompute
  • Microsoft.ClassicNetwork
  • Microsoft.Compute
  • Microsoft.DataFactory
  • Microsoft.DevTestLab
  • Microsoft.DocumentDB
  • Microsoft.DomainRegistration
  • Microsoft.DynamicsLcs
  • Microsoft.EventHub
  • Microsoft.Features
  • Microsoft.KeyVault
  • Microsoft.Logic
  • Microsoft.MarketplaceOrdering
  • Microsoft.Network
  • Microsoft.NotificationHubs
  • Microsoft.OperationalInsights
  • Microsoft.Resources
  • Microsoft.Scheduler
  • Microsoft.Search
  • Microsoft.ServiceBus
  • Microsoft.Storage
  • Microsoft.StreamAnalytics
  • Microsoft.VisualStudio
  • Microsoft.Web
  • Microsoft.Web.Admin
  • NewRelic.APM
  • Sendgrid.Email
  • SuccessBricks.ClearDB
  • microsoft.classicstorage
  • microsoft.insights
  • microsoft.sql
  • microsoft.support

Each resource provider represents one or more services within the Azure product portfolio, and provides the capability to deploy and manage these services through the Resource Manager Rest API. Whether you’re deploying your applications through the Azure Portal, Azure PowerShell, or the Azure xplat-cli, these are all using the Rest API in the background.

Note that a number of the providers include the term “classic” – these are providers for services which have been ported from the deprecated Azure Service Management (ASM) implementation of Azure. Unless you require a feature which isn’t supported in ARM yet, these providers should be avoided to increase the life-cycle of your service. While it’s possible to configure ASM and ARM services to interact, I would personally try to avoid this completely.

When interacting with the Resource Providers through the Rest API, configuration is applied using the Resource Provider Templates. One of the biggest challenges I’m facing is finding documentation that clearly shows what can and should be included within my templates for each Resource Provider, so a lot of this has been done through trial and error.

While Visual Studio provides some useful starter templates, many of these are based on relatively simple deployments and don’t always include many of the optional parameters which can be defined. As such, finding these parameters can be difficult.

The azure-quickstart-templates (hosted on GitHub) is a great place to start, but what if that doesn’t have what you’re looking for or you want to include a set of configuration settings which aren’t included in the template?

An invaluable tool in my itinerary for these scenarios is the Azure Resource explorer…

Azure Resource Explorer

Like the new Portal based on ARM, Azure Resource Explorer is currently in Preview and can be found through the following URL:

https://resources.azure.com/

Like all other Azure management sites, Azure Resource Explorer is accessed using your Azure login credentials, including both Microsoft accounts and Work or School accounts.

Azure Resource Explorer (Preview) Homepage

Azure Resource Explorer provides you with an “Explorer like” experience for browsing through your Azure subscriptions, looking into providers, and viewing the JSON data associated with resources as you drill down through the various paths.

ARE Example

This ability to view the JSON data associated with a resource is invaluable as it often opens your eyes to what you can add into your Resource Manager Templates. Using the example above, an interesting segment of the JSON code for this particular VM is as follows:

 "osDisk": {
   "osType": "Windows",
   "name": "osdisk",
   "createOption": "FromImage",
   "vhd": {
     "uri": "http://<storage account>.blob.core.windows.net/vhds/osdisk0.vhd"
   },
   "caching": "ReadWrite"
 },

Some of these values were defined in my original template for this VM, while others (optional parameters for the JSON template) have been introduced in the background by the Resource Provider during creation.

By incorporating this section into your JSON template, it would be possible to start manipulating other parts of the configuration such as the location (uri) of the vhd for this VM. Similarly you could control the “caching” configuration by including this parameter.

Using these tools to define your template

So what if you want to create a template for an application, can’t find a suitable starting point in the azure-quickstart-templates, and don’t know where to start?

If you know how to define your application in the Azure Portal, why not use this to perform a “dry run” of your deployment, then use the Azure Resource Explorer to help you pull out all the JSON data you need to create or update your template?

While this may seem a little back-to-front (why not just use the Azure Portal and be done with it?), this is about planning for the future. Not only will you learn the approach necessary to manipulate your deployment template and meet your requirements, you’ll also have a repeatable process that will allow you to streamline future deployments to the Cloud and the ability to recover your environment if the worst was to happen.

Already deployed live workloads into Azure using the Portal? Then why not also use this as a quick and easy method to capture the JSON configuration for these?

After all, Microsoft can only protect you from infrastructure failures and not from user generated problems!!

And on that note, I’m off to see what I can do next… Adiós!

Kevin is a passionate and driven IT consultant with over a decade of experience in designing and implementing data centre infrastructure… he also has a passion for the coast, and loves kitesurfing!

One thought on “Introducing Azure Resource Manager Templates and Azure Resource Explorer (Preview)

  1. Nicely done.

    I need a template representing a deployment of a Citrix farm in its own resource group separated and secured by tiers. Perhaps we can discuss.

    I’ve recently run across a company with a product that queries a subscription and ‘draws’ your #AzrIaaS infrastructure in 3D-like Visio format. As visual creatures I think there could be a huge demand for this. I envision a drag-and-drop vNext of the portal at some stage.

    Also, knowing that there is no hard and fast rule how would you recommend nesting, managing, and version controlling resource groups among SMEs? Would you farm out the Network provider to the network team for example (you *can* do this with deep-level PS RBAC and some other clever little techniques)?

    I am looking for an #AzrIaaS / #ADDC perspective.

Leave a Reply

Your email address will not be published. Required fields are marked *

Protected with IP Blacklist CloudIP Blacklist Cloud