What Is Azure API Management ?
Last Updated :
02 Apr, 2024
Azure API Management Service is a PaaS (Platform as a Service) offering by Azure. This service provides a secure way to publish and manage the APIs created by on-premise or cloud backend services. Azure APIM service acts as an intermediate layer between the backend applications that hold the code behind the API endpoints and the consumers of the API endpoints.
This platform as a service offering provides easy management of the APIs by way of many built-in policies that control requests and responses, built-in authentication methods, and monitoring capabilities.
Features of Azure API Management Service
- Auto-Scaling: Depending on the pricing tier for the APIM service, auto-scaling can be configured based on metrics.
- Managed and Self-Hosted Management of API Instances: You can use the Azure-handled management gateway portal or configure your management gateway portal so that your API backend and management gateway are hosted in the same infrastructure and region.
- Monitoring API: Continuous logs and metrics are available to monitor API outages, traffic bottlenecks, etc.
- Greater control over how inbound requests and outbound responses are handled using various built-in policies, e.g.: limit API requests in a given duration, restrict IPs, handle query parameters, etc.
- Multi-Region Deployment: APIM service instances are usually deployed in one primary region, but for the Premium pricing tier, API gateway instances can be spread across regions to provide improved latency.
- Security: API security provides the ability to integrate with Azure Entra ID, OAuth 2.0, Azure AD B2C, authentication certificates, etc.
To Know More about Azure API management service - Read.
Key Components of Azure APIM
Backend API
This is the API endpoint exposed by the app created and hosted using various other platforms. Eg. Say a web API app built using .NET Core and hosted on an on-premise server.
Basic flow of inbound request and outbound response in Azure APIMAPI Gateway
This acts as an abstraction layer between the consumers of the API and the backend architecture of the API. With the API Gateway, complex details of how the API is developed, the code, the hosting details etc. is hidden. This makes it easier to perform other management and monitoring tasks of the API that do not need such added information. The API Gateway receives both inbound and outbound requests for the Backend API. Azure provides with an Azure managed API gateway that is associated to the API endpoints.
Azure also provides Managed and Self Hosted Gateways.
- Managed API Gateway: Handled and maintained by Azure.
- Self Hosted Gateway: A way to create and manage your own gateway. Here you spin up a container and host the gateway in a setup managed and operated by yourself. This could be an option if you need greater control for security , traffic to the endpoints, or want the API gateway to be in the same region of where your API is hosted.
Whichever is used, it is the gateway that handles the requests and responses along with integrating with Azure monitoring capabilities, it is responsible to relay log and metric information and fulfill policy requirements.
API Management Plane
Provides management capabilities to setup API endpoints, create API service instance, add or remove policies, provide templates to create different endpoints. Basically management plane provides administrative tools for API service management. The management plane also has a REST API endpoint, making it also possible to programmatically maanage and administer API management services via ARM templates, SDKs, PowerShell, Visual Studio etc.
Developer Portal
This is an auto-generated yet customizable website that displays all published APIs and documentation needed to use the APIs. The developer portal also provides a console to test the API endpoints from within it. It is a great management tool that lets developers login, subscribe or even guest users to use the available APIs.
Basic Building Blocks of Azure APIM Service
Products
Product is grouping of APIs that you want to publish like a package to consumers. When you publish a set of APIs as a product, you can
- control how APIs are accessed via subscription
- set approvals for accesses.
- set policies at product level, so the policy rules apply to all APIs in the product
- test the APIs in the Developer Portal Console

Subscriptions
Subscriptions are a way to access APIs securely using a subscription key. This subscription key is added to the header of a HTTP request using the key Ocp-Apim-Subscription-Key. The key can also be sent as a query parameter using name subscription-key. Subscriptions can be scoped at:
As shown below, a built-in all-access subscription key is provided by Azure, that is scoped at the APIM instance level. Which means this key can be used for all APIs in the particular APIM service instance. Because this is an all-access key, it must be used only by authorized users.
These subscription keys can be regenerated, cancelled and also deleted.

