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
This quickstart shows how to deploy a Spring Boot web application to Azure Spring Apps. The sample project is a typical threelayers web application:
22
+
This quickstart shows how to deploy a Spring Boot web application to Azure Spring Apps. The sample project is a typical three-layers web application:
23
23
24
-
1. A frontend bounded [React](https://reactjs.org/) application.
25
-
2. A backend Spring web application that uses Spring Data JPA to access a relational database.
26
-
3. A relational database. [H2 Database Engine](https://www.h2database.com/html/main.html) is used in localhost. [Azure Database for PostgreSQL](/azure/postgresql/flexible-server/) is used when deploy to Azure Spring Apps.
24
+
- A frontend bounded [React](https://reactjs.org/) application.
25
+
- A backend Spring web application that uses Spring Data JPA to access a relational database.
26
+
- A relational database. [H2 Database Engine](https://www.h2database.com/html/main.html) is used in localhost. [Azure Database for PostgreSQL](/azure/postgresql/flexible-server/) is used when deploy to Azure Spring Apps.
27
27
28
28
The following diagram shows the architecture of the system:
29
29
@@ -32,28 +32,28 @@ The following diagram shows the architecture of the system:
32
32
## Prerequisites
33
33
34
34
-[Git](https://git-scm.com/downloads).
35
-
-[Java Development Kit (JDK)](/java/azure/jdk/). Version = 17.
35
+
-[Java Development Kit (JDK)](/java/azure/jdk/). Version 17.
36
36
- An Azure subscription. If you don't have a subscription, create a [free account](https://azure.microsoft.com/free/) before you begin.
37
-
-[Azure CLI](/cli/azure/install-azure-cli). Version >= 2.45.0.
37
+
-[Azure CLI](/cli/azure/install-azure-cli). Version 2.45.0 or greater.
38
38
39
39
## Clone and run the sample project locally
40
40
41
41
1. The sample project is available on GitHub. Use the following command to clone the sample project:
@@ -63,9 +63,9 @@ The following diagram shows the architecture of the system:
63
63
64
64
## Prepare the cloud environment
65
65
66
-
The main resources needed to run this sample is an Azure Spring Apps instance and an Azure Database for PostgreSQL instance. This section provides the steps to create these resources.
66
+
The main resources required to run this sample are an Azure Spring Apps instance and an Azure Database for PostgreSQL instance. This section provides the steps to create these resources.
67
67
68
-
### 1. Set name for each resource
68
+
### Step 1 - Provide names for each resource
69
69
70
70
Specify the following suggested names for the resources.
71
71
@@ -79,7 +79,7 @@ APP_NAME=webapp
79
79
CONNECTION=WebAppConnection
80
80
```
81
81
82
-
### 2. Create a new resource group
82
+
### Step 2 - Create a new resource group
83
83
84
84
Use the following steps to create a new resource group.
85
85
@@ -95,16 +95,16 @@ Use the following steps to create a new resource group.
95
95
az configure --defaults location=${LOCATION}
96
96
```
97
97
98
-
1. Set the default subscription. Firstly, list all available subscriptions:
98
+
1. Set the default subscription. Firstly, use the following command to list all available subscriptions:
99
99
100
100
```azurecli-interactive
101
101
az account list --output table
102
102
```
103
103
104
-
Then choose one subscription and set it as default subscription with the following command:
104
+
Choose one subscription and set it as the default subscription with the following command:
105
105
106
106
```azurecli-interactive
107
-
az account set --subscription <SubscriptionId>
107
+
az account set --subscription <subscription-ID>
108
108
```
109
109
110
110
1. Create a resource group.
@@ -113,13 +113,13 @@ Use the following steps to create a new resource group.
113
113
az group create --resource-group ${RESOURCE_GROUP}
114
114
```
115
115
116
-
1. Set the new created resource group as default resource group.
116
+
1. Set the newly created resource group as the default resource group.
117
117
118
118
```azurecli-interactive
119
119
az configure --defaults group=${RESOURCE_GROUP}
120
120
```
121
121
122
-
### 3. Create Azure Spring Apps instance
122
+
### Step 3 - Create an Azure Spring Apps instance
123
123
124
124
Azure Spring Apps is used to host the spring web app. Create an Azure Spring Apps instance and create an app inside it.
125
125
@@ -129,7 +129,7 @@ Azure Spring Apps is used to host the spring web app. Create an Azure Spring App
129
129
az spring create --name ${AZURE_SPRING_APPS_NAME}
130
130
```
131
131
132
-
1. Create an app in the created Azure Spring Apps instance.
132
+
1. Create an app in the Azure Spring Apps instance.
133
133
134
134
```azurecli-interactive
135
135
az spring app create \
@@ -139,9 +139,9 @@ Azure Spring Apps is used to host the spring web app. Create an Azure Spring App
139
139
--assign-endpoint true
140
140
```
141
141
142
-
### 4. Prepare PostgreSQL instance
142
+
### Step 4 - Prepare the PostgreSQL instance
143
143
144
-
The Spring web app in localhost uses H2 for the database, Azure uses [Azure Database for PostgreSQL - Flexible Server](/azure/postgresql/flexible-server/)instead. Use the following command to create a PostgreSQL instance:
144
+
The Spring web app uses H2 for the database in localhost, and [Azure Database for PostgreSQL - Flexible Server](/azure/postgresql/flexible-server/)for the database in Azure. Use the following command to create a PostgreSQL instance:
145
145
146
146
```azurecli-interactive
147
147
az postgres flexible-server create \
@@ -152,28 +152,28 @@ az postgres flexible-server create \
152
152
153
153
So that the app is accessible only by PostgreSQL in Azure Spring Apps, enter `n` to the prompts to enable access to a specific IP address and to enable access for all IP addresses.
154
154
155
-
```text
155
+
```bash
156
156
Do you want to enable access to client xxx.xxx.xxx.xxx (y/n) (y/n): n
157
157
Do you want to enable access for all IPs (y/n): n
158
158
```
159
159
160
-
### 5. Connect app instance to PostgreSQL instance
160
+
### Step 5 - Connect app instance to PostgreSQL instance
161
161
162
-
After the app instance and the PostgreSQL instance have been created, the app instance can't access the PostgreSQL instance directly. Some network settings and connection information should be configured. To do these tasks, use [Service Connector](/azure/service-connector/overview).
162
+
After the app instance and the PostgreSQL instance have been created, the app instance can't access the PostgreSQL instance directly. Use [Service Connector](/azure/service-connector/overview) to configure the needed network settings and connection information.
163
163
164
-
1. If you're using Service Connector for the first time, first register the Service Connector resource provider.
164
+
1. If you're using Service Connector for the first time, register the Service Connector resource provider.
165
165
166
166
```azurecli-interactive
167
167
az provider register --namespace Microsoft.ServiceLinker
168
168
```
169
169
170
-
1. To achieve passwordless connection in Service Connector. Add `serviceconnector-passwordless` extension by using the following command:
170
+
1. To achieve passwordless connection in Service Connector, use the following command:
171
171
172
172
```azurecli-interactive
173
173
az extension add --name serviceconnector-passwordless --upgrade
174
174
```
175
175
176
-
1.Create a service connection between the app and the PostgreSQL by this command:
176
+
1.Use the following command to create a service connection between the app and the PostgreSQL:
177
177
178
178
```azurecli-interactive
179
179
az spring connection create postgres-flexible \
@@ -188,9 +188,9 @@ After the app instance and the PostgreSQL instance have been created, the app in
188
188
--connection ${CONNECTION}
189
189
```
190
190
191
-
The `--system-identity` parameter is necessary for passwrodless connection. For more information, see [Bind an Azure Database for PostgreSQL to your application in Azure Spring Apps](/azure/spring-apps/how-to-bind-postgres?tabs=Passwordlessflex).
191
+
The `--system-identity` parameter is required for the passwrodless connection. For more information, see [Bind an Azure Database for PostgreSQL to your application in Azure Spring Apps](/azure/spring-apps/how-to-bind-postgres?tabs=Passwordlessflex).
192
192
193
-
1. After connection created, use the following command to validate the connection:
193
+
1. After the connection is created, use the following command to validate the connection:
194
194
195
195
```azurecli-interactive
196
196
az spring connection validate \
@@ -241,7 +241,7 @@ After the app instance and the PostgreSQL instance have been created, the app in
241
241
242
242
## Deploy the app to Azure Spring Apps
243
243
244
-
1.Now the cloud environment is ready, use the following command to deploy the app:
244
+
1.With the cloud environment prepared, use the following command to deploy the app:
245
245
246
246
```azurecli-interactive
247
247
az spring app deploy \
@@ -250,7 +250,7 @@ After the app instance and the PostgreSQL instance have been created, the app in
1. After the deployment has completed, you can access the app at`https://${AZURE_SPRING_APPS_NAME}-${APP_NAME}.azuremicroservices.io/`. The page should appear as you saw in localhost.
253
+
1. After the deployment has completed, you can access the app with this URL:`https://${AZURE_SPRING_APPS_NAME}-${APP_NAME}.azuremicroservices.io/`. The page should appear as you saw in localhost.
254
254
255
255
1. If there's a problem when you deploy the app, check the app's log to investigate by using the following command:
256
256
@@ -262,7 +262,7 @@ After the app instance and the PostgreSQL instance have been created, the app in
262
262
263
263
## Clean up resources
264
264
265
-
1. To avoid unnecessary cost, use the following commands to delete the resource group.
265
+
1. To avoid unnecessary costs, use the following command to delete the resource group.
0 commit comments