Azure API Management

Azure API Management

A complete, plain-English guide to the service that stands at the front door of your APIs: how it publishes them, protects them, shapes traffic, measures usage, and lets developers find and use them with confidence.

Imagine a very large hotel. Inside are many busy departments: the kitchen, the laundry, the spa, the taxi desk, the conference rooms. Guests do not walk straight into the kitchen to ask for a sandwich, and they do not wander into the laundry to look for their shirt. Instead, they go to a reception desk. The receptionist checks who they are, knows which department can help, writes the request in the right form, takes it to the right place, and brings the answer back. If a guest asks for too many things at once, the receptionist politely slows them down. If a stranger tries to walk into the staff area, the receptionist stops them. At the end of the month, the hotel manager reads the reception log to see which services are popular and which are not.

Computer systems need the same kind of reception desk. Modern companies build many small programs that talk to each other and to the outside world through doorways called APIs. Without a reception desk, every program must handle identity checks, speed limits, record keeping, and translation on its own, and each one does it a little differently. Azure API Management is Microsoft’s cloud service that plays the role of the hotel reception. In this guide you will learn what it is, why it exists, every important part inside it, how a single request travels through it, how to secure, monitor, and price it, and the mistakes that trip up even experienced teams. Every new word is explained the first time it appears, so you can begin with no background at all.

1What Azure API Management Is

Start with the big picture: what an API is, what a gateway does, and where this service sits.

An API, short for Application Programming Interface, is a set of rules that lets one program ask another program to do something. When a weather app on your phone shows today’s temperature, it does not measure the air itself. It sends a request over the internet to a weather service and receives the answer. The doorway through which it asks is the API. The program that asks is called the client, and the program that answers is called the backend or service. Most APIs on the web use a style called REST, where the client asks for things using simple web addresses and standard actions such as GET (read something) and POST (create something). The information travels in a common text format called JSON. Other styles exist too, such as SOAP, GraphQL, gRPC, and WebSocket, and Azure API Management supports several of them.

A gateway is a single entrance that sits between clients and many backends. Instead of each client knowing the address of every backend, the client talks only to the gateway. The gateway then forwards the request to the right backend, and brings the reply back. Because all traffic passes through one place, the gateway can do useful work on the way: check identity, limit speed, change the shape of messages, store answers for reuse, and write records.

Azure API Management, often shortened to APIM, is a fully managed Azure service that provides this gateway, together with tools to publish, secure, transform, maintain, and monitor APIs, and a website where developers can read about your APIs and try them. Fully managed means that Microsoft runs and maintains the underlying machines, so you focus on the APIs, not the servers. The backends that APIM protects can live anywhere: in Azure, in another cloud, or in your own data center.

1 front door
All clients call one gateway address
Policies
Rules that run on each request without changing backend code
3 parts
Gateway, management plane, developer portal
Analogy

The hotel reception desk is the gateway. The hotel manager’s office, where rules and staff schedules are decided, is the management plane. The printed guide in each room that explains the services and how to ask for them is the developer portal. Together they make a hotel that guests can use easily and that the owner can control.

Where the service came from

Microsoft built API Management as a product to help companies share their data and functions as APIs, safely and at scale. Over time it grew from a simple gateway into a full API platform with several pricing tiers, networking options, a developer portal, a self-hosted gateway for other environments, and in recent years features aimed at managing access to artificial intelligence services. Tiers and features change often, so check Microsoft’s current documentation when you plan a real deployment.

i
Tip

If you remember only one sentence, remember this: API Management lets you add security, limits, and visibility to your APIs without changing the code of the APIs themselves.

2The Problem It Solves

APIs multiply quickly. Without a front door, each one becomes a separate headache.

When a company has one small API, a team can protect it by hand. But successful companies soon have dozens or hundreds of APIs, built by different teams, in different languages, running in different places. Partners, mobile apps, websites, and other departments all want to use them. Five problems appear again and again.

Problem 1

Inconsistent security

One team checks passwords carefully, another forgets. An attacker only needs to find the weakest door.

Problem 2

No traffic control

A single greedy client, or a bug in a client, can send millions of requests and crash a backend that real users depend on.

Problem 3

No visibility

Nobody knows who uses which API, how often, how fast it responds, or how often it fails.

Problem 4

Hard to change

When a backend changes its address or format, every client must change too, often at the same moment.

Problem 5

Hard to discover and use

Developers waste days hunting for documentation, keys, and examples, so good APIs go unused.

Problem 6

No way to earn or limit

If an API is a product, you need plans, quotas, and approvals, not an open door.

API Management answers each of these. It applies the same security rules at one place. It limits the rate and total amount of calls per client. It records every call and shows charts. It hides backend details behind a stable public address, so the backend can move or change while clients notice nothing. It publishes a developer portal where people can sign up, read documentation, and try calls. And it lets you package APIs into products with plans and approval rules.

Analogy

Without a reception desk, each department of the hotel would need its own guard, its own sign-in book, and its own printed menu. Guests would be confused, and the manager would have no idea how many people visit the spa. One reception desk solves all of that with one set of rules.

Everyday example: the runaway app

A partner company’s mobile app has a bug and starts calling your price-list API 5,000 times per second, instead of once per screen. Without protection, your pricing database slows down and your own shop website suffers. With API Management, a rate limit of, say, 100 calls per minute per partner stops the flood at the gateway, returns a polite “too many requests” message, and your database never notices.

What it does not do

It helps to know the limits of the service, so that expectations stay realistic. API Management does not write your business logic, store your business data, or fix a poorly designed backend. It does not replace good testing, and it does not make an insecure application safe by itself. It also does not run your programs: it only receives calls and forwards them. Think of it as a skilled receptionist, not a replacement for the kitchen. The better your backends are designed, the more value you get from the gateway in front of them. Teams that treat the gateway as a magic fix often end up putting too much logic in policies, which later becomes hard to understand and maintain. Teams that use it for what it does best, shared security, traffic control, publishing, and visibility, enjoy a calmer and more reliable platform.

It is also worth remembering that adding any gateway adds one more step to every call. That step is small, usually a few milliseconds, but it is real, and it is another component that must be monitored, secured, and paid for. The benefits normally outweigh the costs once you have more than a few APIs or any external consumers, and this is why the service is most popular with growing organizations.

3Core Concepts: The Vocabulary

Learn these words once and the rest of the guide reads easily.

TermPlain meaningWhy it matters
API Management instanceOne deployed copy of the service in Azure, with its own gateway addressThe unit you create, pay for, and manage
APIA group of operations that a backend offersWhat clients call
OperationOne specific action in an API, such as “get order by number”The level at which you can attach rules
BackendThe real service that does the work behind the gatewayWhere requests finally go
GatewayThe part that receives calls and forwards themThe data path for all traffic
ProductA bundle of one or more APIs offered with terms such as limits and approvalHow you package and sell access
SubscriptionA named key pair that lets a client use a product or APIIdentifies and meters each consumer
Subscription keyA secret string sent with each call to identify the subscriptionBasic identity and tracking
PolicyA rule, written in XML, that runs at a defined stage of a callThe main way to add behavior
Named valueA stored setting or secret that policies can reuseKeeps secrets out of rules
VersionA separate public edition of an API, such as v1 and v2Lets you make breaking changes safely
RevisionA safe, non-breaking edit of an API that can be tested before it goes liveLets you change gently
Developer portalA website for API users: docs, sign-up, keys, and a test consoleSelf-service for consumers
WorkspaceA named area inside one instance that a team can manage on its ownShared platform with team independence
Self-hosted gatewayA copy of the gateway that you run yourself, in a containerLets the gateway live near backends elsewhere
Analogy

In the hotel: an operation is one request, such as “book a taxi”. An API is a department that offers several of those. A product is a package like “Business Traveler Pass” that includes taxi, laundry, and meeting rooms. A subscription is the room key card issued to a guest. A policy is a house rule, such as “no more than ten taxi bookings per hour”.

i
Tip

