title: How to output resources created in a loop
body: <p>I'm creating 1 or more public IP addresses in Azure using an arm template. The number of addresses depends on a parameter provided by a user.</p>
  
  <p>I'm using the following code snippet to do so</p>
  
  <pre><code>"resources": [
    {
      "type": "Microsoft.Network/publicIPAddresses",
      "name": "[concat(parameters('publicIPAddressesName'), '-', copyIndex())]",
      "apiVersion": "2017-10-01",
      "location": "[parameters('location')]",
      "copy": {
        "name": "publicIPAddressesCopy",
        "count": "[parameters('publicIPAddressesCount')]"
      },
      "properties": {
        "publicIPAddressVersion": "IPv4",
        "publicIPAllocationMethod": "Static",
        "idleTimeoutInMinutes": 4
      }
    },
    ...
  ],
  </code></pre>
  
  <p>I'm able to output a couple of IP addresses using the following code snippet</p>
  
  <pre><code>"outputs": {
    "publicIPs": {
      "type": "object",
      "value": {
        "VM-1": {
          "publicIP": "[reference(resourceId('Microsoft.Network/publicIPAddresses', concat(parameters('publicIPAddressesName'), '-1')), '2017-10-01').ipAddress]"
        },
        "VM-2": {
          "publicIP": "[reference(resourceId('Microsoft.Network/publicIPAddresses', concat(parameters('publicIPAddressesName'), '-2')), '2017-10-01').ipAddress]"
        },
      }
    }
  }
  </code></pre>
  
  <p>This is not very useful since there can be less or more than 2 new public IP addresses. The issue is that I'm not able to use a loop in the outputs section of the template.</p>
  
  <p>How can I output all the created public IP addresses, knowing their number will change between each template run?</p>