Users and Groups
Users here means developers that you add or invite to use your published APIs. These users are not to be confused with users in Azure tenant. These users can be added to groups for better distinction and management.
Azure APIM service instance always comes with 3 built in groups - Administrator - This is a system managed group that has the administrator setup during APIM service creation as its only member.
- Developer - All users added, invited or those who sign up are added here. Any user by default gets added to the Developer group
- Guests - This is also a system managed group and lists unauthenticated users visiting the developer portal. You cannot manually add members to this group.

Policies
Policies are a set of instructions/rules in an XML based format that influence how inbound requests and outbound responses are processed. Azure APIM has certain built-in policies for e.g.: to allowing incoming requests from certain IP addresses or block requests, validate the request or response body against an API schema, check the query parameters in the request before passing it to the backend etc. Apart from built in policies, azure portal also provides a way to customize and configure your own set of policies. You can have multiple policies associated at once and they will run in the sequence of how they appear in the XML document. Policies can be scoped at different levels:
- single operation in an API
- All operations in an APIs
- Product
- Global - for all APIs
Built in Inbound Policies for All APIs
An XML view of an inbound policy having limited rate of calls applied to an API operation
Steps to Publish an API using API Management Service
For this demonstration, we will assume a scenario where a fictional company called Contoso has developed a set of APIs (users/todo lists), and employs Azure API Management Service to publish these APIs, thus making the API endpoints available to developers. We will be using the free API endpoint provider https://jsonplaceholder.typicode.com/, but you can use or create any API endpoint of your choice.
Step 1: Create and Configure an API Management Service Instance
Select the API Management Service from the Azure Portal.


Enter API Management Instance name, Administrator Email and select the Pricing Tier = Developer. The administrator email will be the credentials used as administrator for the developer portal. Let the rest of the information be as default. Click Review + Create

Step 2: Add API Endpoint for Users and ToDos
- Navigate to the demo-mockapi APIM service instance and click on APIs on the navigation blade. Here you see , that Azure provides a default EchoAPI. But we want to setup our own API, so we will add a new HTTP Endpoint.

- Setup an HTTP End Point like below. For this example, leave the API URL Suffix as blank. The API URL Suffix is the URL Path, and should be unique for every API. This acts as a distinguisher between different API paths.

- Now we have setup the API Endpoint but have not configured any information for the operations that the API allows. Navigate to the User ToDos API and select "Add Operation"

- Now we will map our API methods here. This acts as a frontend for the actual backend API. Enter the details as below to map the GET method. The "/users" indicates the resource that GET method retrieves.

- We can test this endpoint method , select the operation and click Test. This opens a portal, that where we send any request parameters, header key-values, values for url placeholders etc. i.e. whatever is needed to test the operation

- Response Body and response status is returned


- Repeating the above steps, we will now add a few more operations. Add an operation to Get user details based on a parameter passed. Define a default user id value in the Template Parameter section.

- Next, we will add an operation to get all ToDos.

- Next, add an operation to get all pending ToDos for an given user id



Step 3: Setup the Developer Portal
- First time Developer Portal is opened, it may take a while to setup. Later, any changes you make to the drag-and-drop component website, you need to publish the Developer Portal with every change. Here navigate to the Developer Portal through Azure APIM service instance.

- After the Developer Portal opens, make any changes to the website layout you want and click Publish Website. Whenever you open the Developer Portal from Azure, it will open in an edit mode by default.

Step 4: Add developers as Users
- In order to simulate a scenario to show how developers will be able to access the published APIs of DemoCompany, we will create fictitious user in API Management service instance. Note that, be default all users are created with status = Active and assigned to the Developer Group. Navigate to Users and click Add button. Set up the details of the developer (use a valid email address).

- Once added, you see the list of users as below. As of now, there will the admin user and the developer user.

- Also navigate to Groups, to have a look at the 3 built-in user groups namely Administrator, Developer and Guests as discussed before.