Picture the chain: a client calls an operation inside an API; the API belongs to a product; the client holds a subscription to that product; policies run along the way; the backend answers.

4Architecture and Components

An APIM instance has three main parts that work together. Understanding the split between them explains almost everything else.

The first part is the gateway, sometimes called the data plane. The word “plane” simply means a layer of the system. The data plane is the layer that handles the actual traffic: it accepts a client’s request, runs the policies, calls the backend, and returns the answer. It is the busy road. In the managed service, Microsoft runs the gateway for you inside the instance, and in higher tiers it can run on several units or even in several regions at once.

The second part is the management plane. This is the layer you use to create and change things. When you add an API, edit a policy, or create a product, you are talking to the management plane. It stores your configuration and pushes it to the gateway. You reach it through the Azure portal (the web page where you manage Azure), through command-line tools, through automation templates, or through the management API. It is the manager’s office.

The third part is the developer portal. It is an automatically generated website that lists the APIs you choose to publish. People can sign up, read documentation made from your API definitions, try a call using a built-in test console, and get their subscription keys. You can change its design and content, or build your own portal if you prefer.

flowchart LR
    subgraph CLIENTS["Callers"]
        C1["Mobile app"]
        C2["Website"]
        C3["Partner system"]
    end
    subgraph APIM["API Management instance"]
        GW["Gateway - data plane"]
        MP["Management plane - configuration"]
        DP["Developer portal"]
    end
    subgraph BACKENDS["Backends"]
        B1["Azure Functions"]
        B2["App Service web app"]
        B3["On-premises service"]
        B4["Other cloud service"]
    end
    C1 --> GW
    C2 --> GW
    C3 --> GW
    GW --> B1
    GW --> B2
    GW --> B3
    GW --> B4
    ADMIN["API owners and DevOps"] --> MP
    MP -.->|"pushes configuration"| GW
    DEV["API consumers"] --> DP
    DP -.->|"reads API definitions"| MP
    
Figure 1. The three parts of API Management: a gateway for traffic, a management plane for configuration, and a developer portal for consumers.

The figure reads from left to right for traffic: callers reach the gateway, and the gateway reaches the backends. Dashed lines show configuration and information flowing in the background. Notice that API owners never touch the road directly; they change the rules in the manager’s office, and the rules reach the road automatically.

Supporting Azure services

Azure serviceIts role with API Management
Microsoft Entra IDProvides identities and tokens so clients and users can prove who they are
Azure Key VaultStores secrets and certificates, which APIM can read through named values
Azure Monitor and Application InsightsCollect logs, metrics, and traces about calls
Azure Virtual NetworkPlaces the gateway on a private network
Azure Application Gateway or Front DoorOptional shield and traffic manager placed in front of APIM
Azure Event HubsReceives a stream of log events for analysis elsewhere
Azure Functions, App Service, Logic Apps, Container AppsCommon backends behind the gateway
Azure DevOps or GitHubHold API definitions and policies as code and deploy them
Analogy

The gateway is the reception desk with real guests. The management plane is the manager’s back office with the rule book and staff rota. The developer portal is the lobby display with brochures and a help phone. Reception works without the manager standing beside it, because the rule book is already on the desk.

5Service Tiers: Choosing the Right Size

API Management comes in several tiers, from a pay-per-call option for small projects to enterprise tiers with many regions.

A tier is a package of features, capacity, and price. Choosing a tier is one of the first and most important decisions, because some features, such as joining a private network or running in several regions, exist only in certain tiers. The tier names have changed over the years, and Microsoft has introduced a newer family called the v2 tiers, so confirm the current list before deciding. The table below describes the general ideas.

TierMeant forKey traits
ConsumptionSmall or spiky workloads, serverless stylePay per call, scales to zero, starts quickly, fewer advanced features
DeveloperLearning, testing, evaluationFull feature set, no service level agreement, not for production
BasicSmall production workloadsFixed capacity unit, limited scale and features
StandardMedium production workloadsMore capacity, more caching, but limited network options
PremiumLarge and enterprise workloadsMulti-region, availability zones, full private network support, highest capacity, self-hosted gateway rights
Basic v2, Standard v2, Premium v2Newer family with faster scaling and updated network optionsQuicker setup and scaling; available features differ by version, so check the current comparison

Beyond the tier, you choose the number of units in the tiers that offer them. A unit is a block of gateway capacity. More units means more requests per second can be handled, and a higher monthly cost. Some tiers can autoscale, meaning they add or remove units on their own as load changes, within limits you set.

Start small

Consumption or Developer

Good for proofs of concept. Do not use Developer for real customers.

Grow

Basic and Standard

Production services with moderate traffic and simple network needs.

Enterprise

Premium

High availability across regions, strict private networking, and large scale.

Modern

v2 tiers

Newer designs with faster provisioning; verify supported features first.

Analogy

Tiers are like choosing a hotel size. A small guesthouse charges per night used and has one clerk. A mid-size hotel has a fixed team. A large international hotel group has branches in several cities, private entrances, and backup power. You pick based on how many guests you expect and how serious your needs are.

!
Warning

Changing tier later can be slow or limited, and some tiers cannot be upgraded in place. Decide on your network design and your need for multiple regions before you create the instance, since these often force a tier choice.

6APIs, Operations, Products, and Subscriptions

These four ideas describe what you publish, how you package it, and who may use it.

An API in API Management is a named collection of operations. Each operation describes one action: its web address path, its method (such as GET or POST), what it accepts, and what it returns. You can create an API in several ways. The simplest is to import an existing description. Common formats include OpenAPI (also called Swagger), a standard file that describes a REST API; WSDL for older SOAP services; and GraphQL schemas. You can also import directly from an Azure Function app, a Logic App, an App Service web app, or a Container App, and APIM reads the operations for you. If no description exists, you can build operations by hand. The gateway address your clients call is formed from the instance name and a suffix you choose for each API, and APIM maps it to the real backend address.

A product is how you offer APIs to consumers. A product holds one or more APIs and sets the terms: it can be open, requiring no key, or protected, requiring a subscription. It can require that an administrator approves each new subscription. It can set a limit on the number of subscriptions per user. It can carry its own policies, such as a rate limit for the “Free” product and a higher one for the “Premium” product. A product can be published, meaning visible in the developer portal, or draft, hidden while you prepare it. You can also restrict a product to certain groups of users, such as “Developers”, “Guests”, or “Administrators”, so only the right audience sees it.

A subscription links a consumer to a product or API and issues a pair of subscription keys, a primary and a secondary. The client sends one of them with each call, usually in a request header called Ocp-Apim-Subscription-Key. The gateway looks up the key, finds the subscription, checks that it is active, and applies the policies of that product. Two keys exist so that a consumer can rotate secrets without downtime: switch applications to the secondary key, then regenerate the primary. Subscriptions can have scope at the level of one API, one product, or all APIs.

IdeaWhat it answersExample
OperationWhat exact action can be called?GET /orders/{id}
APIWhich actions belong together?Orders API
ProductWhich APIs are offered, under which terms?Partner Gold: Orders API and Inventory API, 1,000 calls per minute
SubscriptionWhich consumer has access, with which key?Acme Corp’s subscription to Partner Gold
GroupWho is allowed to see the product?Developers, Guests, Administrators
Analogy

An operation is a single service on the menu. An API is one menu section, like Breakfast. A product is a meal package such as “Business Lunch Deal” that includes a starter and a main and has its own price and rules. A subscription is the voucher you hold. The key printed on it lets the waiter know you may order from that package.

i
Tip

Subscription keys identify and meter consumers, but they are not strong security on their own. Anyone who sees the key can use it. Combine them with token-based identity (covered later) for sensitive data.

7Policies: The Heart of the Service

Policies are small rules that run on every call. They turn a plain gateway into a powerful control point.

A policy is an instruction that API Management carries out while handling a request or a response. You write policies in an XML-based format, where each rule is a small element with settings. The beauty of policies is that they change how an API behaves without touching the backend code. Need to add a header, check a token, limit the rate, or hide a field? You write a policy. The backend never knows.

