title: How can I add an azure function to an API Management using ARM template
body: <p>I'm using this ARM template to add an external Azure function (already defined in other template) to my API management but I get a validation error (resource is not defined in template). Is there any solution to automate mapping azure function with an API management? </p>
  
  <pre><code>{
  "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
  "contentVersion": "1.0.0.0",
  "parameters": {...},
  "resources": [
  
      {
          "apiVersion": "2017-03-01",
          "name": "[parameters('apiManagementServiceName')]",
          "type": "Microsoft.ApiManagement/service",
          "location": "[parameters('location')]",
          "tags": {},
          "sku": {
              "name": "[parameters('sku')]",
              "capacity": "[parameters('skuCount')]"
          },
          "properties": {
              "publisherEmail": "[parameters('publisherEmail')]",
              "publisherName": "[parameters('publisherName')]"
          }
      },
      {
          "type": "Microsoft.ApiManagement/service/apis",
          "apiVersion": "2018-06-01-preview",
          "name": "[concat(parameters('apiManagementServiceName'), '/', parameters('indexerApp'))]",
          "dependsOn": [
              "[resourceId('Microsoft.ApiManagement/service', parameters('apiManagementServiceName'))]",
              "[resourceId(resourceGroup().name, 'Microsoft.Web/sites', parameters('indexerApp'))]"
          ],
          "properties": {
              "displayName": "[parameters('indexerApp')]",
              "apiRevision": "1",
              "description": "Import from \"[parameters('indexerApp')]\" Function App",
              "path": "[parameters('indexerApp')]",
              "protocols": [
                  "https"
              ]
          }
      }
  ]
  </code></pre>
  
  <p>}</p>