This Azure article will discuss the syntax and usage of the Export-AzResourceGroup Azure PowerShell cmdlet with examples.
Table of Contents
Export-AzResourceGroup
If you wish to save your resource group as a JSON file format template, you can use the Export-AzResourceGroup Azure PowerShell cmdlet.
Syntax:
Below is the syntax of the Export-AzResourceGroup Azure PowerShell cmdlet.
Export-AzResourceGroupExport-AzResourceGroup
-ResourceGroupName <String>Let’s discuss a few examples of the implementation.
Example-1:
You can run the below Azure PowerShell cmdlet and provide the resource group name.
Export-AzResourceGroupAfter executing the above command, it will prompt you to provide the name of your resource group.

Or, you can directly execute the below Azure PowerShell cmdlet with resourceGroup as a parameter.
Export-AzResourceGroup -ResourceGroupName "MyNewResGrp"After executing the above command, I got the below output.
PS C:\Users\Bijay> Export-AzResourceGroup -ResourceGroupName "MyNewResGrp"
Path
----
C:\Users\Bijay\MyNewResGrp.jsonYou can see the same output here

When I navigated to the above path, I found the resource group in the JSON file format.

Example-2:
You can also use the below Azure PowerShell cmdlet to export a resource that belongs to a specific resource group.
Export-AzResourceGroup -ResourceGroupName "MyNewResGrp" -Resource "/subscriptions/5f43547b-1d2d-4a3e-ace4-88d4b600d568/resourceGroups/TestGroup/providers/Microsoft.Compute/virtualMachines/TsinfoVM"Once, you will execute the above command, it will save the TsinfoVM as a JSON format in your current directory.
You may also like following the articles below
Wrapping Up
In this Azure PowerShell article, we discussed the syntax and usage of the Export-AzResourceGroup Azure PowerShell cmdlet with examples. Thanks for reading this article !!!

I am Rajkishore, and I am a Microsoft Certified IT Consultant. I have over 14 years of experience in Microsoft Azure and AWS, with good experience in Azure Functions, Storage, Virtual Machines, Logic Apps, PowerShell Commands, CLI Commands, Machine Learning, AI, Azure Cognitive Services, DevOps, etc. Not only that, I do have good real-time experience in designing and developing cloud-native data integrations on Azure or AWS, etc. I hope you will learn from these practical Azure tutorials. Read more.
