Skip to content

Commit a737811

Browse files
authored
Merge pull request #225456 from dlepow/disablegw
[APIM] Use disableGateway property for DR
2 parents 84fb3c5 + 918b657 commit a737811

File tree

1 file changed

+42
-6
lines changed

1 file changed

+42
-6
lines changed

articles/api-management/api-management-howto-deploy-multi-region.md

Lines changed: 42 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ description: Learn how to deploy a Premium tier Azure API Management instance to
55
author: dlepow
66
ms.service: api-management
77
ms.topic: how-to
8-
ms.date: 09/27/2022
8+
ms.date: 01/26/2023
99
ms.author: danlep
1010
---
1111

@@ -50,18 +50,16 @@ When adding a region, you configure:
5050
## <a name="remove-region"> </a>Remove an API Management service region
5151

5252
1. In the Azure portal, navigate to your API Management service and select **Locations** from the left menu.
53-
2. For the location you would like to remove, select the context menu using the **...** button at the right end of the table. Select **Delete**.
54-
3. Confirm the deletion and select **Save** to apply the changes.
53+
1. For the location you would like to remove, select the context menu using the **...** button at the right end of the table. Select **Delete**.
54+
1. Confirm the deletion and select **Save** to apply the changes.
55+
5556

5657
## <a name="route-backend"> </a>Route API calls to regional backend services
5758

5859
By default, each API routes requests to a single backend service URL. Even if you've configured Azure API Management gateways in various regions, the API gateway will still forward requests to the same backend service, which is deployed in only one region. In this case, the performance gain will come only from responses cached within Azure API Management in a region specific to the request; contacting the backend across the globe may still cause high latency.
5960

6061
To take advantage of geographical distribution of your system, you should have backend services deployed in the same regions as Azure API Management instances. Then, using policies and `@(context.Deployment.Region)` property, you can route the traffic to local instances of your backend.
6162

62-
> [!TIP]
63-
> Optionally set the `disableGateway` property in a regional gateway to disable routing of API traffic there. For example, temporarily disable a regional gateway when testing or updating a regional backend service.
64-
6563
1. Navigate to your Azure API Management instance and select **APIs** from the left menu.
6664
2. Select your desired API.
6765
3. Select **Code editor** from the arrow dropdown in the **Inbound processing**.
@@ -118,6 +116,44 @@ API Management routes the requests to a regional gateway based on [the lowest la
118116
1. [Configure the API Management regional status endpoints in Traffic Manager](../traffic-manager/traffic-manager-monitoring.md). The regional status endpoints follow the URL pattern of `https://<service-name>-<region>-01.regional.azure-api.net/status-0123456789abcdef`, for example `https://contoso-westus2-01.regional.azure-api.net/status-0123456789abcdef`.
119117
1. Specify [the routing method](../traffic-manager/traffic-manager-routing-methods.md) of the Traffic Manager.
120118

119+
## Disable routing to a regional gateway
120+
121+
Under some conditions, you might need to temporarily disable routing to one of the regional gateways. For example:
122+
123+
* After adding a new region, to keep it disabled while you configure and test the regional backend service
124+
* During regular backend maintenance in a region
125+
* To redirect traffic to other regions during a planned disaster recovery drill that simulates an unavailable region, or during a regional failure
126+
127+
To disable routing to a regional gateway in your API Management instance, update the gateway's `disableGateway` property value to `true`. You can set the value using the [Create or update service](/rest/api/apimanagement/current-ga/api-management-service/create-or-update) REST API, the [az apim update](/cli/azure/apim#az-apim-update) command in the Azure CLI, the [set-azapimanagement](/powershell/module/az.apimanagement/set-azapimanagement) Azure PowerShell cmdlet, or other Azure tools.
128+
129+
To disable a regional gateway using the Azure CLI:
130+
131+
1. Use the [az apim show](/cli/azure/apim#az-apim-show) command to show the locations, gateway status, and regional URLs configured for the API Management instance.
132+
```azurecli
133+
az apim show --name contoso --resource-group myResourceGroup \
134+
--query "additionalLocations[].{Location:location,Disabled:disableGateway,Url:gatewayRegionalUrl}" \
135+
--output table
136+
```
137+
Example output:
138+
139+
```
140+
Location Disabled Url
141+
---------- ---------- ------------------------------------------------------------
142+
West US 2 True https://contoso-westus2-01.regional.azure-api.net
143+
West Europe True https://contoso-westeurope-01.regional.azure-api.net
144+
```
145+
1. Use the [az apim update](/cli/azure/apim#az-apim-update) command to disable the gateway in an available location, such as West US 2.
146+
```azurecli
147+
az apim update --name contoso --resource-group myResourceGroup \
148+
--set additionalLocations[location="West US 2"].disableGateway=true
149+
```
150+
151+
The update may take a few minutes.
152+
153+
1. Verify that traffic directed to the regional gateway URL is redirected to another region.
154+
155+
To restore routing to the regional gateway, set the value of `disableGateway` to `false`.
156+
121157
## Virtual networking
122158

123159
This section provides considerations for multi-region deployments when the API Management instance is injected in a virtual network.

0 commit comments

Comments
 (0)