You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/api-management/backends.md
+74-10Lines changed: 74 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,7 +5,7 @@ services: api-management
5
5
author: dlepow
6
6
ms.service: azure-api-management
7
7
ms.topic: concept-article
8
-
ms.date: 04/01/2025
8
+
ms.date: 05/20/2025
9
9
ms.author: danlep
10
10
ms.custom:
11
11
- build-2024
@@ -239,16 +239,63 @@ Use a backend pool for scenarios such as the following:
239
239
240
240
API Management supports the following load balancing options for backend pools:
241
241
242
-
***Round-robin**: By default, requests are distributed evenly across the backends in the pool.
243
-
***Weighted**: Weights are assigned to the backends in the pool, and requests are distributed across the backends based on the relative weight assigned to each backend. Use this option for scenarios such as conducting a blue-green deployment.
244
-
***Priority-based**: Backends are organized in priority groups, and requests are sent to the backends in order of the priority groups. Within a priority group, requests are distributed either evenly across the backends, or (if assigned) according to the relative weight assigned to each backend.
245
-
242
+
| Load balancing option | Description |
243
+
|------------------|-------------|
244
+
|**Round-robin**| Requests are distributed evenly across the backends in the pool by default. |
245
+
|**Weighted**| Weights are assigned to the backends in the pool, and requests are distributed based on the relative weight of each backend. Useful for scenarios such as blue-green deployments. |
246
+
|**Priority-based**| Backends are organized into priority groups. Requests are sent to higher priority groups first; within a group, requests are distributed evenly or according to assigned weights. |
247
+
246
248
> [!NOTE]
247
249
> Backends in lower priority groups will only be used when all backends in higher priority groups are unavailable because circuit breaker rules are tripped.
248
250
251
+
### Session awareness
252
+
253
+
With any of the preceding load balancing options, optionally enable **session awareness** (session affinity) to ensure that all requests from a specific user during a session are directed to the same backend in the pool. API Management sets a session ID cookie to maintain session state. This option is useful, for example, in scenarios with backends such as AI chat assistants or other conversational agents to route requests from the same session to the same endpoint.
254
+
255
+
> [!NOTE]
256
+
> Session awareness in load-balanced pools is being released first to the **AI Gateway Early**[update group](configure-service-update-settings.md).
257
+
258
+
#### Manage cookies for session awareness
259
+
260
+
When using session awareness, the client must handle cookies appropriately. The client needs to store the `Set-Cookie` header value and send it with subsequent requests to maintain session state.
261
+
262
+
You can use API Management policies to help set cookies for session awareness. For example, for the case of the Assistants API (a feature of [Azure OpenAI in Azure AI Foundry Models](/azure/ai-services/openai/concepts/models)), the client needs to keep the session ID, extract the thread ID from the body, and keep the pair and send the right cookie for each call. Moreover, the client needs to know when to send a cookie or when not to send a cookie header. These requirements can be handled appropriately by defining the following example policies:
263
+
264
+
265
+
```xml
266
+
<policies>
267
+
<inbound>
268
+
<base />
269
+
<set-backend-servicebackend-id="APIMBackend" />
270
+
</inbound>
271
+
<backend>
272
+
<base />
273
+
</backend>
274
+
<outbound>
275
+
<base />
276
+
<set-variablename="gwSetCookie"value="@{
277
+
var payload = context.Response.Body.As<JObject>();
278
+
var threadId = payload["id"];
279
+
var gwSetCookieHeaderValue = context.Request.Headers.GetValueOrDefault("SetCookie", string.Empty);
Use the portal, API Management [REST API](/rest/api/apimanagement/backend), or a Bicep or ARM template to configure a backend pool. In the following example, the backend *myBackendPool* in the API Management instance *myAPIM* is configured with a backend pool. Example backends in the pool are named *backend-1* and *backend-2*. Both backends are in the highest priority group; within the group, *backend-1* has a greater weight than *backend-2*.
298
+
Use the portal, API Management [REST API](/rest/api/apimanagement/backend), or a Bicep or ARM template to configure a backend pool. In the following example, the backend *myBackendPool* in the API Management instance *myAPIM* is configured with a backend pool. Example backends in the pool are named *backend-1* and *backend-2*. Both backends are in the highest priority group; within the group, *backend-1* has a greater weight than *backend-2*.
252
299
253
300
254
301
#### [Portal](#tab/portal)
@@ -266,7 +313,9 @@ Use the portal, API Management [REST API](/rest/api/apimanagement/backend), or a
266
313
267
314
#### [Bicep](#tab/bicep)
268
315
269
-
Include a snippet similar to the following in your Bicep file for a load-balanced pool. Set the `type` property of the backend entity to `Pool` and specify the backends in the pool:
316
+
Include a snippet similar to the following in your Bicep file for a load-balanced pool. Set the `type` property of the backend entity to `Pool` and specify the backends in the pool.
317
+
318
+
This example includes an optional `sessionAffinity` pool configuration for session awareness. It sets a cookie so that requests from a user session are routed to a specific backend in the pool.
Include a JSON snippet similar to the following in your ARM template for a load-balanced pool. Set the `type` property of the backend resource to `Pool` and specify the backends in the pool:
351
+
Include a JSON snippet similar to the following in your ARM template for a load-balanced pool. Set the `type` property of the backend resource to `Pool` and specify the backends in the pool.
352
+
353
+
This example includes an optional `sessionAffinity` pool configuration for session awareness. It sets a cookie so that requests from a user session are routed to a specific backend in the pool.
354
+
297
355
298
356
```json
299
357
{
@@ -315,7 +373,13 @@ Include a JSON snippet similar to the following in your ARM template for a load-
Copy file name to clipboardExpand all lines: articles/app-service/tutorial-connect-msi-azure-database.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -218,7 +218,7 @@ Connectivity to the Azure Database for PostgreSQL in your code follows the `Defa
218
218
219
219
## 4. Set up your dev environment
220
220
221
-
This sample code uses `DefaultAzureCredential` to get a useable token for your Azure database from Microsoft Entra ID and then adds it to the database connection. While you can customize `DefaultAzureCredential`, it's already versatile by default. It gets a token from the signed-in Microsoft Entra user or from a managed identity, depending on whether you run it locally in your development environment or in App Service.
221
+
This sample code uses `DefaultAzureCredential` to get a usable token for your Azure database from Microsoft Entra ID and then adds it to the database connection. While you can customize `DefaultAzureCredential`, it's already versatile by default. It gets a token from the signed-in Microsoft Entra user or from a managed identity, depending on whether you run it locally in your development environment or in App Service.
222
222
223
223
Without any further changes, your code is ready to be run in Azure. To debug your code locally, however, your develop environment needs a signed-in Microsoft Entra user. In this step, you configure your environment of choice by signing in with your Microsoft Entra user.
Copy file name to clipboardExpand all lines: articles/app-service/tutorial-connect-msi-sql-database.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -194,7 +194,7 @@ The steps you follow for your project depends on whether you're using [Entity Fr
194
194
conn.AccessToken = token.Token;
195
195
```
196
196
197
-
This code uses [Azure.Identity.DefaultAzureCredential](/dotnet/api/azure.identity.defaultazurecredential) to get a useable token for SQL Database from Microsoft Entra ID and then adds it to the database connection. While you can customize `DefaultAzureCredential`, by default it's already versatile. When it runs in App Service, it uses the app's system-assigned managed identity by default. If you prefer to use a user-assigned managed identity, add a new App setting named `ManagedIdentityClientId` and enter the `Client Id` GUID from your user-assigned managed identity in the `value` field. When it runs locally, it can get a token using the logged-in identity of Visual Studio, Visual Studio Code, Azure CLI, and Azure PowerShell.
197
+
This code uses [Azure.Identity.DefaultAzureCredential](/dotnet/api/azure.identity.defaultazurecredential) to get a usable token for SQL Database from Microsoft Entra ID and then adds it to the database connection. While you can customize `DefaultAzureCredential`, by default it's already versatile. When it runs in App Service, it uses the app's system-assigned managed identity by default. If you prefer to use a user-assigned managed identity, add a new App setting named `ManagedIdentityClientId` and enter the `Client Id` GUID from your user-assigned managed identity in the `value` field. When it runs locally, it can get a token using the logged-in identity of Visual Studio, Visual Studio Code, Azure CLI, and Azure PowerShell.
198
198
199
199
1. In *Web.config*, find the connection string called `MyDbConnection` and replace its `connectionString` value with `"server=tcp:<server-name>.database.windows.net;database=<db-name>;"`. Replace _\<server-name>_ and _\<db-name>_ with your server name and database name. This connection string is used by the default constructor in *Models/MyDbContext.cs*.
Copy file name to clipboardExpand all lines: articles/app-service/tutorial-php-mysql-app.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -365,7 +365,7 @@ In this step, you configure GitHub deployment using GitHub Actions. It's just on
365
365
:::column span="2":::
366
366
**Step 5:**
367
367
1. Select the **Source Control** extension.
368
-
1. In the textbox, type a commit message like `Configure Azure database and cache connectons`. Or, select :::image type="icon" source="media/quickstart-dotnetcore/github-copilot-in-editor.png" border="false"::: and let GitHub Copilot generate a commit message for you.
368
+
1. In the textbox, type a commit message like `Configure Azure database and cache connections`. Or, select :::image type="icon" source="media/quickstart-dotnetcore/github-copilot-in-editor.png" border="false"::: and let GitHub Copilot generate a commit message for you.
369
369
1. Select **Commit**, then confirm with **Yes**.
370
370
1. Select **Sync changes 1**, then confirm with **OK**.
Copy file name to clipboardExpand all lines: articles/app-service/tutorial-python-postgresql-app-django.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -381,7 +381,7 @@ In this step, you configure GitHub deployment using GitHub Actions. It's just on
381
381
:::column span="2":::
382
382
**Step 5:**
383
383
1. Select the **Source Control** extension.
384
-
1. In the textbox, type a commit message like `Configure Azure database and cache connectons`. Or, select :::image type="icon" source="media/quickstart-dotnetcore/github-copilot-in-editor.png" border="false"::: and let GitHub Copilot generate a commit message for you.
384
+
1. In the textbox, type a commit message like `Configure Azure database and cache connections`. Or, select :::image type="icon" source="media/quickstart-dotnetcore/github-copilot-in-editor.png" border="false"::: and let GitHub Copilot generate a commit message for you.
385
385
1. Select **Commit**, then confirm with **Yes**.
386
386
1. Select **Sync changes 1**, then confirm with **OK**.
Copy file name to clipboardExpand all lines: articles/app-service/tutorial-python-postgresql-app-flask.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -346,7 +346,7 @@ In this step, you configure GitHub deployment using GitHub Actions. It's just on
346
346
:::column span="2":::
347
347
**Step 5:**
348
348
1. Select the **Source Control** extension.
349
-
1. In the textbox, type a commit message like `Configure Azure database connecton`. Or, select :::image type="icon" source="media/quickstart-dotnetcore/github-copilot-in-editor.png" border="false"::: and let GitHub Copilot generate a commit message for you.
349
+
1. In the textbox, type a commit message like `Configure Azure database connection`. Or, select :::image type="icon" source="media/quickstart-dotnetcore/github-copilot-in-editor.png" border="false"::: and let GitHub Copilot generate a commit message for you.
350
350
1. Select **Commit**, then confirm with **Yes**.
351
351
1. Select **Sync changes 1**, then confirm with **OK**.
Copy file name to clipboardExpand all lines: articles/backup/azure-elastic-storage-area-network-backup-overview.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -48,7 +48,7 @@ Azure Backup manages the protection workflow for Azure Elastic SAN by performing
48
48
>- The Elastic SAN volume snapshot is temporary and isn't a recovery point.
49
49
>- Azure Backup manages the lifecycle of these incremental snapshots as per the backup policy.
50
50
51
-
1. During restore, Azure Backup reads the Manged Disk incremental snapshot, and then recovers it as a new volume in an existing Elastic SAN instance using the Elastic SAN import APIs.
51
+
1. During restore, Azure Backup reads the Managed Disk incremental snapshot, and then recovers it as a new volume in an existing Elastic SAN instance using the Elastic SAN import APIs.
52
52
53
53
You can also create a Managed Disk from the Managed Disk incremental snapshot directly from the [Azure portal](https://portal.azure.com/).
0 commit comments