Programmatically Import Azure Function into APIM
I've created an Azure DevOps release pipeline to update APIM API by importing a swagger file via PowerShell. The swagger file was exported from APIM Dev instance, and the release pipeline imports it into QA APIM instance. However, backend is wrong, and there are missing keys that prevent QA APIM API from calling QA Az Function API.
It all works if I manually import the QA Az Func API into QA APIM API via APIM UI... and keys are automagically generated for Az Func & APIM.
So I need a way to setup DevOps release pipeline to deploy a QA Az Func API into a QA APIM API. I could not find any programmatic way (REST API, PowerShell, nor Az CLI) to import an Az Func API into APIM.

Thank you for the feedback! We added this suggestion to the backlog and will update the item when we prioritize it for implementation.
9 comments
-
Allan commented
This is already possible, did a little digging and it seems what is required is 3 things, first of when importing a function app or a logic app, it generates a policy automatically. In relation to Logic app this policy contains 2 unknowns, a backend-id and a sig={{var}}.
When looking into to this the backend-id could be created using the New-AzApiManagementBackend command and then referenced in the policy. Also the variable referenced within the signature reference “var” could be created using the new-AzApiManagementNamedValue command. Once these are created you should be able to create the policy in code and append to relevant api, including a swagger definition.
/A
-
Dan commented
Any update on this yet?
-
Nagaraju Ch commented
Hi Team, Any update on this functionality ?
-
Anonymous commented
Any update on this post?
-
Phil Murray commented
Any update on this functionality?
-
Rob commented
@alexei agreed - the product decisions are extremely odd. I think they're missing a technical product owner.
-
Anonymous commented
Use Import-AzApiManagementApi and provide Open API v3 spec in yml
-
Alexei Barnes commented
It's crazy that this hasn't been implemented. We're using Azure v2 Function Apps which we want to use in API Management. We've got a microservice architecture so we've got multiple function apps we'd like to put behind API Management. These services are versioned and deployed independently. Each of these services has fully automated builds and deployment from source. Surely this is the most typical scenario that you'd want to support automatic integration with API Management? In addition, the V2 function app runtime _still_ doesn't allow OpenAPI export for dotnet core.
As it stands, instead, we're going to have to hand write OpenAPI specs for every service and do a lot of work to figure out the deployment of API management. Likley we won't be able to use our existing tooling (terraform) for several of the integration points.
It's these kinds of pain points that make me unhappy with using Azure.
-
Hemanth commented
Hello, is this issue resolved, i would like to know the implementation and add few points.