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

Azure Developer CLI (azd) Dec 2025 – Extensions Enhancements, Foundry Rebranding, and Azure Pipelines Improvements

This post announces the December release of the Azure Developer CLI (`azd`). The post Azure Developer CLI (azd) Dec 2025 – Extensions En...

1 day ago

Unlock the power of distributed graph databases with JanusGraph and Azure Apache Cassandra

Connecting the Dots: How Graph Databases Drive Innovation In today’s data-rich world, organizations face challenges that go beyond simple tabl...

3 days ago

Azure Boards integration with GitHub Copilot

A few months ago we introduced the Azure Boards integration with GitHub Copilot in private preview. The goal was simple: allow teams to take a...

5 days ago

Microsoft Dataverse – Monitor batch workloads with Azure Monitor Application Insights

We are announcing the ability to monitor batch workload telemetry in Azure Monitor Application Insights for finance and operations apps in Mic...

6 days ago

Copilot Studio: Connect An Azure SQL Database As Knowledge

Copilot Studio can connect to an Azure SQL database and use its structured data as ... The post Copilot Studio: Connect An Azure SQL Database ...

6 days ago

Retirement of Global Personal Access Tokens in Azure DevOps

In the new year, we’ll be retiring the Global Personal Access Token (PAT) type in Azure DevOps. Global PATs allow users to authenticate across...

9 days ago

Azure Cosmos DB vNext Emulator: Query and Observability Enhancements

The Azure Cosmos DB Linux-based vNext emulator (preview) is a local version of the Azure Cosmos DB service that runs as a Docker container on ...

10 days ago

Azure Cosmos DB : Becoming a Search-Native Database

For years, “Database” and “Search systems” (think Elastic Search) lived in separate worlds. While both Databases and Search Systems oper...

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