2

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?

David Makogon
  • 69,407
  • 21
  • 141
  • 189
Erick T
  • 7,009
  • 9
  • 50
  • 85
  • It appears that the options at [portal.azure.com](https://portal.azure.com/) have changed. It is now possible to export templates from individual deployments within a resource group. See [Ryan's Answer](http://stackoverflow.com/a/36270305/2410539) below. – Ryan Mar 28 '16 at 20:14

4 Answers4

7

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.

Michael B
  • 11,887
  • 6
  • 38
  • 74
  • Thanks for the excellent information Michael. It makes sense that the runtime configuration wouldn't match the template, but I was mainly using it as a starting point – Erick T Nov 28 '15 at 18:40
3

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

Vassili Altynikov
  • 2,049
  • 2
  • 17
  • 24
  • Thanks Vassilli, that looks like it will work. I hope they add the ability to get the JSON via PowerShell at some point, as it makes customizing resource groups much easier. – Erick T Nov 28 '15 at 07:46
1

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.

Tim Wieman
  • 170
  • 6
1

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.

Ryan
  • 121
  • 1
  • 6