Tuesday, February 18, 2020

Hosting an Azure Function in API Manager

Azure API Management Service offers great support for hosting APIs. One of the greatest ways it support is by hosting different internal Azure artifacts. Once you go to the portal API Management Service and select APIs menu, it serves you with multiple options to add an API.  
 
As we are going to test an Azure Function, we will select Function App option. It opens up 'Create from Function App' option. Here you can select the API, Path, Versioning and many other relevant information. 
 
Function App – Can be browsed through the browse option and select a function app hosted on a resource group. Display name, Name and Description fields describe the API. You can specify the APIURL Suffix so the developers will be accessing it through that path. Tags will make it easy to understand the resource and Products support exposing the APIs to the developers.  
The beauty is that you can Version the APIs through API manager. Following versioning schema options are supported.  
  • Path 
  • Header 
  • Query String 
This allows two separate Azure functions to be exposed as 2versions of an API. 
As my Azure function supports 2 HTTP methods GET and POST, both the APIs will be shown here as below. We can write custom policies to restrict or modify the API access.   
Now you can secure your vNet by restricting IP address only to the API Management within the IP restriction rules.  

No comments:

Post a Comment