Skip to content

Commit b6e0d0e

Browse files
authored
Merge pull request #296078 from dlepow/blockmig
[APIM] Automatic migration w/ VNet
2 parents 591f4da + ea30466 commit b6e0d0e

File tree

3 files changed

+60
-9
lines changed

3 files changed

+60
-9
lines changed

articles/api-management/migrate-stv1-to-stv2-vnet.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ author: dlepow
66
ms.service: azure-api-management
77
ms.custom:
88
ms.topic: how-to
9-
ms.date: 02/19/2025
9+
ms.date: 03/10/2025
1010
ms.author: danlep
1111
---
1212

includes/api-management-automatic-migration.md

Lines changed: 59 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,31 +2,82 @@
22
author: dlepow
33
ms.service: azure-api-management
44
ms.topic: include
5-
ms.date: 02/21/2025
5+
ms.date: 03/11/2025
66
ms.author: danlep
77
---
88

99
## Automatic migration
1010

11-
After the retirement date, we'll automatically migrate remaining `stv1` service instances to the `stv2` compute platform. All affected customers will be notified of the upcoming automatic migration a week in advance. Automatic migration might cause downtime for your upstream API consumers. You may still migrate your own instances before automatic migration takes place.
11+
After the retirement date, we'll automatically migrate remaining `stv1` service instances to the `stv2` compute platform. All affected customers will be notified of the upcoming automatic migration a week in advance. Automatic migration might cause downtime for your upstream API consumers. You can still migrate your own instances before automatic migration takes place.
1212

13-
### Virtual network configuration may be removed during automatic migration
13+
### Virtual network configuration might be removed during automatic migration
1414

1515
Im most cases, automatic migration retains the virtual network settings of your API Management instance, if they're configured. Under certain [special conditions](../articles/api-management/migrate-stv1-to-stv2-vnet.md#special-conditions-and-scenarios), the virtual network configuration of your `stv1` service instance is removed during automatic migration and, as a security measure, access to your service endpoints is blocked. If the network settings were removed during the migration process, you'll see a message in the portal similar to: `We have blocked access to all endpoints for your service`.
1616

1717
:::image type="content" source="media/api-management-automatic-migration/blocked-access.png" alt-text="Screenshot of blocked access to API Management in the portal.":::
1818

19-
While access is blocked, access to the API gateway, developer portal, direct management API, and Git repository is disabled. To restore access to your service endpoints:
19+
While access is blocked, access to the API gateway, developer portal, direct management API, and Git repository is disabled.
2020

21-
1. Redeploy your API Management instance in your virtual network. For steps, see the guidance for deploying API Management in an [external](../articles/api-management/api-management-using-with-vnet.md) or [internal](../articles/api-management/api-management-using-with-internal-vnet.md) virtual network. We strongly recommend deploying the instance in a **new subnet** of the virtual network with settings compatible with the API Management `stv2` compute platform.
22-
1. After the virtual network is reestablished, unblock access to your service endpoints. In the portal, on the **Overview** page of the instance, select **Unblock my service**. This action is not reversible.
21+
### Restore access and virtual network configuration
2322

24-
> [!WARNING]
25-
> If you unblock access to your service endpoints before reconfiguring the virtual network, your service endpoints will be publicly accessible from the internet. To protect your environment, make sure to reestablish your virtual network as soon as possible.
23+
If access is blocked, you can restore access to your service endpoints and your virtual network configuration using the portal or the Azure CLI.
2624

2725
> [!TIP]
2826
> If you need a reminder of the names of the virtual network and subnet where your API Management instance was originally deployed, you can find information in the portal. In the left menu of your instance, select **Diagnose and solve problems** > **Availability and performance** > **VNet Verifier**. In **Time range**, select a period before the instance was migrated.
2927
28+
#### [Portal](#tab/portal)
29+
30+
1. In the portal, on the **Overview** page of the instance, select **Unblock my service**. This action isn't reversible.
31+
32+
> [!WARNING]
33+
> After you unblock access to your service endpoints, they're publicly accessible from the internet. To protect your environment, make sure to reestablish your virtual network as soon as possible after unblocking access.
34+
35+
1. Redeploy your API Management instance in your virtual network.
36+
37+
For steps, see the guidance for deploying API Management in an [external](../articles/api-management/api-management-using-with-vnet.md) or [internal](../articles/api-management/api-management-using-with-internal-vnet.md) virtual network. We strongly recommend deploying the instance in a **new subnet** of the virtual network with settings compatible with the API Management `stv2` compute platform.
38+
39+
40+
#### [Azure CLI](#tab/cli)
41+
42+
Run the following Azure CLI commands to enable access to the API Management instance and restore configuration of the specified virtual network.
43+
44+
> [!NOTE]
45+
> The following script is written for the bash shell. To run the script in PowerShell, prefix each variable name with the `$` character when setting the variables. Example: `$APIM_NAME=...`.
46+
47+
```azurecli
48+
APIM_NAME={name of your API Management instance}
49+
RG_NAME={name of your resource group}
50+
SUBNET_NAME={name of the subnet where your API Management instance was originally deployed}
51+
VNET_NAME={name of the virtual network where your API Management instance was originally deployed}
52+
VNET_TYPE={external or internal}
53+
54+
# Get resource ID of subnet
55+
SUBNET_ID=$(az network vnet subnet show \
56+
--resource-group $RG_NAME \
57+
--name $SUBNET_NAME \
58+
--vnet-name $VNET_NAME \
59+
--query id --output tsv)
60+
61+
# Get resource ID of API Management instance
62+
APIM_RESOURCE_ID=$(az apim show \
63+
--resource-group $RG_NAME --name $APIM_NAME \
64+
--query id --output tsv)
65+
66+
# Enable access to service endpoints and restore virtual network configuration
67+
az rest --method PATCH --uri "$APIM_RESOURCE_ID?api-version=2024-05-01" --body '{
68+
"properties": {
69+
"virtualNetworkType": "'$VNET_TYPE'",
70+
"virtualNetworkConfiguration": {
71+
"subnetResourceId": "'$SUBNET_ID'"
72+
},
73+
"customProperties": {
74+
"Microsoft.WindowsAzure.ApiManagement.Service.Disabled": "False"
75+
}
76+
}
77+
}'
78+
```
79+
---
80+
3081

3182

3283

-49.5 KB
Loading

0 commit comments

Comments
 (0)