Using Azure ARM Template’s OUTPUT section

 

Extract using  the output section, the properties of various resource you deployed using an ARM Template

 

Scenario

 

You were deploying your resources using an ARM template and wanted to print out the names of some of the resources you created/deployed/updated. This could be just to make sure your deployment was executed successfully OR pipe the output into a subsequent command.

In this case I wanted to print/extract/dump the parameters for the properties related to the network, more specifically the ones that were passed as parameters to the template file. Snippet of JSON File where these parameters are defined is shown below.

 

clip_image002

 

Now in the “OUTPUTS” section, they are simply referred to by the parameters function, as shown below.

 

clip_image004

 

Executing the ARM deployment using New-AzureResourceGroupDeployment.

Note:

  1. You should execute the template deployment with New-AzureResourceGroupDeployment PS
  2. You should have created the ResourceGroup prior to the execution of New-AzureResourceGroupDeployment.
  3. If instead you used New-AzureResourceGroup instead it will execute the deployment, but will not print the outputs.

The following shows the execution of the template and the outputs, getting printed in the outputs section.

clip_image006

 

LiveJournal Tags: Azure ARM Template OUTPUT ARM Template Output