Link existing function app with APIM using Azure CLI

NP 31 Reputation points
2021-01-11T18:16:31.197+00:00

Hello,

Azure Function App can be registered under (or linked with) API management in two ways:

  1. Function App -> API Management -> Link API
  2. API Management -> Add API -> Import function app.

Either options can be chosen over the portal. However, the key objective is to do the same (#1 or #2) with automation, i.e using Azure CLI.

With some discovery, looks like "az apim api import ... " would import the API with open API or swagger specification files, which doesn't meet the mentioned objective. Please provide if there are any references/samples available on executing on this requirement.

If there is no such option with Azure CLI, then the function API need to be registered as basic API (blank API) and create necessary operation. Perhaps, this would introduce more work.

Azure API Management
Azure API Management
An Azure service that provides a hybrid, multi-cloud management platform for APIs.
1,751 questions
Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
4,261 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Pramod Valavala 20,516 Reputation points Microsoft Employee
    2021-01-12T06:15:08.207+00:00

    Both options leverage ARM REST APIs to perform discovery and automate the process of importing a function app (or logic app even) into APIM. You can see the various requests made in the developer console of your browser.

    Unfortunately, the same isn't available in the CLI or PowerShell cmdlets. Please feel free to raise a feature request to include support for the same.

    The recommended way as highlighted in the Azure APIM DevOps Resource Kit is to author and maintain OpenAPI Specs + ARM Templates to automate the deployment of APIM and its sub-resources (like APIs, Products, etc.), which you could build upon for your own requirements.