Skip to content

Commit 89acc90

Browse files
authored
Merge pull request #293715 from KarlErickson/karler-asa-migration-2
ASA migration batch 2
2 parents de93509 + f5d11bc commit 89acc90

7 files changed

+804
-0
lines changed
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
## Provision Config Server
2+
3+
### [Azure portal](#tab/Azure-portal)
4+
5+
The following steps show you how to provision a Config Server for Spring in your Azure Container Apps:
6+
7+
1. Navigate to your Azure Container Apps environment in the Azure portal.
8+
9+
1. In the menu, select **Services** > **Services**.
10+
11+
1. Open the **Configure** drop-down list, and then select **Java component**.
12+
13+
1. In the **Configure Java component** panel, enter the following values:
14+
15+
| Property | Value |
16+
|-------------------------|--------------------------------------|
17+
| **Java component type** | Select **Config Server for Spring**. |
18+
| **Java component name** | Enter **configserver**. |
19+
20+
1. In the **Git repositories** section, select **Add**, and then migrate the values from Application Configuration Service to here, as shown in the following table. Choose one repository as the default repository of Config Server for Spring.
21+
22+
| Property | Value |
23+
|--------------------|-------------------------------------------------------------------------------------------|
24+
| **Type** | Select **DEFAULT**. |
25+
| **URI** | Enter the value of **URI** of the repository. |
26+
| **Branch name** | Enter the value of **label** of the repository. |
27+
| **Search paths** | Enter the value of **search path** of the repository. |
28+
| **Authentication** | Select the authentication type of the repository and enter the corresponding information. |
29+
30+
Leave the rest of the fields with the default values and then select **Add**.
31+
32+
1. If you have multiple repositories, select **Add** to migrate other repositories. For **Type**, select **Other**, and then migrate other properties as shown in the previous step and the following table:
33+
34+
| Property | Value |
35+
|-------------|-------------------------------------------------------------------------------------------------------------|
36+
| **Type** | Select **DEFAULT**. |
37+
| **Pattern** | Enter the **Patterns** value for the repository in the `{application}` or `{application}/{profile}` format. |
38+
39+
1. In the **Binding** section, open the dropdown to select the apps to bind to the Config Server for Spring.
40+
41+
1. Select **Next**.
42+
43+
1. To set up Config Server, on the **Review** tab, select **Configure**, and then follow the instructions in the configuration section.
44+
45+
After successful creation, you can see that the **Provisioning State** of Config Server for Spring is **Succeeded**.
46+
47+
### [Azure CLI](#tab/Azure-CLI)
48+
49+
Use the following command to create and configure the Config Server for Spring Java component:
50+
51+
```azurecli
52+
az containerapp env java-component config-server-for-spring create \
53+
--resource-group <resource-group-name> \
54+
--name <config-server-name> \
55+
--environment <azure-container-app-environment-name> \
56+
--min-replicas 1 \
57+
--max-replicas 1 \
58+
--configuration spring.cloud.config.server.git.uri=<URI> spring.cloud.config.server.git.default-label=<label>
59+
```
60+
61+
All properties are set using the format `--configuration <CONFIGURATION_KEY>=<CONFIGURATION_VALUE>`. To map existing configurations to the key-value pairs of the Config Server, see the configuration section.
62+
63+
---
64+
65+
### Resource allocation
66+
67+
The container resource allocation for the managed Config Server in Azure Container Apps is fixed to the following values:
68+
69+
- **CPU**: 0.5 vCPU
70+
- **Memory**: 1 Gi
71+
72+
To configure the instance count of Config Server for Spring, you need to update the parameters `--min-replicas` and `--max-replicas` with the same value. This configuration ensures that the instance count remains fixed. Currently, the system doesn't support autoscaling configurations for dynamic scaling.
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
## Deploy the application to Azure Container Apps
2+
3+
After testing the application locally, you can deploy the new image to the Azure Container Apps application.
4+
5+
### [Azure portal](#tab/Azure-portal)
6+
7+
Use the following steps to deploy:
8+
9+
1. Navigate to your Azure Container Apps application in the Azure portal.
10+
1. In the menu, select **Application** > **Containers**.
11+
1. Select **Edit and deploy** to open the **Create and deploy new revision** page.
12+
1. In the **Container image** section, select the image and then select **Edit**.
13+
1. In the **Edit a container** section, on the **Properties** tab, choose the new image of the application.
14+
1. On the **Environment variables** tab, for **Name**, specify **spring.application.name**. Then, for **Source**, choose **Manual entry** and specify the config file name where the application consumes the configuration.
15+
1. Select **Save** to deploy the new revision.
16+
17+
### [Azure CLI](#tab/Azure-CLI)
18+
19+
Use the following command to update the container app that consumes the configuration data:
20+
21+
```azurecli
22+
az containerapp update \
23+
--resource-group <your-resource-group> \
24+
--name <container-app-name> \
25+
--image <new-container-image> \
26+
--bind <config-server-name> \
27+
--set-env-vars spring.application.name=<config-file-name>
28+
```
29+
30+
The `--bind <config-server-name>` parameter creates the link between your container app and the configuration component. You should add the environment variable by setting `--set-env-vars spring.application.name=<config-file-name>` to the app container so that the app can consume the configuration from the right config file.
31+
32+
---
33+
34+
## Troubleshoot
35+
36+
You can view logs for the managed Config Server for Spring in Azure Container Apps using Log Analytics. Use the following steps:
37+
38+
1. Navigate to your Azure Container Apps environment in the Azure portal.
39+
1. Select the **Monitoring** > **Logs** menu.
40+
1. To view logs, enter a query into the query editor for the `ContainerAppSystemLogs_CL` table, as shown in the following example:
41+
42+
```kusto
43+
ContainerAppSystemLogs_CL
44+
| where ComponentType_s == "SpringCloudConfig"
45+
| project Time=TimeGenerated, ComponentName=ComponentName_s, Message=Log_s
46+
| take 100
47+
```
48+
49+
For more information about querying logs, see [Observability of managed Java components in Azure Container Apps](../../../container-apps/java-component-logs.md).
Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
---
2+
title: Migrate API Portal with Azure Spring Apps Enterprise Plan to Azure API Management
3+
description: Describes how to migrate API Portal to Azure API Management.
4+
author: KarlErickson
5+
ms.author: dixue
6+
ms.service: azure-spring-apps
7+
ms.topic: upgrade-and-migration-article
8+
ms.date: 01/29/2025
9+
ms.custom: devx-track-java, devx-track-extended-java
10+
---
11+
12+
# Migrate API Portal with Azure Spring Apps Enterprise plan to Azure API Management
13+
14+
[!INCLUDE [deprecation-note](../includes/deprecation-note.md)]
15+
16+
**This article applies to:** ❎ Basic/Standard ✅ Enterprise
17+
18+
This article describes how to migrate API Portal to Azure API Management.
19+
20+
Azure API Management provides a centralized interface for viewing API definitions and testing specific API routes directly from the browser. It also supports single sign-on (SSO) for improved security and seamless access. Migrating from API Portal with Azure Spring Apps to Azure API Management enhances scalability, security, and integration with other Azure services.
21+
22+
## Prerequisites
23+
24+
- An existing Azure Spring Apps Enterprise plan instance with API Portal enabled.
25+
- An existing Azure container app. For more information, see [Quickstart: Deploy your first container app using the Azure portal](../../container-apps/quickstart-portal.md).
26+
27+
## Create an API Management instance
28+
29+
Use the following steps to create an API Management instance:
30+
31+
1. In the Azure portal, search for **API Management** in the search bar.
32+
1. Select **API Management services** from the results and then select **Create**.
33+
1. Provide the following required information:
34+
35+
- **Subscription**: Select the Azure subscription for your service.
36+
- **Resource Group**: Either select an existing resource group or select **Create new** to create a new one.
37+
- **Region**: Choose the location or region for your API Management instance.
38+
- **Resource Name**: Provide a globally unique name for the API Management instance.
39+
- **Organization Name**: Specify the name of your organization.
40+
- **Administrator Email**: Provide an email address that is used for notifications related to the API Management instance.
41+
42+
1. Choose the pricing tier based on your use case. You can always upgrade or change the pricing tier later.
43+
1. Configure optional settings like monitoring and virtual network settings.
44+
1. Select **Review + create** to review the settings and validate the configuration.
45+
1. After validation is complete, select **Create**. Deployment can take 30 to 40 minutes.
46+
1. After the deployment is complete, navigate to the **API Management service** page to view the newly created service.
47+
48+
## Import exposed APIs in API Management
49+
50+
There are two options to import APIs in API Management: manually adding APIs or importing an API specification file.
51+
52+
### Manually add APIs
53+
54+
Use the following steps to manually add APIs:
55+
56+
1. Navigate to the API Management instance in the Azure portal. Under the **APIs** section, select **Add API**.
57+
58+
1. On the **Define a new API** pane, select the **HTTP** option to manually define an HTTP API.
59+
60+
1. Provide the following **API Basics** values, and then select **Create** to save:
61+
62+
- **Display Name**: Provide a name for your API.
63+
- **Name**: Enter a unique identifier for the API.
64+
- **Web Service URL**: Specify the base URL of your backend API of your Container Apps.
65+
- **API URL Suffix**: Define the suffix for this API - for example, **/api/customers-service**.
66+
67+
1. To create new API endpoints, select **Add Operation**, then use the following steps:
68+
69+
1. Provide the general information. Input **Display name** and **Name**.
70+
1. Provide the details for the operation, such as the **HTTP verb** - `GET`, `POST`, and so on - **URL**, **Query Parameters**, **Request**, and **Response**.
71+
1. After you add all operations, save your API.
72+
73+
1. Select the names of the APIs added. You can see all operations added in the **Design** tab.
74+
75+
### Import an API specification file
76+
77+
If you have an OpenAPI specification - a Swagger definition - of your APIs, you can directly import to API Management by using the following steps:
78+
79+
1. Navigate to the API Management instance in the Azure portal.
80+
81+
1. Open the **APIs** section under **APIs**.
82+
83+
1. Select **Add API**.
84+
85+
1. For **Create from definition**, choose the **OpenAPI** option, which creates a standard, language-agnostic interface to REST APIs.
86+
87+
1. Use the following steps to create an API from an OpenAPI specification:
88+
89+
1. If you have a local API spec file, select **Select a file** to upload the file. Alternatively, provide a publicly accessible **URL** to the OpenAPI specification.
90+
1. You can further refine the API settings by providing values for **Display Name**, **Name**, and **API URL suffix** for the APIs.
91+
1. To save the configurations, select **Create**.
92+
93+
1. Select the name of APIs added. You can see all the operations added on the **Design** tab.
94+
95+
## Try out APIs in API Management
96+
97+
Azure API Management provides a built-in **Test Console** within the Azure portal, making it easy to interact with your APIs without needing external tools. Use the following steps to test your APIs:
98+
99+
1. Navigate to the API Management instance in the Azure portal.
100+
101+
1. Under the **APIs** section, select the API you want to test from the list.
102+
103+
1. Choose an operation. Inside the API's overview page, you can see a list of available operations (endpoints). Select the operation you want to test.
104+
105+
1. Select the **Test** tab to open it within the Azure portal.
106+
107+
1. Configure request parameters. Enter the necessary parameters for the request such as **Path Parameters**, **Query Parameters**, **Headers**, or **Body**, depending on the API method. If an API requires an `Authorization Token`, make sure to include it in the header.
108+
109+
1. Send the request. After you provide the request details, select **Send**. The response from the API is shown directly in the Azure portal, including the **Response Code**, **Response Body**, and **Headers**.
110+
111+
1. Inspect the response. Review the response data, status codes, and any error messages that might indicate issues with the API or request.
112+
113+
## Migrate single sign-on to API Management
114+
115+
If you enable single sign-on (SSO) in API Portal, and want to authenticate requests to API Management as well, use the following steps to configure the identity in API Management:
116+
117+
1. In the Azure portal, go to your API Management instance.
118+
119+
1. Navigate to **Developer portal** > **identities**.
120+
121+
1. Select **Add** and then select **Azure Active Directory**.
122+
123+
1. Fill in the required fields:
124+
125+
- **Client ID**: The application or client ID of your registered Microsoft Entra ID application.
126+
- **Client Secret**: The secret of the Microsoft Entra ID application.
127+
- **Signin tenant**: The domain name of your Microsoft Entra ID tenant, such as `yourcompany.onmicrosoft.com`
128+
- **Redirect URL**: Typically `https://{your-apim-instance}.developer.azure-api.net/signin`.
129+
130+
1. Select **Add** to save the identity provider.
131+
132+
You need to add the redirect URL to the list of allowed redirect URLs of your Microsoft Entra ID client app before saving the new added identity provider.
133+
134+
For more configurations for API Management, see the [API Management documentation](../../api-management/index.yml).

0 commit comments

Comments
 (0)