In this post, I want to show you how to export a Resource Group to an ARM template using the command line.

This tutorial assumes that you already have a Microsoft Azure account set up.

Azure PowerShell Workaround

If you want to know how to install the PowerShell Azure module on your machine, check out this link.

The simplest way to get started is to sign in interactively at the command line.

This cmdlet will bring up a dialog box prompting you for your email address and password associated with your Azure account.
If you have more than one subscription associated with your mail account, you can choose the default subscription. To perform this task, we will use the following commands:

With the following command in PowerShell, we obtain the list of existing resource groups in your subscription.

Get-AzureRmResourceGroup

If you need to create a new resource group, check out this link.

To export a Resource Group using Azure Powershell, you should use the Export-AzureRmResourceGroup cmdlet; this cmdlets captures the specified resource group as a template and saves it to a JSON file. Use the Export-AzureRmResourceGroupt cmdlet with the following syntax:

Export-AzureRmResourceGroup

Azure CLI Workaround

You can use it in your browser with Azure Cloud Shell or install it on your machine. If you want to know how to install the Azure CLI, check out this link.
The way to get started is to sign in interactively at the command line.

This command will bring up a dialog box prompting you for your email address and password associated with your Azure account.

If you have more than one subscription associated with your mail account, you can choose the default subscription. To perform this task, we will use the following commands:

With the following command in Azure CLI, we obtain the list of existing resource groups in your subscription.

To create a new resource group with Azure CLI, check out this link.

Using the Azure CLI, you can export a resource group within Azure as easily as typing the following command:

ARM Templates

If you want to know more about Azure Resource Manager Templates, check out this link:https://docs.microsoft.com/en-us/azure/azure-resource-manager/resource-group-authoring-templates