Friday Fact: You can expose a Function on API Management directly from your Function App

On this Friday Fact, we will discuss a cool new Azure Portal feature. But first, let’s introduce the scenario:

Scenario

We have a simple Azure Function that converts XML into JSON, and we want to expose that function to our API Management.

New Feature

Now, you can expose a Function as an API directly through your Function App!

A new feature in Function Apps can save you time and effort: the ability to directly export your Function as an API into your API Management with minimal effort. Here’s how it works:

In your Function App‘s overview page:

  • Click the API option in the lateral menu and then select API Management.
  • Next, a new window will open. Choose your API Management instance and select Create New. Then, choose Link API.
    • Note that if you don’t want to add your API operation to an existing API.
  • In the next window, your Function should already be selected. If not, select it and click Select.
  • You will be redirected to your APIM (still within your Function App). Here, you can change the name of your API or leave it as is. Next, click Create.

Your operation is now created. Before testing, configure your headers to accept XML content.

  • In the Frontend section, click the pencil icon to edit.
  • Next, click on Headers.
    • In the name field, write Content-Type.
    • In the values field, add application/xml. (these steps are optional since our Azure Function is already configured to receive XML content).
  • Next, click on Save.
  • Now it’s time to test. Click on Test, paste an XML input, and click Send.
  • Scroll down to see the response with the JSON transformation.

And this is how to expose your function directly through your Function App into your API Management.

To lazy to read? We’ve got you covered! Check out our video version of this content!

Hope you find this helpful! If you enjoyed the content or found it useful and wish to support our efforts to create more, you can contribute towards purchasing a Star Wars Lego for Sandro’s son!

Author: Luis Rigueira

Luis Rigueira is a Enterprise Integration Consultant at DevScope

Leave a Reply

Your email address will not be published. Required fields are marked *

turbo360

Back to Top