Need for speed: Facilitating the ‘export template’ feature in Microsoft Azure

When exporting a template in Microsoft Azure either using PowerShell or Azure Portal, we are creating an exported file (json and other formats as well) with all the information required to build a replica of the resources from the given resource group. The values in the json file will be related to the actual data, but it is a perfect baseline to build what we are planning to we just need to change the data inside the template and make it dynamic. For that, we can take advantage of variables, parameters, and functions that are part of the ARM templates universe.

If you are planning to start automating processes or use Visual Studio/DevOps to streamline deployments, this capability that we are going to review in just a second will help you to speed up the process to create your template.

When using the Azure Portal, click on any existent Resource Group, and click on Export template.

export template

In the new blade, we will have all the resources that comprise the current resource group in an ARM template. We can download to check the code, but also perform changes on the fly and try to deploy.

export template

If we download, a zip file will be downloaded, open it and we will have the steps to reproduce the current infrastructure in several programming languages.

We can perform the export template task using PowerShell, and the first step is to list all the Resource Group names, and then export the resources to a json file. Here are both commands, and we can also see them in action in the image below.

Get-AzureRMResourceGroup | Select ResourceGroupName
Export-AzureRMResourceGroup -ResourceGroupName <ResourceGroupName>

export template

Featured image: Shutterstock

Leave a Comment

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

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Scroll to Top