- Click the Developers group, to confirm if developer John Milton has been auto added

Step 5: Create and Configure Products
- From navigation blade select Products and click Add button.
- Let's call this product Premium , Check "Published" and "Requires Subscription". Add User ToDos API to the product.

- Navigate to the Premium product. Select Access Control and Click Add Group button

- Add the Developers group so that members of the developers group now have access to the Premium product.

- An overview of the Premium product, gives all the necessary information
Premium product Overview
Step 6: Create Subscription for the Product
- Because we setup the Premium product to have subscription mandatory, as subscription key is created at the scope of the product. Navigate to the Premium Product and click Subscription.

- We will use this autogenerated subscription key for consuming the APIs
Step 7: View the Published APIs via Developer Portal
- Sign In to the Developer Portal using credentials setup for our developer John Milton.

- Navigate to the Products. Select the Premium Product
List of Products accessible - Select the User ToDos API and now you see the list of operations we setup.

Step 8: Test the User ToDos API
- To test the Get Users operation (or any operation of your choice), we could use any API testing tool or service like Postman API etc. Ensure that authentication is Basic, and the request header, contains subscription information as shown below.


- Here is the response of Get Users operation of User ToDos API.
Get Users Response
Similar Reads
How to Set up Azure API Management?
Azure API Management is a totally controlled organization provided by Microsoft that allows you to create, put up, and manage APIs (Application Programming Interfaces) in your packages. It gives a scalable and regular way to reveal your APIs to outside builders, partners, and customers, and allows y
11 min read
What Is Azure Web Apps ?
In this ever-changing world, web apps are one of the most useful resources we use in day-to-day life. Building a scalable and reliable web app while managing traffic is quite challenging. Leveraging the advantage of cloud technologies is one of the biggest advantages of building web apps. There are
7 min read
What is Azure Virtual Network Manager
If you think about it, in the big picture of cloud computing, network management is a critical functionality for proper operation and communication signaling across disparate nodes. Of course, Microsoft Azure offers you quite a bit more than just this and that is what we are going to explore shortly
11 min read
Best API Management Tools in 2024
APIs help different software systems communicate, making everything run smoothly. However, managing these APIs can be tricky. That's where API management tools come in. They make it easier to create, secure, and monitor APIs, ensuring everything works efficiently.Using the right API management tool
7 min read
What is the API Gateway Pattern ?
API - It stands for "Application Programming Interface". In general APIs are built-in libraries or collections of libraries that perform some specific task or function. In general, we use API to get connected with other web applications. We generally connect with other web applications by following
3 min read
What are Azure Virtual Machines?
We can create and run virtual machines (VMs) in the cloud using Microsoft Azure's Azure Virtual Machine service without having to manage the infrastructure. We might set up the required OS in the virtual machine, like Linux, Windows, or Mac. What Is Microsoft Azure?The definition of Azure is that it
7 min read
Swagger and API Lifecycle Management
In today's world of software development and integration, Application Programming Interfaces (APIs) play a crucial role in enabling communication and data exchange between different systems. However, creating an API involves multiple steps, and effective management throughout its lifecycle is vital
5 min read
What is API Monitoring in Postman ?
API Monitoring is a process that monitors the activity, output, and performance of an API based on Environment, Time, regions, etc. API monitoring plays a significant role in identifying and addressing issues related to API functionality and security before they impact partners or end-users of that
6 min read
What is An Azure NVA (Network Virtual Appliance)
Businesses are rapidly moving to the cloud which leads to the extreme importance of strong network infrastructure and security. Find out how Microsoft Azure had multiple tools and services to help you do this migration easily. Within this landscape can be found tools such as Network Virtual Applianc
9 min read
Microsoft Azure - Management Interfaces for Azure SQL
In this article, we will look into the management interfaces for Azure SQL. There are different ways to interact with Azure SQL. One of those ways is the Azure portal, and the below image shows the Azure SQL unified experience where Azure tried to ease the process of decision-making for users(ie, wh
2 min read