Multiple APIM APIs to the same Function App

David 41 Reputation points
2022-11-02T21:56:16.5+00:00

I have a function app available at:

https://contoso.azurewebsites.net/api/MyFunction

When I link the function to api management it defaults to this:

https://contoso-apim.azure-api.net/MyFunction

The function takes a handful of query strings. I'd like to add multiple apis to my api managment like this:

https://contoso-apim.azure-api.net/abc goes to https://contoso.azurewebsites.net/api/MyFunction?options=abc
https://contoso-apim.azure-api.net/xyz goes to https://contoso.azurewebsites.net/api/MyFunction?options=xyz

Is this something I can do? It seems trivial but I can't work it out.

Azure API Management
Azure API Management
An Azure service that provides a hybrid, multi-cloud management platform for APIs.
2,446 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. MuthuKumaranMurugaachari-MSFT 22,441 Reputation points Moderator
    2022-11-03T02:38:08.82+00:00

    @David Thank you for reaching out to Microsoft Q&A. Based on my understanding, you would like to add multiple APIs in APIM which points to the same azure function with different query parameters.

    • Use API URL suffix to add multiple APIs like abc, xyz when importing azure function

    256549-image.png

    • Navigate to API, Operations and change URL in Frontend from /MyFunction to / (my function name is HttpTrigger)

    256440-image.png

    • Use rewrite-uri policy in your inbound section to transform template to suit your needs. Refer docs: Rewrite URL and samples for more info.

    <rewrite-uri template="MyFunction?options=xyz" />

    I hope this answers your question and feel free to add a comment if you have any other questions. We would be happy to assist you. Please 'Accept as answer' and ‘Upvote’ if it helped so that it can help others in the community.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.