Easily Understand Azure API Management

Introduction

In the past, if you created a Web API application, you could directly deploy it to the Azure portal. But nowadays you can’t do that. You must create an API management gateway on the Azure portal and only through API management can you deploy Web API applications. In this post, we will see all the steps to create API management on the Azure portal and deploy one sample Web API application into the Azure portal as well.

Azure API Management is a hybrid, multi-cloud management platform for APIs across all environments.

Azure API Management helps customers meet these challenges.

  • Abstract backend architecture diversity and complexity from API consumers
  • Securely expose services hosted on and outside of Azure as APIs
  • Protect, accelerate, and see APIs
  • Enable API discovery and consumption by internal and external users

API management components

Azure API Management is made up of an API gateway, a management plane, and a developer portal. These components are Azure-hosted and fully managed by default. API Management is available in various tiers differing in ability and features.

Api Management Components

Image courtesy: https://docs.microsoft.com/

We can create an Azure API management now.

Create an API management on the Azure portal

We can go to the Azure portal and choose to create a resource and search for API management.

Create a resource-2

We can choose API management and click the Create button.

Api Management-3

This will ask for the required information.

Install Api Management Gateway-4

We can choose or create a new resource group and choose a region. Also, we can give a valid resource name, organization name, and administrator email address.

Now we can choose the pricing tier for API management.

Pricing tier-5

The developer tier has a lower price. You can find all the price details from the link below.

https://azure.microsoft.com/en-us/pricing/details/api-management/

Protocol settings-6

We can choose the required protocol from the list.

Finally, we can review it and create the API management now.

It will take some time to complete the resource creation. (Usually, it takes up to 2 hours to finish the API management deployment.)

Azure Api Management-7-.jpg

You will get an email from Microsoft after the API management is created.

Sarathapimanagement-8

Above is the overview of newly created API management. We can see the developer portal URL and gateway URL in the above overview.

We must create APIs from given templates in API management before deploying our Web API applications to the Azure portal. By default, we can see an Echo API automatically created inside the API management.

Sarathapimanagement APIs-9

We can remove the default Echo API and create our APIs. There are various templates available in the API management for API creation. We can create any number of APIs under API management.

Create from definition-10

We can click the Add APIs button choose the HTTP template and create an API now.

We can choose Basic or Full options.

Create an HTTP API-11

Full choice has more properties.

Create an HTTP API full option-12

We can choose a Basic option and give display name and name properties.

We can ignore other optional properties for now.

Create an HTTP API mandatory-13

After creating the HTTP API, we can create a Web API in Visual Studio and deploy it to the Azure portal.

Create .NET 6.0 Web API using Visual Studio 2022

Create .Net 6.0 Web API-14

After creating the project, we can create a new API controller using a scaffolding template.

Add New Scaffolded Item-15

We have now created a new controller with all CRUD actions.

Crud action-16

We can publish this API project to the Azure portal.

Right-click the solution explorer and choose the Publish menu.

Solution Explorer-17

We can choose Azure as a target. You must log in to the Azure portal before going ahead.

Publish-18

We can choose Azure App service (Windows) and click the next button.

Publish Azure App Service-19

We can add a new App Service now.

App Service-20

If you have already created an App service, you can choose from the given list.

Publish Azure Service-21

We can choose the API management and HTTP API that we have already created on the Azure portal.

Publish Choose the API Management-22

We can click the Finish button to create deployment steps.

Publish ready to publish-23

We can click the Publish button to deploy our Web API to the Azure portal. Our deployment will be completed in a few minutes.

We can open the swagger documentation of the API application and check whether it is working or not.

Swagger Web API-24

We can open the API management on the Azure portal and see the new methods we have created in the Web API application are available here as well.

Sarathapimanagement-25-.jpg

If you click the three dots menu near to the API, we can see that many options like Clone, add revision, add version, import, export, create power connector, and delete are available here.

Diagnose and solve problems-26-.jpg

There are many prominent features available in Azure API management. We can see those features in another post.

Conclusion

In this post, we have seen how to create an Azure API management in the Azure portal, and we have deployed one Web API application to the Azure portal using API management. We will see more features of Azure API management in upcoming articles.