Loading...

Leverage Azure API Management to distribute API traffic to multiple backend services

Leverage Azure API Management to distribute API traffic to multiple backend services
 

Load-balanced pool

Limitation

Logico_jp_1-1706500276422.png

 

Circuit breaker

 

Limitation

Please refer to “NOTE” in the document for more details.

Azure API Management backends | Microsoft Learn

 

Configuration

Preparation

Circuit breakers

 

{ "type": "Microsoft.ApiManagement/service/backends", "apiVersion": "2023-05-01-preview", "name": "test1", "properties": { "description": "backend (test1)", "type": "Single", "protocol": "http", "url": "<URL1>/api/test", "circuitBreaker": { "rules": [ { "failureCondition": { "count": "3", "errorReasons": [ "Server errors" ], "interval": "PT5M", "statusCodeRanges": [ { "min": "500", "max": "599" } ] }, "name": "myBreakerRule", "tripDuration": "PT10M" } ] } } }

 

Load-balanced pool

 

{ "type": "Microsoft.ApiManagement/service/backends", "apiVersion": "2023-05-01-preview", "name": "backendPool", "properties": { "description": "Load balanced backends", "type": "Pool", "protocol": "http", "url": "http://localhost", "pool": { "services": [ { "id": "/backends/test1" }, { "id": "/backends/test2" } ] } } }

 

Let’s try it.

 

Logico_jp_0-1706500394476.png

How about using these features with retry policy?

 

 

<!-- retryCount is specified in Named Values. --> <!-- Load-balanced pool "backendPool4AOAI" is already configured --> <policies> <inbound> <base /> <set-backend-service backend-id="backendPool4AOAI" /> <set-variable name="retryCount" value="@(int.Parse(" {{retryCount}}"))" /> <set-variable name="maxRetryCount" value="@((int)context.Variables[" retryCount"] -1)" /> <authentication-managed-identity resource="https://cognitiveservices.azure.com" output-token-variable-name="msi-access-token"ignore-error="false" /> <set-header name="Authorization" exists-action="override"> <value>@("Bearer " + (string)context.Variables["msi-access-token"])</value> </set-header> </inbound> <backend> <retry condition="@(context.Response.StatusCode >= 300)" count="@((int)context.Variables[" maxRetryCount"])" interval="1" max-interval="10" delta="1" first-fast-retry="false"> <!-- forward request and request body is stored for retry --> <forward-request buffer-request-body="true" /> </retry> </backend> <outbound> <base /> </outbound> <on-error> <base /> </on-error> </policies>

 

Logico_jp_0-1706498833372.png

Conclusion

Published on:

Learn more
Azure Architecture Blog articles
Azure Architecture Blog articles

Azure Architecture Blog articles

Share post:

Related posts

Easily connect AI workloads to Azure Blob Storage with adlfs

Microsoft works with the fsspec open-source community to enhance adlfs. This update delivers faster file operations and improved reliability f...

8 hours ago

Microsoft Azure Fundamentals #3: Maximizing Event-Driven Architecture in Microsoft Power Platform

🧩 1. Overview Event-driven architecture (EDA) transforms how systems communicate.Instead of traditional request–response or batch integration...

14 hours ago

Azure Developer CLI (azd) – October 2025

This post announces the October release of the Azure Developer CLI (`azd`). The post Azure Developer CLI (azd) – October 2025 appeared f...

1 day ago

Microsoft Azure Fundamentals #2: Designing Real-Time Bi-Directional Sync Between Dataverse and Azure SQL for Multi-Region Deployments

Here’s a detailed technical breakdown of designing a real-time bi-directional sync between Dataverse and Azure SQL for multi-region deployment...

1 day ago

Azure DevOps local MCP Server is generally available

Today we are excited to take our local MCP Server for Azure DevOps out of preview 🥳. Since the initial preview announcement, we’ve work...

2 days ago

Announcing the new Azure DevOps Server RC Release

We’re excited to announce the release candidate (RC) of Azure DevOps Server, bringing new features previously available in our hosted version....

8 days ago

How to Integrate Azure Service Bus with Microsoft Dynamics 365 CRM Step by Step with Example?

Keeping data flowing between applications is critical in today’s connected business world. Organizations using Microsoft Dynamics 365 CR...

11 days ago

Enhancing Secure Sign-Ins with Temporary Access Pass in Azure Active Directory

Introduction While working on improving user account recovery scenarios, a common challenge often arises: how to securely allow a user to sign...

12 days ago
Stay up to date with latest Microsoft Dynamics 365 and Power Platform news!
* Yes, I agree to the privacy policy