If you’ve worked with Azure and prefer not to spend time creating resources through the Azure Portal or writing an ARM, Bicep, or Terraform template, there’s good news. Microsoft has simplified the process of exporting resources directly from the Azure Portal. Here’s how you can easily export ARM templates:

Export templates via Azure Portal

Assuming the fact that you have been tasked to provide the dev team with the resource structure from an Azure Resource Group to deploy them to another subscription for testing purposes, you decide to try to export the templates via the Azure Portal.

The steps to achieve this task are:

  • Sign in to Azure Portal – https://portal.azure.com
  • Go to the resource group that contains the necessary resources for exporting the template.
  • In the Azure resource group, navigate to Automation and select Export template from the left-hand blade.

In the Export template section, you will see three options available to export resources from the resource group: ARM Template, Bicep and Terraform (AzureRM and AzAPI)

ARM Template

Azure Resource Manager (ARM) templates are JSON files that define the infrastructure for your Azure deployment, allowing you to manage Azure resources programmatically.

After selecting the ARM Template, you will need to wait for it to load, and the Download button will become active.

Bicep Template

A Bicep template is a domain-specific language for defining and deploying Azure resources as an alternative to ARM templates.

After selecting the Bicep Template, you will need to wait for it to load; the Download button will then become active.

Terraform Template

Using Terraform, you can create Infrastructure as Code (IaC) templates for deploying resources on Azure. These templates are clear and easy to read, allowing for consistent building and configuration of Azure resources.

The first time you export your resources in a Terraform template, you might encounter the error below. It’s not something you’ve done wrong; it’s simply that you need to register the resource provider ‘Microsoft.AzureTerraform’ on the subscription where your resource group is located.

To overcome this error and proceed with the export, you will have to follow the steps below:

In the Azure portal, select “Subscriptions” from the menu.

On the left-hand side of the blade, select Settings > Resource Providers.

Find the resource provider ‘Microsoft.AzureTerraform‘, select it, and tap the Register button, as shown in the image below.

A few minutes later, the provider will be marked as Registered. Once this status is visible, you can return to the resource group and export its resources to an Azure Terraform template file.

Here, you can download the Terraform template by selecting either AzureRM or AzAPI as the provider.

AzureRM is a good option for those who prioritise resilience and streamlined configuration management;

on the other hand, AzAPI provides lightweight access to the latest Azure features through a wrapper around Azure APIs.

Summary

In this short blog, I shared tips for exporting ARM templates directly from the Microsoft Azure Portal, eliminating the need for manual builds or complex scripting with ARM, Bicep, or Terraform.

Share This