Every policy document has four sections, each running at a different moment of the journey. The inbound section runs when the request has arrived and before it is sent to the backend. The backend section runs around the actual forwarding to the backend. The outbound section runs after the backend has answered and before the response goes back to the client. The on-error section runs if something goes wrong at any stage, so you can return a friendly message and log the problem. Inside each section, policies run from top to bottom in the order you write them, so order matters.

flowchart LR
    REQ["Client request"] --> IN["Inbound - check, limit, change request"]
    IN --> BE["Backend - route and forward"]
    BE --> SVC["Backend service"]
    SVC --> OUT["Outbound - change response, cache, remove fields"]
    OUT --> RESP["Client response"]
    IN -.->|"any failure"| ERR["On-error - friendly message and log"]
    BE -.-> ERR
    OUT -.-> ERR
    ERR --> RESP
    
Figure 2. The four policy sections: inbound, backend, outbound, and on-error.

Scopes: where a policy applies

Policies can be attached at several scopes, from broad to narrow: the whole global instance, a workspace, a product, an API, or a single operation. A narrower scope inherits the rules of broader scopes through a special element that means “run the parent’s rules here”. This lets you place company-wide rules, such as mandatory logging, at the global level, then add specific rules at lower levels. Order and inheritance deserve care; a mistake can silently skip an important rule.

ScopeApplies toTypical use
GlobalAll APIs in the instanceStandard headers, logging, basic protection
WorkspaceAll APIs of one team’s workspaceTeam-wide rules
ProductAll APIs inside a productRate limits and quotas by plan
APIAll operations of one APIAuthentication, backend choice
OperationOne actionSpecial caching or validation for that action

Expressions and reuse

Policies can include expressions, small snippets of logic that read the request or response and decide values at runtime. For example, an expression might read the user’s name from a token, or choose one backend or another based on a header. You can also store reusable settings in named values and reuse whole groups of rules as policy fragments, so that the same “standard security” block can be included in many APIs and changed in one place.

Analogy

Policies are the house rules the receptionist applies in order. When a guest arrives: check the key card, check the booking, count how many requests they made this hour (inbound). Take the request to the department (backend). When the answer comes back, remove private notes and add the hotel stamp (outbound). If something goes wrong, apologize politely and write it in the incident book (on-error). Some rules are written for the whole hotel, some for one floor, some for one room.

!
Warning

A badly placed policy can break every API at once if it sits at the global scope. Test policy changes on a copy or a revision first, and keep global policies as small and simple as possible.

8Internal Working: Life of One Request

Follow a single call from a customer’s phone to your database and back, and see where each rule steps in.

Imagine a customer opens a shopping app and taps “My orders”. The app sends a request to the gateway address of your API Management instance. First, the request reaches the gateway over a secure connection. TLS, the technology behind the padlock in a web browser, encrypts the traffic so that nobody in between can read it. The gateway finds out which API and operation the address belongs to, by matching the path of the request against the list it holds in memory.

Next, the gateway checks whether a subscription key is required, and if so, whether it is valid and active. It then builds the effective policy for this call by combining the global, product, API, and operation policies in the right order. The inbound section runs: perhaps it validates a token that proves who the user is, checks the rate limit for this subscription, and adds a header that carries the user’s identity to the backend. If any step fails, the request stops here, and the on-error section creates a response such as “401 Unauthorized” or “429 Too Many Requests”. The backend never even hears about it, which is an important saving of work and risk.

If all checks pass, the gateway forwards the request to the backend, perhaps after rewriting the address and picking one of several backend copies. The backend does its work, and answers. The gateway receives the answer and runs the outbound section: it may remove secret fields, convert the format, add caching headers, or store the answer in its cache for the next caller. Finally the gateway sends the response to the client and writes records: a log line, a metric, and perhaps a trace. All of this typically adds only a few milliseconds, which is small compared with the time the backend needs.

sequenceDiagram
    participant C as Client app
    participant G as APIM gateway
    participant P as Policy engine
    participant E as Entra ID
    participant K as Cache
    participant B as Backend service
    participant L as Logs and metrics
    C->>G: HTTPS request with token and subscription key
    G->>G: Match API and operation, check subscription key
    G->>P: Build effective policy - global, product, API, operation
    P->>E: Validate token using public signing keys
    P->>P: Check rate limit and quota
    P->>K: Look for a stored answer
    alt Answer found in cache
        K-->>G: Cached response
    else Not cached
        G->>B: Forward request to backend
        B-->>G: Response
        G->>K: Store answer for next time
    end
    P->>G: Outbound rules - remove private fields, add headers
    G-->>C: Response
    G->>L: Write log, metric, and trace
    
Figure 3. The journey of one call, with cache check and logging.
1

Arrive and secure

The connection is encrypted with TLS, and the gateway reads the request.

2

Identify the target

The path is matched to an API and an operation.

3

Check the key

The subscription key is validated, and the product is found.

4

Inbound policies

Token, limits, transformations and routing decisions run in order.

5

Backend call

The request is forwarded, or the cache answers instead.

6

Outbound policies

The response is reshaped, cleaned, and optionally cached.

7

Return and record

The client gets the answer, and logs and metrics are written.

Analogy

It is the journey of a guest’s request at the hotel: arrive at reception, show the key card, have the booking checked, be told “ten requests per hour only”, have the order written in the right form, carried to the kitchen, and brought back on a tray with private notes removed. A copy of the bill goes into the manager’s book.

9A Tour of Common Policies

There are dozens of built-in policies. Knowing the main families lets you solve most problems without extra code.

Policies fall into a few families by purpose. Here is a guided tour, described in words, since the exact XML is available in Microsoft’s reference.

FamilyExamplesWhat they do
Access restrictionCheck HTTP header, restrict caller IP addresses, validate JWT, validate client certificate, validate Microsoft Entra tokenDecide who may enter and reject others early
Rate and usage limitingLimit call rate by subscription or by key, set usage quotaStop floods and enforce plans
TransformationSet header, set query parameter, rewrite URL, set body, convert JSON to XML or the reverse, find and replace textMake old and new systems understand each other
CachingStore and look up in cache, store and look up by keyAnswer repeated questions without bothering the backend
Routing and flowSet backend service, choose, forward request, return response, wait, mock responseDecide where a call goes and handle special cases
ResilienceRetry on failure, circuit breaker in backend settings, set timeout on forward requestCope with unreliable backends
ValidationValidate content against schema, validate parameters, validate status codes, validate headersReject malformed requests before they reach the backend
Integration and loggingSend request to another service, send one-way request, log to Event Hubs, trace, emit metricCall helper services and record details
Cross-originCORS, JSONPLet web pages from other sites call the API safely
Authentication to backendBasic, client certificate, managed identityProve the gateway’s identity to the backend

Rate limit versus quota

Two policies are often confused. A rate limit controls speed: for example, no more than 100 calls per minute. It protects the backend from sudden bursts. A quota controls total amount over a longer time: for example, no more than 100,000 calls per month or 10 gigabytes of data per week. It enforces a business plan. Many products use both: a monthly quota for the contract, and a per-minute rate limit to prevent bursts. You can count by subscription, by caller IP address, or by a custom key such as a user identifier.

Mocking and transformation

A mock response policy returns a made-up example answer without calling any backend. It lets front-end developers start work before the real service exists. Transformation policies let you modernize without rebuilding. Suppose an old backend only speaks XML but new clients prefer JSON. A policy can convert the format both ways. Suppose a backend returns internal fields such as database IDs that you do not want to show; an outbound policy can remove them. Suppose the backend lives at a long awkward address; a rewrite policy can present a short clean one.

Retry and timeout

A retry policy tries again when a backend fails with a temporary error, using a delay that grows between attempts. It helps with short glitches, but must be used with care: retrying a request that creates a payment twice could charge a customer twice, so retry only operations that are safe to repeat. A timeout sets the longest time the gateway will wait for a backend, so that slow services do not hold up resources.

Protect

Access policies

Validate tokens, restrict by address, require certificates.

Shape

Transformation

Change formats, headers, addresses, and bodies.

Speed

Caching

Remember repeat answers and return them instantly.

Survive

Resilience

Retry, time out, and break the circuit to a sick backend.

Observe

Logging and metrics

Record events and custom measurements.

Pretend

Mocking

Return example answers before real services exist.

Analogy

The receptionist has a drawer of tools: a stamp to check the key card, a counter for requests, a translator for foreign guests, a notebook of frequently asked answers, and a telephone to try another department if the first line is busy. Each tool is simple; skill lies in using the right ones in the right order.

!
Warning

Heavy transformation logic inside policies is hard to test and maintain. Keep policies for small, clear tasks. If you find yourself writing pages of expressions, move that work into a proper backend service.

10Versions and Revisions

APIs must change over time. These two features let you change without breaking the people who depend on you.

Every API grows. New fields are added, old ones removed, rules tightened. If you change an API suddenly, every client that relied on the old behavior may stop working. API Management gives two tools to manage change, and it is important not to confuse them.

A revision is a safe working copy of an API for making non-breaking changes, such as fixing a description, adding an optional field, or adjusting a policy. You create a new revision, edit and test it using its own special address, and when you are happy you make it current, so that it replaces the old one for all callers. Older revisions are kept in a list, so you can see the history and, if needed, switch back. Revisions can have change log notes visible in the developer portal.

A version is a separate public edition of the API for breaking changes, such as removing a field or changing the meaning of a response. The old version continues to run exactly as before, so existing clients keep working, while new clients use the new version. Clients select the version in one of three ways: a segment in the path (such as /v1/orders and /v2/orders), a query string value (such as ?api-version=2), or a header. You group versions into a version set that tells APIM how to read the version. When the old version has had enough warning time, you retire it.

FeatureUse it forSeen by consumers?Example
RevisionSafe, small, non-breaking changes and testingOnly after you make it currentFix a typo, add an optional filter, change a cache time
VersionBreaking changes that need a new public editionYes, clients choose a versionRename a field, remove an operation, change a data type
Version scheme: pathClear, easy to see and cacheYes/v1/orders and /v2/orders
Version scheme: header or querySame address, version chosen by a valueYesapi-version=2
Analogy

A revision is correcting a typo in the hotel menu and reprinting it overnight. A version is launching a completely new menu while keeping the old one on offer in the old restaurant for regular customers who like it. You do not close the old restaurant on the same day you open the new one.

i
Tip

Announce deprecation early, show it in the developer portal, and add a response header that warns callers of the old version. Measure usage of the old version with analytics so you know when it is safe to retire.

11Authentication and Authorization

Two questions guard every API: who are you, and what are you allowed to do?

Authentication means proving who you are. Authorization means deciding what you are allowed to do once you are known. API Management supports several methods for each, and strong designs use more than one.

MethodHow it worksStrengthWeakness
Subscription keyA secret string sent in a headerSimple, good for identifying and metering consumersCan be copied if leaked; no user identity
OAuth 2.0 with JWTA signed token issued by an identity provider is sent with each call and verified by the gatewayStrong, short-lived, carries user and permission informationNeeds an identity provider and careful setup
Client certificateThe client proves identity with a certificate during the secure connectionVery strong for system-to-system callsCertificates must be managed and renewed
IP restrictionOnly allowed network addresses are acceptedEasy extra layerAddresses can change or be shared
Mutual TLS and private networkTraffic stays on a private pathReduces exposure to the internetExtra network design

The most common modern setup uses OAuth 2.0, an industry standard for delegated access, and OpenID Connect, which adds user identity on top. In this setup, a client first signs in with an identity provider such as Microsoft Entra ID, and receives an access token. A token that follows the JWT (JSON Web Token) format is a signed piece of text that contains claims, which are facts about the user and the request: the user’s name, the audience the token was made for, the expiry time, and assigned roles or scopes. The client sends this token with each call. The gateway’s validate JWT or validate Entra token policy checks the signature using the provider’s public keys, confirms the audience and expiry, and may require certain claims. If the token passes, the gateway lets the call proceed. If not, the call is rejected before reaching the backend. This keeps the load and the risk away from the backend and gives you one consistent place to enforce rules.

The gateway to the backend

The gateway must also prove itself to the backend. One safe method uses a managed identity, an identity automatically created for the APIM instance in Microsoft Entra ID, with no password to store. The gateway gets a token for this identity and sends it to the backend, which trusts only calls that come with a valid token from the gateway. Other options include client certificates and shared secrets stored in Key Vault. There is also a feature called the credential manager that stores and refreshes connections to other services that need OAuth, so the gateway can call outside services on behalf of a user or application without developers handling tokens by hand.

flowchart TB
    U["User signs in"] --> IDP["Identity provider - Entra ID"]
    IDP -->|"access token"| APP["Client app"]
    APP -->|"call with token and key"| GW["APIM gateway"]
    GW --> V{"Token valid? Audience and claims correct?"}
    V -->|"No"| R["Reject with 401 or 403"]
    V -->|"Yes"| MI["Get managed identity token for backend"]
    MI --> BE["Backend accepts only gateway identity"]
    
Figure 4. Layers of identity: the user proves who they are to the gateway, and the gateway proves itself to the backend.
Analogy

A subscription key is the room number you quote at the desk: handy, but anyone who overhears it can repeat it. A signed token is a passport with a stamp that the desk can verify with a special light. The hotel’s own staff badge, held by the receptionist, is what the kitchen checks before accepting an order from the front desk.

!
Warning

Always check the token’s audience and issuer, not only its signature. A token valid for another application is still correctly signed, but it was never meant for your API, and accepting it is a common mistake.

12The Developer Portal

An API nobody can find or understand is an API nobody uses. The portal is the shop window.

The developer portal is a website that API Management generates for you. It is designed for people who write programs that call your APIs. On it, a visitor can browse the list of APIs and products that you have published, read documentation built automatically from the API definitions, see example requests and responses in popular programming languages, and use an interactive test console to send real calls straight from the browser. Developers can sign up and sign in, using the built-in user system or an outside identity provider such as Microsoft Entra ID or social accounts. Once signed in, they can subscribe to a product, wait for approval if your rules require it, and see and regenerate their own keys. They can also view usage reports for their subscriptions.

The portal can be customized. A visual editor lets you change the layout, colors, logo, and text, add pages like “Getting started” or “Terms of use”, and show content from your own documentation. It supports publishing: you edit a draft, then publish the changes to the public site. For teams that want complete control, the portal can be self-hosted, meaning you take its source code and run it yourself with your own look and extra features. Since the portal is a public-facing website, protect it as you would any other website: control who can sign up, and keep sensitive APIs hidden by product visibility rules.

Discover

Browse APIs

Find the right API and read clear, generated documentation.

Try

Test console

Send a real call from the browser and see the answer.

Join

Sign up and subscribe

Create an account, request a product, and get keys.

Brand

Customize

Change design, add pages, and use your own domain name.

Analogy

The developer portal is the hotel’s welcome lounge, with a brochure stand, a friendly booking desk, and a demo room where visitors can try a service before they commit. Great services with a locked lounge and no brochures stay empty.

Everyday example: partner onboarding in an hour

A logistics company gives partners access to its tracking API. Before API Management, onboarding took two weeks of emails and spreadsheet keys. Now the partner opens the portal, signs up, selects the “Partner” product, an administrator approves it, and the partner is making test calls within an hour. The company also sees, in analytics, which partners use which operations.

13Backends, Load Balancing, and Circuit Breakers

The gateway does not just forward calls. It can spread them across several copies and protect backends that are struggling.

A backend entity in API Management is a saved description of a service the gateway talks to: its address, the credentials to use, and its settings. By defining a backend once and referring to it by name, you can change the address in one place instead of in every API. Backends can be Azure services, services in other places, or even an Azure OpenAI deployment.

You can group several backends into a backend pool for load balancing, which means spreading the calls among several copies of the same service so no single copy is overloaded. The gateway can distribute calls in a round-robin way (each copy takes a turn), by weights (a stronger copy gets more), or by priority (use the main copy and switch to a secondary only when the main one fails). The same mechanism supports gradual rollouts: send ten percent of traffic to a new backend, watch the results, and increase.

A circuit breaker is a safety feature named after the switch in an electrical box. If a backend keeps failing, for example by returning many server errors within a short time, the breaker “trips” and the gateway stops sending calls to it for a set time, returning errors immediately or sending calls to other backends in the pool. This gives the struggling service time to recover instead of being hammered by retries, and protects clients from waiting for long timeouts. After the pause, the gateway tries a few calls, and if they succeed, the circuit closes again.

flowchart TB
    GW["APIM gateway"] --> POOL["Backend pool"]
    POOL --> B1["Backend copy 1 - priority 1"]
    POOL --> B2["Backend copy 2 - priority 1"]
    POOL --> B3["Backend copy 3 - priority 2 standby"]
    B1 -. "too many errors" .-> CB["Circuit breaker trips for a pause"]
    CB -.-> POOL
    
Figure 5. A pool of backends, with a standby copy and a circuit breaker for the one that fails.
TechniqueProblem it solvesCaution
Round-robin poolOne copy overloadedCopies should be identical and stateless
Weighted poolCopies differ in power, or gradual rolloutAdjust weights with monitoring
Priority poolNeed a standby or a backup regionTest the failover path regularly
Circuit breakerA failing backend gets even more trafficSet sensible thresholds, or you may trip too easily
RetryShort, temporary glitchesOnly for safe, repeatable calls, and with delays
TimeoutSlow backends hold up the gatewayChoose a time that fits normal behavior
Analogy

Load balancing is the receptionist sharing taxi requests among several taxi drivers. A circuit breaker is the receptionist noticing that driver number three has had three breakdowns in a row, and giving that driver a break from the list for fifteen minutes. Guests are served faster, and driver three has time to fix the car.

14Networking, Private Access, and Multiple Regions

Where the gateway lives on the network decides who can reach it and what it can reach.

By default, an API Management instance has a public address on the internet. That is fine for public APIs, but many organizations need more control. A virtual network, or VNet, is your private network inside Azure. API Management offers several ways to connect to it, depending on the tier. In external mode, the gateway sits inside your network but still has a public address, so the internet can reach it, and it can reach private backends inside the network. In internal mode, the gateway has only a private address, so only callers inside your network, or those connected through VPN or ExpressRoute, can reach it. The newer tiers also support private endpoints, which give the instance a private address in your network for incoming traffic, and outbound integration into a network for calling private backends. Exact options differ by tier, so check the current comparison.

A common design for internet-facing APIs is to place Azure Application Gateway or Azure Front Door in front of an internal APIM. These services add a web application firewall, or WAF, which blocks well-known attacks such as injection of malicious code, and Front Door adds global routing and caching at the network edge. Behind them, APIM stays private and does the API-specific work of tokens, limits, and policies.

For high availability, the Premium tier supports availability zones, which spread the units across separate buildings within one Azure region, and multi-region deployment, which adds gateway units in other regions that share the same configuration. Clients can reach the nearest or healthiest region through a traffic manager such as Front Door. The management plane remains in the primary region, but the gateways in other regions continue to serve traffic with the last known configuration if the primary region has trouble.

flowchart TB
    USERS["Internet users"] --> FD["Front Door or Application Gateway with WAF"]
    FD --> APIM1["APIM gateway - Region A, internal"]
    FD --> APIM2["APIM gateway - Region B, internal"]
    APIM1 --> PB["Private backends in VNet"]
    APIM2 --> PB2["Private backends in VNet"]
    ONPREM["On-premises network"] -->|"VPN or ExpressRoute"| APIM1
    
Figure 6. A protected design: internet traffic passes a firewall, then reaches internal gateways in two regions that call private backends.
PatternWho can callTypical use
Public, no networkAnyone with credentialsPublic APIs, simple projects
VNet external modeInternet to gateway, gateway to private backendsPublic APIs with private backends
VNet internal modeOnly private networksInternal enterprise APIs
Private endpointPrivate network access to the front door of APIMLocking down inbound access in newer tiers
Front Door or Application Gateway in frontInternet users via a firewallPublic APIs needing a WAF and global reach
Analogy

Public mode is a reception desk on the street. Internal mode is a reception desk inside a gated compound where you must first pass the main gate. A firewall in front is a security guard at the compound gate, and multiple regions are branch hotels in other cities that follow the same rules and keep working if one city has a power cut.

!
Warning

Network rules for API Management need exact ports and routes open, for both management traffic and service dependencies. Missing a rule can make the instance unhealthy. Follow Microsoft’s current network configuration list and test before production.

15Self-Hosted Gateways, Workspaces, and Hybrid Setups

Not every API lives next to the managed gateway. Two features let you place the gateway where you need it and share one platform among many teams.

The self-hosted gateway is a container version of the API Management gateway that you run yourself. A container is a lightweight, portable package that holds a program and everything it needs to run. You can place the self-hosted gateway in your own data center, in another cloud, or on an edge location such as a factory floor, usually using Kubernetes, a popular system for running containers, or Docker. The self-hosted gateway connects back to the management plane in Azure to receive configuration, and sends back some health and usage information. The policies, products, and developer portal remain the same, so API owners manage one set of rules for all gateways, managed and self-hosted.

Why would you want this? First, latency: if your backends sit in your own data center, sending every call up to an Azure gateway and back wastes time. Second, compliance: some rules demand that certain data never leaves a building or a country. Third, multi-cloud: your backends may be spread over several clouds, and you want a gateway close to each. Fourth, gradual modernization: legacy systems stay where they are, but wear a modern API front. The cost is that you must run, patch, scale, and monitor the self-hosted gateways yourself. A self-hosted gateway needs a tier that supports it, usually Premium or Developer, and it can continue to serve requests for a period even if it loses contact with the cloud, using its last known configuration.

Workspaces solve a different problem. In a large company, one central platform team may own the API Management instance, while many product teams want to publish their own APIs quickly. A workspace is a named area inside one instance, with its own APIs, products, subscriptions, named values, and policies, managed by a team with limited access. The platform team keeps control of the shared parts such as the gateway, the network, and global policies, while each team works independently inside its workspace. Workspaces can even have their own dedicated gateways in newer offerings, so a heavy user cannot slow down others.

FeatureSolvesWho runs what
Managed gatewayDefault, simple operationMicrosoft runs the gateway; you manage the rules
Self-hosted gatewayBackends elsewhere, strict data location, low latencyYou run the container; Azure holds the configuration
WorkspacesMany teams, one shared platformPlatform team runs the instance; teams manage their workspace
Multiple instancesHard separation by business unit, region, or environmentEach instance has its own owner and bill
Analogy

The self-hosted gateway is a branch reception desk opened in your factory’s front hall, following the same rule book as head-office reception. Workspaces are separate offices inside one large building, each manager free to arrange their own desk, while the building owner keeps the lifts, the locks, and the fire rules.

i
Tip

Treat self-hosted gateways like any production workload: run at least two copies, keep the container image updated, set resource limits, and forward their logs to the same monitoring system as the managed gateway.

16Caching, Performance, and the AI Gateway

Speed comes from not doing the same work twice. The gateway is a perfect place to remember answers and to manage costly new kinds of calls.

A cache is a place that stores copies of answers so they can be returned quickly the next time the same question is asked. API Management has a built-in cache, and you can connect an external cache such as Azure Cache for Redis for larger or shared storage across gateway units and regions. With caching policies you tell the gateway to store a response for a set time, and to vary the stored copy by things like query values, headers, or user. When the same request arrives within the time, the answer comes straight from the cache. The backend does no work, and the client gets a reply in a few milliseconds. This works best for data that changes slowly and is requested often, such as product catalogs, currency lists, and public reference data.

