Sunday, September 6, 2020

What is Azure API management

 Azure API Management enables us to create a service repository, where we can expose all our services to clients. It helps organizations publish APIs to external, partner, and internal developers to unlock the potential of their data and services. It also helps us to maintain security and versioning in our APIs. Businesses everywhere are looking to extend their operations as a digital platform, creating new channels, finding new customers and driving deeper engagement with existing ones. API Management provides the core competencies to ensure a successful API program through developer engagement, business insights, analytics, security, and protection. You can use Azure API Management to take any backend and launch a full-fledged API program based on it.

In previous post we have created 2 azure functions. 

1. Djblogsfuncapp

2. ProductsFuncApp

Now with help of Azure API Management, we can manage both azure functions in one location and it provide developer portal (Web App) with nice user interface for API consumer. We change developer portal color, theme based on our requirement.


Azure API Management example

Let’s consider a simplified online store system. A visitor of the website needs to be able to see product’s details, place an order, review a placed order. Whenever an order is placed, the system needs to process the order details and issue a shipping request.

As above requirement we need to create three Azure Functions (microservices)

1.       Order (GET and POST API)- Responsible for viewing and placing an order.

2.       Product (GET API)- Responsible for viewing details of a product.

3.       Shipping triggered internally by an event- Responsible for processing and shipping an order

We can manage these above Azure Functions (microservices) with help of API Management

Azure Service Bus can decouple applications and services. Service Bus offers a reliable and secure platform for asynchronous transfer of data and state. Data is transferred between different applications and services using messages. A message is in binary format and can contain JSON, XML, or just text.

Benefits of using Azure API Management

Azure API Management help us manage different azure functions (microservices) in one location

1.       Independent development and freedom to choose technology- Developers can work on different azure functions (microservices) at the same time and choose the best technologies for the problem they are solving.

2.       Independent deployment and release cycle- azure functions (microservices) can be updated individually on their own schedule.

3.       Granular scaling- Individual azure functions (microservices) can scale independently, reducing the overall cost and increasing reliability.

4.       Simplicity- Smaller services are easier to understand which expedites development, testing, debugging, and launching a product.

5.       Fault isolation- Failure of a microservice does not have to translate into failure of other services.

How to create Azure API Management Service

As we created “ServerlessAPIs with Azure Function” in last post now in this post we will wrap that serverless API with Azure API management. It helps us to manage API from azure portal and provide us nice Developer API portal for API documentation. It is very easy and professional. I will show you step by step how we can add “Azure API Management “service in our “Azure function (Serverless, microservice)”.

1.       Go to azure portal https://portal.azure.com

2.       Once you are login in portal click in (+) sign as below “Azure Marketplace” search page will open type “API Management”


3.       Click on API Management


4.       Click on above “Create” button and it will open “API Management Service” form like this


5.       Once you click on “Create” it will create “productfuncappapi” as API management service

 


6.       Once API Management service created the we can add our “Azure Functions” on “APIs” as below


7.       To add already create “Azure Function” click on “Function App” as above

8.       Click on “Browse” and select your azure function which you want to add in API Management


9.       Click on select button as above screen it will show all the function inside “ProductsFuncApp” like below


10.   Select all function which your want to add in “Azure API Management Service”.

11.   Once “Azure Function” added. You can design your API request and response for end user (Developer Portal).



12.   You can create multiple APIs and sell them like products to the end users. When we create API Management there 2 type of default products provided by azure. You can create your own products and add your APIs inside it and provide APIs access based on end user products.

a.       Starter

b.       Unlimited


More information about read Microsoft “Create and publish a product” in API Management

 

13.   Now I am adding our product APIs inside “Starter” product and that can be accessed via API Management Developer portals.


14.   We can access these API from “Azure API Management Portal” and change it design based on your company branding. By default Azure give Contoso branding as below   

Our API URL: https://productfuncappapi.developer.azure-api.net/

 


15.   I have tried to change the design of the “API Management Developer Portal”. Now it looks like as below



16.   We can modify our developer portal design very easily. Hope this link will help you more if you want customize developer portal.    

17.   Once you go to our developer portal it will show APIs as below

URL: https://productfuncappapi.developer.azure-api.net/apis



You can see how nice APIs documentations portal and security provided by API Management. API Management provide many features some of the features I personally like is

1.       Versioning

2.       Mock API response

In future post we will try to cover these features

Hope it will help you to understand what is "Azure API Management" and how you can use that and take advantages from it.
Keep learning, Keep sharing! Cheers 

4 comments: