@@ -4,7 +4,7 @@ description: Describes how to deploy a web application to Azure Spring Apps.
4
4
author : karlerickson
5
5
ms.service : spring-apps
6
6
ms.topic : quickstart
7
- ms.date : 04/05 /2023
7
+ ms.date : 04/06 /2023
8
8
ms.author : rujche
9
9
ms.custom : devx-track-java, devx-track-azurecli, mode-other, event-tier1-build-2022, engagement-fy23
10
10
---
@@ -73,7 +73,7 @@ The main resources required to run this sample are an Azure Spring Apps instance
73
73
74
74
Create variables to hold the resource names. Be sure to replace the placeholders with your own values.
75
75
76
- ``` azurecli-interactive
76
+ ``` azurecli
77
77
RESOURCE_GROUP=<resource-group-name>
78
78
LOCATION=<location>
79
79
POSTGRESQL_SERVER=<server-name>
@@ -89,37 +89,37 @@ Use the following steps to create a new resource group.
89
89
90
90
1 . Use the following command to sign in to Azure CLI.
91
91
92
- ``` azurecli-interactive
92
+ ``` azurecli
93
93
az login
94
94
```
95
95
96
96
1 . Use the following command to set the default location.
97
97
98
- ``` azurecli-interactive
98
+ ``` azurecli
99
99
az configure --defaults location=${LOCATION}
100
100
```
101
101
102
102
1 . Set the default subscription. Use the following command to first list all available subscriptions:
103
103
104
- ``` azurecli-interactive
104
+ ``` azurecli
105
105
az account list --output table
106
106
```
107
107
108
108
1 . Choose a subscription and set it as the default subscription with the following command:
109
109
110
- ``` azurecli-interactive
110
+ ``` azurecli
111
111
az account set --subscription <subscription-ID>
112
112
```
113
113
114
114
1 . Use the following command to create a resource group.
115
115
116
- ``` azurecli-interactive
116
+ ``` azurecli
117
117
az group create --resource-group ${RESOURCE_GROUP}
118
118
```
119
119
120
120
1 . Use the following command to set the newly created resource group as the default resource group.
121
121
122
- ``` azurecli-interactive
122
+ ``` azurecli
123
123
az configure --defaults group=${RESOURCE_GROUP}
124
124
```
125
125
@@ -129,13 +129,13 @@ Azure Spring Apps is used to host the Spring web app. Create an Azure Spring App
129
129
130
130
1 . Use the following command to create an Azure Spring Apps service instance.
131
131
132
- ``` azurecli-interactive
132
+ ``` azurecli
133
133
az spring create --name ${AZURE_SPRING_APPS_NAME}
134
134
```
135
135
136
136
1 . Use the following command to create an application in the Azure Spring Apps instance.
137
137
138
- ``` azurecli-interactive
138
+ ``` azurecli
139
139
az spring app create \
140
140
--service ${AZURE_SPRING_APPS_NAME} \
141
141
--name ${APP_NAME} \
@@ -149,7 +149,7 @@ The Spring web app uses H2 for the database in localhost, and Azure Database for
149
149
150
150
Use the following command to create a PostgreSQL instance:
151
151
152
- ``` azurecli-interactive
152
+ ``` azurecli
153
153
az postgres flexible-server create \
154
154
--name ${POSTGRESQL_SERVER} \
155
155
--database-name ${POSTGRESQL_DB} \
@@ -169,19 +169,19 @@ After the application instance and the PostgreSQL instance are created, the appl
169
169
170
170
1 . If you're using Service Connector for the first time, use the following command to register the Service Connector resource provider.
171
171
172
- ``` azurecli-interactive
172
+ ``` azurecli
173
173
az provider register --namespace Microsoft.ServiceLinker
174
174
```
175
175
176
176
1 . Use the following command to achieve a passwordless connection:
177
177
178
- ``` azurecli-interactive
178
+ ``` azurecli
179
179
az extension add --name serviceconnector-passwordless --upgrade
180
180
```
181
181
182
182
1 . Use the following command to create a service connection between the application and the PostgreSQL database:
183
183
184
- ``` azurecli-interactive
184
+ ``` azurecli
185
185
az spring connection create postgres-flexible \
186
186
--resource-group ${RESOURCE_GROUP} \
187
187
--service ${AZURE_SPRING_APPS_NAME} \
@@ -198,7 +198,7 @@ After the application instance and the PostgreSQL instance are created, the appl
198
198
199
199
1 . After the connection is created, use the following command to validate the connection:
200
200
201
- ``` azurecli-interactive
201
+ ``` azurecli
202
202
az spring connection validate \
203
203
--resource-group ${RESOURCE_GROUP} \
204
204
--service ${AZURE_SPRING_APPS_NAME} \
@@ -251,7 +251,7 @@ Now that the cloud environment is prepared, the application is ready to deploy.
251
251
252
252
1 . Use the following command to deploy the app:
253
253
254
- ``` azurecli-interactive
254
+ ``` azurecli
255
255
az spring app deploy \
256
256
--service ${AZURE_SPRING_APPS_NAME} \
257
257
--name ${APP_NAME} \
@@ -262,7 +262,7 @@ Now that the cloud environment is prepared, the application is ready to deploy.
262
262
263
263
1 . If there's a problem when you deploy the app, check the app's log to investigate by using the following command:
264
264
265
- ``` azurecli-interactive
265
+ ``` azurecli
266
266
az spring app logs \
267
267
--service ${AZURE_SPRING_APPS_NAME} \
268
268
--name ${APP_NAME}
@@ -272,7 +272,7 @@ Now that the cloud environment is prepared, the application is ready to deploy.
272
272
273
273
1 . To avoid unnecessary costs, use the following command to delete the resource group.
274
274
275
- ``` azurecli-interactive
275
+ ``` azurecli
276
276
az group delete --name ${RESOURCE_GROUP}
277
277
```
278
278
0 commit comments