Caching needs care. Never cache personal or private responses in a way that allows one user to receive another’s data. Choose cache times based on how fresh the data must be, and plan how to remove stale items when data changes. Other performance habits include compressing responses, keeping policies light, placing the gateway in the same region as the backends, using connection reuse, and sizing units according to measured load.

The AI gateway use case

Many organizations now call large language models, which are AI systems that understand and generate text, such as those available through Azure OpenAI. These calls are costly, they are measured in tokens (small pieces of text that the model reads and writes), and they have limits on how many tokens can be used per minute. API Management is increasingly used as an AI gateway, a front door for such calls. With special policies, the gateway can limit the number of tokens per client, so one team cannot use up the shared quota; record how many tokens each team uses for cost sharing; spread calls across several model deployments and regions with load balancing and circuit breakers; keep a semantic cache, which can return a stored answer for a new question that means nearly the same as an earlier one; and apply content safety checks. Exact policy names and availability change quickly in this area, so check current documentation.

Cache
Answer repeat questions without the backend
Redis
External cache for sharing across units and regions
Tokens
Meter and limit AI model use per client
Analogy

Caching is the receptionist keeping a printed copy of “What time does the spa open?” on the desk, instead of walking to the spa every time someone asks. The AI gateway is the same receptionist handling a very expensive consultant: she keeps count of how many minutes each department uses, shares the work between several consultants, and remembers answers to questions that sound alike.

!
Warning

Cache keys must include everything that changes the answer, including the user when data is personal. A cache key that leaves out the user identity can show one customer another customer’s data, which is a serious privacy breach.

17Security and Threat Protection

The gateway is the front line. Good security here protects every backend behind it.

Think of security in layers, like the layers of an onion. The outer layer is network protection: a web application firewall in front, a private network where possible, and restrictions on who can reach the management endpoints. The next layer is identity: strong token validation, client certificates for systems, and subscription keys for metering. The next is request checking: validate that each request follows the API’s shape, with the right fields, types, sizes, and values, and reject anything else. Content validation policies can compare a request’s body with the API’s schema, block oversized bodies, and reject unexpected parameters, which stops many injection attempts early. Finally comes data protection: hide secrets in named values backed by Key Vault, remove sensitive fields from responses, encrypt traffic in transit with modern TLS versions only, and turn off old weak protocols and ciphers.

The security community maintains a list called the OWASP API Security Top 10, describing the most common API weaknesses. These include broken object-level authorization (a user can read another user’s records by changing an ID in the address), broken authentication, excessive data exposure (returning more fields than needed), lack of rate limiting, broken function-level authorization (a normal user can call an admin operation), and misconfiguration. API Management helps with many of them: token validation for authentication, claim checks for authorization, outbound field removal for data exposure, rate limits and quotas for resource limits, and schema validation for malformed input. However, some weaknesses, such as a backend that forgets to check object ownership, must still be solved in the backend. The gateway is a strong layer, not a replacement for secure code.

Two more points deserve mention. First, management access: use Azure role-based access control to give people the smallest role they need, such as reader, contributor for specific tasks, or a role limited to a workspace, and turn on multifactor sign-in for administrators. Second, threat detection: Microsoft Defender for APIs can analyze traffic to API Management and warn about suspicious behavior, unused or unauthenticated APIs, and sensitive data exposure. Check current capabilities and pricing before relying on it.

Layer 1

Network

Firewall in front, private access, restricted management endpoints.

Layer 2

Identity

Token validation, certificates, keys, and managed identity to backends.

Layer 3

Request checks

Schema validation, size limits, allowed methods, and rate limits.

Layer 4

Data

Remove sensitive fields, keep secrets in Key Vault, enforce modern TLS.

Layer 5

Governance

Least-privilege roles, change review, and activity logs.

Layer 6

Detection

Defender for APIs, alerts on spikes in errors and unusual callers.

Analogy

Hotel security is more than a lock on the door. There is a fence, a guard at the gate, a key card at each floor, a safe in the room, cameras in the hallways, and a log of every visitor. If one layer fails, another still stands.

!
Warning

Do not rely on the gateway alone. If a backend can be reached directly from the internet, an attacker will skip the gateway. Make the backend accept calls only from the gateway, using private networking or verification of the gateway’s identity.

18Monitoring, Logging, and Analytics

You cannot improve or defend what you cannot see. API Management produces rich information, and Azure gives you places to read it.

Observability, the ability to understand a system from the signals it produces, rests on three kinds of signal. Metrics are numbers over time, such as total requests, failed requests, capacity used, and gateway response time. Logs are detailed records of individual events, such as one line per request with its address, status, and duration. Traces follow one request across many services, showing where the time went. API Management feeds all three into Azure Monitor and Application Insights.

ToolWhat it givesBest for
Built-in analytics in the portalCharts of requests, errors, latency, by API, operation, product, and subscriptionQuick view and usage reports
Azure Monitor metricsNumeric time series with alert rulesAlerts on capacity and error rates
Diagnostic settings to Log AnalyticsGateway logs, which you search with queriesInvestigations and dashboards
Application Insights loggerRequest, dependency, and exception telemetry, and end-to-end traces with the backendFinding slow spots across services
Event Hubs loggerStreams custom events to other systemsFeeding a SIEM or data lake
Activity logWho changed which settingAuditing management actions
Custom metrics from policiesYour own measurements with chosen labelsBusiness-level views, like calls per customer

What to watch

1

Request volume

Sudden jumps or drops may mean an attack, a bug, or an outage upstream.

2

Error rates by type

Client errors (400s) show misuse or broken clients. Server errors (500s) show backend or gateway trouble.

3

Latency

Split gateway time from backend time. A slow gateway and a slow backend need different fixes.

4

Capacity

Watch the capacity metric. Sustained high values mean it is time to add units or scale.

5

Rate limit hits

Many 429 responses reveal heavy users or limits set too tightly.

6

Backend health

Track circuit breaker trips and retries to catch sick services early.

Logging has a cost, both in money and in speed. Logging every body of every request can expose private data and slow the gateway. Log what you need: identifiers, status codes, timings, and selected headers. Use sampling, which records only a percentage of calls, for high-volume APIs. Add a correlation identifier, a unique value passed from the client through the gateway to the backend, so that a single call can be followed across all systems.

Analogy

The manager reads the reception log every morning: how many guests, which services were popular, how many complaints, how long the longest wait was. A good log is detailed enough to explain a problem, but does not copy down guests’ private conversations.

i
Tip

Create alerts for the few signals that matter most: capacity above a threshold, a rise in server errors, and a sudden drop in total requests. A drop is often more worrying than a rise, since it can mean clients cannot reach you at all.

19Reliability and Failure Scenarios

Because everything passes through the gateway, its health matters enormously. Plan for the day something breaks.

The gateway is a single point of entry, which makes it both powerful and risky. The service is designed for high availability, and Microsoft offers a service level agreement, a promise of uptime, for most production tiers, with higher promises when you use multiple zones or regions. But your own design decides how well you survive trouble. The key ideas are redundancy (more than one of everything important), isolation (one failure should not spread), and graceful degradation (when part of the system fails, the rest keeps giving a reduced but useful service).

A

A backend is down

Use health checks, circuit breakers, and standby backends. Return a clear error or a cached answer instead of a long wait.

B

A backend is slow

Set timeouts and use caching. Without timeouts, slow calls pile up and use all gateway capacity.

C

A traffic surge

Use rate limits per caller, autoscale where available, and keep spare capacity. Cache popular answers.

D

A bad policy change

Test on a revision, review changes, and keep configuration in source control so you can roll back quickly.

E

An expired certificate or secret

Track expiry dates, use Key Vault with automatic rotation, and set alerts well before expiry.

F

An identity provider problem

The gateway caches signing keys for a time. Know how long, and plan for what happens to new sign-ins if the provider is unreachable.

G

A zone or region outage

