Missing Azure Resource Manager Configuration
Azure Resource Manager is my preferred method for deploying Azure infrastructure.
I’ve found that sometimes the resource configuration I would like to set isn’t visible in the ARM definition using my normal approaches.
This post will cover the methods I have been using up to this point, as well as a new method I’ve just learned.
I have an Azure Front Door configured with these two routing rules.
Now, I want to create an ARM template to automate it’s creation.
The Usual Suspects
1. Azure Portal - Export Template
The strategy in this case is to manually create the resource via the Azure portal, then to use the “Export template” menu option to view the template contents.
Exporting the template generates the following routingRules configuration.
httpToHttpsRedirect has gone missing! We’ve gone from two rules to one.
apiVersion in this case, was
2018-08-01 - not shown, but more on this later.
2. Azure Resource Explorer
This is a site that Microsoft provides to navigate through all your Azure resources, and displays the JSON configuration as you go.
You can either navigate to your resource using the tree on the left, or the search box at the top - the search is a good option.
Sadly, same results as above.
3. Azure Quickstart Templates
This repo contains all currently available Azure Resource Manager templates contributed by the community.
This is usually a good starting point also, but I find that sometimes the templates can be a bit outdated.
You can tell this by looking at the
$schema JSON property listed at the top, or more specifically at the resource level, by looking at the
apiVersion property of the resource you want to create.
Some resource settings are only available on more recent
If anything, it should at least give you a clue and point you in the right direction.
but, sometimes there just isn’t a quickstart example template for what you want to do.
The New Strategy
To do this, you need to install Azure PowerShell
Once you’ve installed Azure Powershell - grab the
id for the resource you want to find.
You could build it yourself, but I find it easier to just copy it from Resource Explorer (no. 2 above)
Update the value for
$TheResourceId in the code snippet below with your
Then paste the code into a PowerShell window, and run it.
The first thing you’ll see, is an output message in PowerShell directing you to use a browser, and navigate to a page.
Once the page opens, enter the code provided in the PowerShell output message.
Follow the login prompts, and when you’re done, you should see the following.
If you now return to your PowerShell window, the commands should have finished - and will have copied the output into your clipboard.
Open your favourite text editor and paste the contents of your clipboard.
It will output a lot of information, but right at the bottom you will see the ARM template definition.
I’ve removed some sensitive information, but you can clearly see that I now have both routing rules.
Also, helpful to know - if you look further up the output, you can find the currently supported
locations for each resource.
Alright, that’s about it from me - good luck.
Since publishing this post, I’ve also discovered that you can dig throught the actual JSON definition files published on GitHub.
For instance, the current Front Door ARM JSON definition can be seen here