2
votes

I am trying to find a way to retrieve the JSON version of an Azure Resource Group that I created in the portal. I've looked through all the PowerShell documentation, tried scraping JSON from the portal, all to no avail. There are some earlier questions that state that it isn't supported, but they are all fairly old (in terms of Azure feature release speed).

Is there any way to get the JSON for a Resource Group created in the Portal UI? Or is the template approach the only way to go?

4
It appears that the options at portal.azure.com have changed. It is now possible to export templates from individual deployments within a resource group. See Ryan's Answer below.Ryan

4 Answers

3
votes

You can use the Azure Resource Explorer to view the JSON representation of your Azure resources. The source code is also available on GitHub in case if you want to learn how it works: https://github.com/projectkudu/ARMExplorer

7
votes

While it is possible to retrieve the JSON for a resource group from the Azure Resource Explorer, there are some caveats you need to be aware of.

Resource Explorer is a tool that describes the current runtime configuration rather than the deployment configuration that a resource template does. While it is primarily the same language there are a number of subtle differences.

For instance resource explorer will tell you the IP address that is assigned to a NIC, which isn't something that is possible to assign from a template.

While they can be a good starting point for building resource templates you will need to go through them and clean out the extraneous information.

Personally my three calling points in building resource templates are

Between the three of those you can usually put together some concise, powerful templates.

There is a feedback item that is 'under review' to allow for the creation of full ARM templates from existing resource groups.

1
votes

This is now available in the Azure portal, portal.azure.com. If you browse to a resource group in the portal, under "All settings" for the resource group, there is now an "Export template" option.

1
votes

Looking at portal.azure.com as of 3/28/2016 it looks like the options have changed from some of the previous responses...

  1. Go to portal.azure.com and log in
  2. Click on "Resource Groups"
  3. Click on "All Settings"
  4. Click on "Deployments"
  5. Click on the particular resource/deployment for which you want to create a template
  6. Click on "Export Template" near the top of the tile/page.

Note: Some of the deployments may not give access to the "Export Template" button. For these, you will most likely see a "Template Link" in the resource summary which gives access to the generic template for that resource deployment.