question

PK-7858 avatar image
0 Votes"
PK-7858 asked MayankBargali-MSFT edited

Calling Azure Function from APIM backend

Hello,

There is endpoint we have configured in APIM which will be hit by the client. In the APIM policies for the API, we have defined the message body to be routed to a service bus topic.

Now, I need to configure APIM backend API to call an Azure Function I will be handling message body routing to the service bus. I could see only logic apps in the list of options, and could not see Azure Functions.

Is there a way we can call Azure Function in the APIM backend?

Thanks,
PK

azure-api-managementazure-service-bus
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

MayankBargali-MSFT avatar image
0 Votes"
MayankBargali-MSFT answered MayankBargali-MSFT edited

Hi @PK-7858

Please confirm my understanding:
APIM --> Azure function (backend call) --> Azure function sending message to service bus

Yes, you can create your function app and import an function app as an API in APIM. Can you share the screenshot where you don't see the option to import function app in APIM.

If the scenario is APIM --> Azure function (to modify the body) --> APIM backend call to service bus REST API
Then you can use Send request advanced policy to call the HTTP function and your APIM backend will be calling the service bus REST API.

Update 6/11:
@PK-7858 I will get the confirmation from my team if this is supported yet as I don't see the option from azure portal when you navigate to the Backend for a particular API. When we import an function as an APIM there are multiple other configuration that are created for you in your APIM resource. For now you need to create the Backend and configure it in your API.

104678-image.png

In the Inbound you need to set the set-backend-service policy for your API methods.

Update 6/14:
I have got the confirmation from my team that the option to select the backend as function on the existing API's/operation option is not currently available.
In future they will try to add this functionality and improve the backend entities interface overall but there's no specific timeline just yet.


image.png (106.9 KiB)
· 4
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hey @MayankBargali-MSFT :

Below is the screenshot. I'm unable to see Azure Function in the backend.

104470-image.png



0 Votes 0 ·
image.png (96.2 KiB)

@PK-7858 I have updated my answer and will get the confirmation from my team if this is supported yet from azure portal.

0 Votes 0 ·
PK-7858 avatar image PK-7858 MayankBargali-MSFT ·

@MayankBargali-MSFT : Based on your response on 6/14, I understand that from APIM backend we cannot directly call Azure Functions.

Would you be able to confirm?

0 Votes 0 ·
Show more comments