title: How to register an Azure function to an API manager through ARM template?
body: <p>I'm implementing an ARM template, which includes API manager, to automate my build prosess. However, I'm not sure how to register my azure function (these are being compiled via the build step in the pipline) to the created api manager via the arm template.</p>
  
  <p>I have started with a simple arm template that included (among other things):
  Microsoft.Web/serverfarms
  Microsoft.Web/sites
  which were later were used to deploy a precompiled azure functions (from devop git), via azure app service deploy step.</p>
  
  <p>Then I tried to add an API manger to the mix by adding:
  Microsoft.ApiManagement/service
  Microsoft.ApiManagement/service/apis</p>
  
  <p>However, now I can not figure out how to connect the api manager to include my azure functions.</p>
  
  <p>This is the part where I add my api manager:</p>
  
  <pre><code>    {
        "name": "[variables('apiManagementName')]",
        "type": "Microsoft.ApiManagement/service",
        "apiVersion": "2019-01-01",
        "tags": {},
        "properties": {
          "publisherEmail": "xxx",
          "publisherName": "xxx"
        },
        "sku": {
          "name": "Consumption"
        },
        "identity": {
          "type": "SystemAssigned"
        },
        "location": "[resourceGroup().location]"
      },
      {
        "type": "Microsoft.ApiManagement/service/apis",
        "apiVersion": "2018-06-01-preview",
        "name": "[concat(variables('apiManagementName'), '/xxx-endpoint-dev')]",
        "dependsOn": [
          "[resourceId('Microsoft.ApiManagement/service', variables('apiManagementName'))]",
          "[resourceId('Microsoft.Web/sites', variables('functionAppName'))]"
        ],
        "properties": {
          "displayName": "xxx-Endpoint-dev",
          "apiRevision": "1",
          "description": "Import from \"xxx-Endpoint-dev\" Function App",
          "path": "xxx-Endpoint-dev",
          "protocols": [
            "https"
          ]
        }
      }
  </code></pre>
  
  <p>I have tried adding the "Microsoft.ApiManagement/service/backends" s ection as described in the documentation, but couldn't make it work. I also had a look on this template : 
  <a href="https://github.com/Azure/azure-quickstart-templates/tree/master/201-api-management-create-all-resources" rel="nofollow noreferrer">https://github.com/Azure/azure-quickstart-templates/tree/master/201-api-management-create-all-resources</a> 
  but couldn't find my an answer in there either (might have missed it).</p>
  
  <p>Is there any good example of how to do it? can it even be done via the ARM template?</p>
  
  <p>Right now my template create all the resources and I can add the desired api via the portal (by adding api to my empty api manager), but I would like to automate this part as well.</p>
  
  <p>to be more precise what I'm trying to understand is how to do this:
  <a href="https://docs.microsoft.com/en-us/azure/api-management/import-function-app-as-api" rel="nofollow noreferrer">https://docs.microsoft.com/en-us/azure/api-management/import-function-app-as-api</a>
  using ARM template.</p>