Skip to content

Commit ea30466

Browse files
author
gitName
committed
CLI script
1 parent 22056b6 commit ea30466

File tree

1 file changed

+54
-55
lines changed

1 file changed

+54
-55
lines changed

includes/api-management-automatic-migration.md

Lines changed: 54 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -2,82 +2,81 @@
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

1919
While access is blocked, access to the API gateway, developer portal, direct management API, and Git repository is disabled.
2020

21-
To restore access to your service endpoints:
21+
### Restore access and virtual network configuration
2222

23-
1. Make sure you understand the following steps to re-establish your virtual network and are prepared to do so before proceeding.
24-
> [!TIP]
25-
> 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.
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

27-
1. Unblock access to your service endpoints. You can unblock access using the portal or the Azure CLI.
25+
> [!TIP]
26+
> 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.
27+
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.
2831

2932
> [!WARNING]
3033
> 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.
3134
32-
#### [Portal](#tab/portal)
33-
34-
In the portal, on the **Overview** page of the instance, select **Unblock my service**. This action is not reversible.
35-
36-
37-
#### [Azure CLI](#tab/cli)
38-
39-
Run the following Azure CLI commands to update the API Management instance, setting variables where indicated.
40-
41-
> [!NOTE]
42-
> 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=...`.
43-
44-
```azurecli
45-
APIM_NAME={name of your API Management instance}
46-
RG_NAME={name of your resource group}
47-
SUBNET_NAME={name of the subnet where your API Management instance was originally deployed}
48-
VNET_NAME={name of the virtual network where your API Management instance was originally deployed}
49-
VNET_TYPE={external or internal}
50-
51-
# Get resource ID of subnet
52-
SUBNET_ID=$(az network vnet subnet show \
53-
--resource-group $RG_NAME \
54-
--name $SUBNET_NAME \
55-
--vnet-name $VNET_NAME \
56-
--query id --output tsv)
57-
58-
# Get resource ID of API Management instance
59-
APIM_RESOURCE_ID=$(az apim show \
60-
--resource-group $RG_NAME --name $APIM_NAME \
61-
--query id --output tsv)
62-
63-
# Unblock access to service endpoints
64-
az rest --method PATCH --uri "$APIM_RESOURCE_ID?api-version=2024-05-01" --body '{
65-
"properties": {
66-
"virtualNetworkType": "'$VNET_TYPE'",
67-
"virtualNetworkConfiguration": {
68-
"subnetResourceId": "'$SUBNET_ID'"
69-
},
70-
"customProperties": {
71-
"Microsoft.WindowsAzure.ApiManagement.Service.Disabled": "False"
72-
}
73-
}
74-
}'
75-
```
76-
---
77-
7835
1. Redeploy your API Management instance in your virtual network.
7936

80-
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.
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+
---
8180

8281

8382

0 commit comments

Comments
 (0)