Use availability zones and multiple regions in Premium, with a traffic manager that detects unhealthy regions.

H

Accidental deletion

Use resource locks, restricted roles, and regular backups of the configuration, plus configuration as code.

Back up the configuration of the instance regularly, either with the built-in backup feature or, better, by keeping everything as code in a repository, so you can rebuild in a new instance or region within hours. Practice the rebuild; an untested recovery plan is only a hope. Also design your clients to behave well: they should retry with growing delays and respect the “retry after” hint when told to slow down, rather than hammering a gateway that is already struggling.

Analogy

A hotel plans for a power cut with a generator, for a sick receptionist with a second person on the rota, and for a flooded floor by moving guests to another wing. Guests may notice a short delay, but not a disaster. The plan is practiced, not just written.

20DevOps, Automation, and APIOps

Clicking in a portal does not scale. Mature teams treat their APIs and policies as code.

Editing settings by hand in the Azure portal is fine for learning, but it is risky for production: there is no review, no history, and no easy way to repeat the same setup in another environment. APIOps applies the habits of software delivery to APIs. The definitions of APIs, policies, products, and named values are stored as files in a repository such as GitHub or Azure Repos. Changes are made in a branch and reviewed by a colleague through a pull request. A pipeline then validates the files and deploys them to a test instance, runs automated tests, and after approval deploys to production. The same files can be used for every environment, with small environment-specific values replaced at deploy time.

Several tools support this. Azure Resource Manager templates, Bicep, and Terraform can create the instance and its configuration. The Azure command-line tools and the management API can script changes. A Microsoft-supported APIOps toolkit can extract an existing instance into files and publish them back. Policies can be stored as XML files and policy fragments. Automated tests can call the API in the test environment and check the answers, including security tests that confirm unauthorized calls are rejected. Linting tools can check API definitions against your company’s style rules, for example that every operation has a description and uses the agreed naming.

flowchart LR
    DEV["Developer edits API files and policies"] --> PR["Pull request and review"]
    PR --> CI["Pipeline - lint, validate, security checks"]
    CI --> TEST["Deploy to test instance"]
    TEST --> AUTO["Automated API tests"]
    AUTO --> APPROVE["Approval"]
    APPROVE --> PROD["Deploy to production instance"]
    PROD --> MON["Monitor and learn"]
    MON -.-> DEV
    
Figure 7. An APIOps flow: every change is reviewed, tested, and deployed the same way.
Analogy

Managing a hotel’s rules by scribbling on the one copy of the rule book is risky. APIOps is a printed rule book with edit history, a second manager signing off each change, a trial run in a spare wing, and identical copies for all branches.

i
Tip

Make the repository the single source of truth, and limit direct portal edits in production to emergencies. Detect “drift”, differences between the live instance and the repository, and fix it quickly.

21Cost and Pricing

Costs depend mostly on the tier and the number of units, not on how many APIs you add. Choose the size to fit your traffic.

Pricing varies by tier. In the Consumption tier you pay per call, with a free monthly allowance, so a lightly used API costs very little, and an idle one costs nothing. In the other tiers, such as Developer, Basic, Standard, and Premium, you pay a fixed hourly price per unit, whether or not traffic arrives, so you pay for reserved capacity. Premium units cost far more than Basic or Standard units, and additional regions are billed as additional units. The newer v2 tiers have their own pricing structure. Because prices, units, free grants, and limits change, always use the official pricing page and the Azure pricing calculator for current numbers.

Other costs sit around the instance. Application Insights and Log Analytics charge by the amount of data stored. Azure Front Door or Application Gateway charge for their own capacity and data. A Redis cache has its own monthly price. Private networking, such as ExpressRoute or VPN gateways, adds cost. Data leaving Azure incurs network transfer charges. Self-hosted gateways need the compute you run them on. Defender for APIs and Azure OpenAI usage, if used, are billed separately.

Cost leverWhat to do
Choose the lowest tier that meets needsDo not buy Premium only for one feature you can replace by design; but do not run a serious production system on Developer
Right-size unitsWatch the capacity metric and adjust units; use autoscale where it exists
Use cachingFewer backend calls and lower gateway load
Share instances wiselyOne instance with workspaces is cheaper than many small ones, if isolation needs allow
Use Consumption for spiky or small usePay per call instead of paying for idle capacity
Trim loggingSample high-volume logs and avoid logging bodies
Clean up test instancesDelete or scale down development and test instances when not needed
Consider reservationsSome tiers support commitment discounts; check availability
Analogy

Running a Consumption instance is like paying a taxi per ride. Running a Premium instance is like employing a full-time team of drivers: much faster and more reliable at scale, but you pay even on quiet days. Pick the arrangement that matches how often you actually travel.

!
Warning

An idle Premium instance left running in a test subscription can cost a surprising amount every month. Use budgets and alerts, tag instances with an owner, and review them regularly.

22Design Patterns and Anti-Patterns

Teams that have run many gateways keep finding the same good ideas and the same traps.

Patterns that work

  • Gateway offloading. Move common work such as token checks, rate limits, and logging to the gateway, so every backend stays simpler.
  • Backend for frontend. Offer a tailored API for each kind of client, such as mobile and web, built from the same backends.
  • API composition. Combine several backend calls into one clean call for the client, while keeping heavy logic in a proper service.
  • Strangler façade. Put the gateway in front of a legacy system, then replace its parts one by one behind the same public address.
  • Defense in depth. Firewall, token checks, schema validation, and backend verification all work together.
  • Contract first. Design the API definition before the code, review it, and import it to the gateway.
  • Products as plans. Free, standard, and premium products with different limits and approval rules.
  • APIs as code. Keep definitions and policies in a repository and deploy through pipelines.

Anti-patterns to avoid

  • The god gateway. Putting business logic in policies until nobody can understand or test them.
  • Gateway bypass. Leaving backends open to direct internet calls so attackers skip the gateway.
  • Keys as the only security. Relying on subscription keys for sensitive data.
  • Everything in global scope. A single mistake affects every API.
  • No versioning plan. Breaking clients with sudden changes.
  • One instance for all environments. Test and production sharing the same gateway and rules.
  • Unlimited access. No rate limits or quotas, so one client harms all.
  • Secrets in policy text. Passwords written directly inside rules instead of named values from Key Vault.
Analogy

A well-run reception desk checks keys, directs requests, and keeps a log, but does not cook the meals. A reception desk that also tries to cook, clean, and repair the plumbing becomes slow, confused, and impossible to replace.

23Best Practices and Common Mistakes

A short checklist from experienced teams, followed by the slips that cost beginners the most.

BP-1Do

Choose the tier from your requirements: network mode, number of regions, expected traffic, and need for a self-hosted gateway. Write the reasons down.

BP-2Do

Use token-based authentication for user and sensitive data, subscription keys for metering, and managed identity between the gateway and backends.

BP-3Do

Store secrets and certificates in Key Vault and reference them through named values. Never paste secrets into policy files.

BP-4Do

Set rate limits, quotas, timeouts, and request size limits on every public API, even if the first version seems low risk.

BP-5Do

Use revisions for safe changes and versions for breaking ones. Publish a deprecation policy, and measure usage before retiring anything.

BP-6Do

Separate environments: development, test, and production should have different instances, and ideally different subscriptions, with the same code deployed through pipelines.

BP-7Do

Send logs to a central place, add a correlation identifier, create alerts on error rates and capacity, and review dashboards weekly.

Mistakes that cost the most

1

Using the Developer tier in production

It has no uptime promise and is not built for real traffic. Use it for learning only.

2

Forgetting policy order

A logging rule placed after a rule that stops the request never runs. Review the effective policy for each operation.

3

Not inheriting parent policies

A policy at a lower scope that forgets to include the parent’s rules silently removes global protection.

4

Caching private data without a user key

One customer sees another’s answer. Always include identity in the cache key for personal data.

5

Retrying unsafe calls

Retrying a payment request can charge twice. Retry only repeatable operations, or use idempotency keys.

6

Exposing the management endpoint widely

