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
Copy file name to clipboardExpand all lines: articles/spring-apps/quickstart-deploy-web-app.md
+24-22Lines changed: 24 additions & 22 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -23,18 +23,18 @@ This quickstart shows how to deploy a Spring Boot web application to Azure Sprin
23
23
24
24
- A frontend bounded [React](https://reactjs.org/) application.
25
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.
26
+
- A relational database. For localhost, the application uses [H2 Database Engine](https://www.h2database.com/html/main.html). For Azure Spring Apps, the application uses Azure Database for PreSql. For more information about Azure Database for PreSql, see [Flexible Server documentation](/azure/postgresql/flexible-server/).
27
27
28
28
The following diagram shows the architecture of the system:
29
29
30
30
:::image type="content" source="media/quickstart-deploy-web-app/diagram.png" alt-text="Image that shows the architecture of a Spring web application.":::
31
31
32
32
## Prerequisites
33
33
34
-
-[Git](https://git-scm.com/downloads).
35
-
-[Java Development Kit (JDK)](/java/azure/jdk/). Version 17.
36
34
- An Azure subscription. If you don't have a subscription, create a [free account](https://azure.microsoft.com/free/) before you begin.
37
35
-[Azure CLI](/cli/azure/install-azure-cli). Version 2.45.0 or greater.
36
+
-[Git](https://git-scm.com/downloads).
37
+
-[Java Development Kit (JDK)](/java/azure/jdk/), version 17.
38
38
39
39
## Clone and run the sample project locally
40
40
@@ -51,7 +51,7 @@ The following diagram shows the architecture of the system:
51
51
./mvnw clean package -DskipTests
52
52
```
53
53
54
-
1. Use the following Maven command to run the sample application:
54
+
1. Use the following command to run the sample application by Maven:
@@ -67,7 +67,7 @@ The main resources required to run this sample are an Azure Spring Apps instance
67
67
68
68
### Step 1 - Provide names for each resource
69
69
70
-
Specify the following suggested names for the resources.
70
+
Set the following names for the resources. Make adjustments as needed to avoid conflicts with existing resources.
71
71
72
72
```azurecli-interactive
73
73
RESOURCE_GROUP=WebAppResourceGroup
@@ -95,13 +95,13 @@ 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, use the following command to list all available subscriptions:
98
+
1. Set the default subscription. Use the following command to first list all available subscriptions:
99
99
100
100
```azurecli-interactive
101
101
az account list --output table
102
102
```
103
103
104
-
Choose one subscription and set it as the default subscription with the following command:
104
+
Choose a subscription and set it as the default subscription with the following command:
105
105
106
106
```azurecli-interactive
107
107
az account set --subscription <subscription-ID>
@@ -121,15 +121,15 @@ Use the following steps to create a new resource group.
121
121
122
122
### Step 3 - Create an Azure Spring Apps instance
123
123
124
-
Azure Spring Apps is used to host the spring web app. Create an Azure Spring Apps instance and create an app inside it.
124
+
Azure Spring Apps is used to host the Spring web app. Create an Azure Spring Apps instance and an application inside it.
125
125
126
126
1. Create an Azure Spring Apps service instance.
127
127
128
128
```azurecli-interactive
129
129
az spring create --name ${AZURE_SPRING_APPS_NAME}
130
130
```
131
131
132
-
1. Create an app in the Azure Spring Apps instance.
132
+
1. Create an application in the Azure Spring Apps instance.
133
133
134
134
```azurecli-interactive
135
135
az spring app create \
@@ -141,7 +141,9 @@ Azure Spring Apps is used to host the spring web app. Create an Azure Spring App
141
141
142
142
### Step 4 - Prepare the PostgreSQL instance
143
143
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:
144
+
The Spring web app uses H2 for the database in localhost, and Azure Database for PostgreSQL for the database in Azure.
145
+
146
+
Use the following command to create a PostgreSQL instance:
145
147
146
148
```azurecli-interactive
147
149
az postgres flexible-server create \
@@ -150,30 +152,30 @@ az postgres flexible-server create \
150
152
--active-directory-auth Enabled
151
153
```
152
154
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.
155
+
To ensure that the application 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
156
155
-
```bash
157
+
```azurecli
156
158
Do you want to enable access to client xxx.xxx.xxx.xxx (y/n) (y/n): n
157
159
Do you want to enable access for all IPs (y/n): n
158
160
```
159
161
160
162
### Step 5 - Connect app instance to PostgreSQL instance
161
163
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.
164
+
After the application instance and the PostgreSQL instance are created, the application instance can't access the PostgreSQL instance directly. The following steps use Service Connector to configure the needed network settings and connection information. For more information about Service Connector, see [What is Service Connector?](/azure/service-connector/overview).
163
165
164
166
1. If you're using Service Connector for the first time, register the Service Connector resource provider.
165
167
166
168
```azurecli-interactive
167
169
az provider register --namespace Microsoft.ServiceLinker
168
170
```
169
171
170
-
1.To achieve passwordless connection in Service Connector, use the following command:
172
+
1.Use the following command to achieve a passwordless connection:
171
173
172
174
```azurecli-interactive
173
175
az extension add --name serviceconnector-passwordless --upgrade
174
176
```
175
177
176
-
1. Use the following command to create a service connection between the app and the PostgreSQL:
178
+
1. Use the following command to create a service connection between the application and the PostgreSQL database:
177
179
178
180
```azurecli-interactive
179
181
az spring connection create postgres-flexible \
@@ -200,7 +202,7 @@ After the app instance and the PostgreSQL instance have been created, the app in
200
202
--connection ${CONNECTION}
201
203
```
202
204
203
-
The output should appear as the following JSON code:
205
+
The output should appear similar to the following JSON code:
204
206
205
207
```json
206
208
[
@@ -241,7 +243,9 @@ After the app instance and the PostgreSQL instance have been created, the app in
241
243
242
244
## Deploy the app to Azure Spring Apps
243
245
244
-
1. With the cloud environment prepared, use the following command to deploy the app:
246
+
Now that the cloud environment is prepared, the application is ready to deploy.
247
+
248
+
1. Use the following command to deploy the app:
245
249
246
250
```azurecli-interactive
247
251
az spring app deploy \
@@ -270,8 +274,6 @@ After the app instance and the PostgreSQL instance have been created, the app in
270
274
271
275
## Next steps
272
276
273
-
1.[Bind an Azure Database for PostgreSQL to your application in Azure Spring Apps](/azure/spring-apps/how-to-bind-postgres?tabs=Secrets).
274
-
2.[Create a service connection in Azure Spring Apps with the Azure CLI](/azure/service-connector/quickstart-cli-spring-cloud-connection).
275
-
3.[Azure Spring Apps Samples](https://github.com/Azure-Samples/Azure-Spring-Cloud-Samples).
276
-
4.[Spring on Azure](/azure/developer/java/spring/)
0 commit comments