Restrict access to the management plane and use strong sign-in for administrators.

7

Ignoring certificate expiry

An expired certificate on a custom domain stops every client at once. Track and automate renewal.

8

No owner for each API

Without an owner, nobody fixes problems or retires old versions. Record an owner in the API description.

24API Management Compared with Other Tools

Several products sit near API Management. Knowing the neighbors helps you place each one correctly.

ToolWhat it isCompared with API Management
Azure Application GatewayA regional web traffic load balancer with a web application firewallWorks at the web traffic level, not at the API product level; often placed in front of API Management
Azure Front DoorA global entry point with routing, caching, and a firewallGlobal edge delivery and protection; complements API Management rather than replacing it
Azure Load BalancerA basic network-level load balancerHandles network packets, with no knowledge of APIs, keys, or tokens
Azure Functions or Logic Apps with HTTP triggersCode or workflows that expose web endpointsCan be backends behind API Management, which adds products, limits, and a portal
Azure Kubernetes ingress controllers and service meshesTraffic control inside a clusterGood for traffic between services in a cluster; API Management serves external and cross-team API consumers
AWS API GatewayAmazon’s managed API gatewaySimilar idea in AWS; strong with Lambda and AWS services
Google ApigeeA full API management platform, from Google CloudComparable depth for monetization and analytics; a different ecosystem
Kong, NGINX, and other open-source gatewaysSelf-managed gateways with plugin systemsFlexible and portable; you run them, and usually need to add portal and analytics pieces

Often the right answer is to combine tools. A frequent arrangement is Front Door at the global edge, Application Gateway with a firewall inside the region, API Management for API policies and products, and the backends behind it. Product names, features, and boundaries change, so check each vendor’s current documentation before deciding.

Analogy

Front Door is the hotel’s front gate and city signposts. Application Gateway is the security check at the entrance of the building. API Management is the reception desk with rules, key cards, and a brochure stand. The load balancer is the traffic marshal who spreads cars across several car parks. Each has a different job, and a great hotel has all of them.

25Real-World Examples, and When to Use It

Three stories show how the pieces fit, followed by a quick guide to when this service is the right choice.

Example 1: A retailer with web, mobile, and partners

A retailer has an online shop, a mobile app, and a hundred delivery partners. All call the same order and inventory services. The team places API Management in front of them. The mobile app uses Entra sign-in and token checks. Partners use the “Partner” product with approval, subscription keys, and a quota. Prices and product lists are cached for five minutes. The result is one set of rules, a partner portal that cut onboarding from weeks to hours, and graphs that show which partner causes the heaviest load.

Example 2: A bank modernizing an old core system

A bank runs a thirty-year-old core system that speaks only SOAP and XML. Using a self-hosted gateway in its data center and an internal APIM in Azure, it publishes modern JSON APIs. Policies convert formats and hide internal fields. A web application firewall and private networking protect the entrance. Mutual TLS secures calls between systems. Over time, the bank replaces parts of the core behind the same public addresses, and customers never see the change.

Example 3: A company sharing AI models fairly

A company provides several AI model deployments for its teams. API Management acts as an AI gateway: each team gets its own subscription and token limit per minute, usage is recorded per team for cost sharing, and calls are spread across deployments in two regions with a circuit breaker for failures. A semantic cache answers common questions without calling the model again. Costs drop, and no single team can starve the others.

A simple decision guide

API Management is a strong fit when

  • You publish APIs to external partners, customers, or many internal teams.
  • You need one place for authentication, rate limits, quotas, and logging.
  • You want a developer portal and self-service subscriptions.
  • Your backends are mixed: Azure, on-premises, other clouds, legacy.
  • You need to control and meter access to AI models.

Think twice, or choose something simpler, when

  • You have one or two small internal APIs, and a basic web app or function URL would do.
  • You only need simple load balancing or a firewall; Application Gateway or Front Door may be enough.
  • Your traffic is entirely between services in a cluster; a service mesh may suit better.
  • Your budget is very small and you do not need advanced features; consider the Consumption tier first.
  • You want heavy business logic or workflows; build those as services behind the gateway.

26Frequently Asked Questions

Q1Is API Management the same as an API?

No. An API is a doorway into a program. API Management is a service that stands in front of many APIs to secure, control, and publish them. It does not usually contain your business logic.

Q2Do I need to change my backend code to use it?

Usually not. You describe or import your API in the gateway and add policies. Backends may need small changes, such as accepting calls only from the gateway and trusting the headers it adds.

Q3What is the difference between a rate limit and a quota?

A rate limit controls speed over a short window, such as calls per minute, to protect backends from bursts. A quota controls the total over a longer window, such as calls per month, to enforce a plan.

Q4When do I use a revision, and when a version?

Use a revision for safe, non-breaking edits that you want to test before releasing. Use a version for breaking changes, so old clients keep using the old edition while new clients use the new one.

Q5Are subscription keys enough for security?

No. Keys identify and meter callers but can be copied. For sensitive data, validate tokens from an identity provider, restrict access by network, and verify identity between the gateway and backends.

Q6Can it call backends on a private network?

Yes, with virtual network integration. The options depend on the tier, and some designs also use private endpoints and a firewall service in front. Plan the network before choosing the tier.

Q7What is the self-hosted gateway for?

It is a container version of the gateway that you run near backends in your data center, other clouds, or edge sites, while managing rules centrally in Azure. It reduces latency and helps with data location rules.

Q8How do I see who is using my APIs?

Use the built-in analytics, which can break down calls by API, operation, product, and subscription, and send logs to Log Analytics or Application Insights for deeper queries.

Q9How much does it cost?

The Consumption tier charges per call after a free allowance. Other tiers charge by the hour for each unit, with Premium costing the most. Logging, caches, firewalls, and network connections add to the total. Use the official pricing page for current numbers.

Q10What happens if the gateway fails?

Production tiers have uptime promises and can use zones and multiple regions. For best resilience, run several units, use a traffic manager across regions, and keep the configuration in code so you can rebuild quickly.

Q11Can I use it for AI models?

Yes. Many organizations use it as an AI gateway to limit and measure token use per team, balance calls across model deployments, and cache answers. Check the current policies and features, as this area is changing quickly.

Q12Should I manage it in the portal or as code?

The portal is fine for learning. For production, keep definitions and policies in a repository and deploy through pipelines, so every change is reviewed, tested, and repeatable.

27Summary and Key Takeaways

Azure API Management is the reception desk of your digital hotel: one front door that checks, shapes, limits, records, and presents your APIs.

We began with a hotel where guests talk to a reception desk instead of wandering into the kitchen. API Management plays that role for software. Its gateway handles the traffic, its management plane holds the rules, and its developer portal welcomes the people who use your APIs. We saw how products and subscriptions package access, how policies run in four sections to protect, reshape, cache, and record each call, and how tokens, certificates, and managed identities answer the questions of who you are and what you may do. We looked at versions and revisions for safe change, backend pools and circuit breakers for resilience, networking and regions for private and available designs, and self-hosted gateways and workspaces for hybrid and shared use. Finally we covered monitoring, cost, and APIOps, which turn a service into a well-run platform.

Put one well-guarded door in front of many services, keep the rules in code, and watch the log.

Key Takeaways

  • API Management is a managed service with three parts: a gateway for traffic, a management plane for configuration, and a developer portal for consumers.
  • Policies run in inbound, backend, outbound, and on-error sections and add security, limits, caching, and transformation without changing backend code.
  • Package APIs into products with subscriptions, and combine subscription keys for metering with token validation and managed identity for real security.
  • Use revisions for safe changes and versions for breaking ones, and plan deprecation with usage data.
  • Protect and scale with backend pools, circuit breakers, caching, private networking, firewalls in front, and Premium zones and regions where needed.
  • Monitor requests, errors, latency, and capacity, and keep configuration as code in a repository deployed by pipelines.
  • Pick the tier by network, region, and traffic needs, control logging and idle instance costs, and use the gateway for AI model access when it fits.