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 article explains how to deploy a small application to run on Azure Spring Apps.
23
25
24
26
The application code used in this tutorial is a simple app. When you've completed this example, the application is accessible online, and you can manage it through the Azure portal.
@@ -34,14 +36,28 @@ This quickstart explains how to:
34
36
35
37
At the end of this quickstart, you have a working Spring app running on Azure Spring Apps.
36
38
37
-
## [Azure CLI](#tab/Azure-CLI)
39
+
40
+
## [Standard consumption plan with Azure CLI](#tab/Consumption-Plan)
38
41
39
42
## Prerequisites
40
43
41
44
- An Azure subscription. If you don't have a subscription, create a [free account](https://azure.microsoft.com/free/) before you begin.
-[Azure CLI](/cli/azure/install-azure-cli). Install the Azure Spring Apps extension with the following command: `az extension add --name spring`
44
-
- If you're deploying Azure Spring Apps Enterprise tier for the first time in the target subscription, see the [Prerequisites](./how-to-enterprise-marketplace-offer.md#prerequisites) section of [View Azure Spring Apps Enterprise tier offering in Azure Marketplace](./how-to-enterprise-marketplace-offer.md).
46
+
-[Azure CLI](/cli/azure/install-azure-cli). Install the Azure CLI extension for Azure Spring Apps Standard consumption plan by using the following command.
47
+
48
+
```azurecli
49
+
az extension remove --name spring && \
50
+
az extension add --name spring
51
+
```
52
+
53
+
- Use the following commands to install the Azure Container Apps extension for the Azure CLI and register these namespaces: `Microsoft.App`, `Microsoft.OperationalInsights`, and `Microsoft.AppPlatform`
54
+
55
+
```azurecli
56
+
az extension add --name containerapp --upgrade
57
+
az provider register --namespace Microsoft.App
58
+
az provider register --namespace Microsoft.OperationalInsights
59
+
az provider register --namespace Microsoft.AppPlatform
60
+
```
45
61
46
62
## Provision an instance of Azure Spring Apps
47
63
@@ -53,7 +69,7 @@ Use the following steps to create an Azure Spring Apps service instance.
53
69
az account show
54
70
```
55
71
56
-
1. Azure Cloud Shell workspaces are temporary. When first started, the shell prompts you to select an [Azure Storage](../storage/common/storage-introduction.md) instance with your subscription to persist files across sessions.
72
+
1. Azure Cloud Shell workspaces are temporary. When first started, the shell prompts you to associate an [Azure Storage](../storage/common/storage-introduction.md) instance with your subscription to persist files across sessions.
57
73
58
74
:::image type="content" source="media/quickstart/azure-storage-subscription.png" alt-text="Screenshot of Azure Storage subscription." lightbox="media/quickstart/azure-storage-subscription.png":::
59
75
@@ -69,40 +85,77 @@ Use the following steps to create an Azure Spring Apps service instance.
69
85
az account set --subscription <subscription-ID>
70
86
```
71
87
88
+
1. Define variables for this quickstart with the names of your resources and desired settings.
1. Use the following command to create a resource group.
73
99
74
100
```azurecli-interactive
75
101
az group create \
76
-
--resource-group <name-of-resource-group> \
77
-
--location eastus
102
+
--resource-group ${RESOURCE_GROUP} \
103
+
--location ${LOCATION}
78
104
```
79
105
80
-
1.Use the following command to create an Azure Spring Apps service instance.
106
+
1.An Azure Container Apps environment creates a secure boundary around a group of applications. Apps deployed to the same environment are deployed in the same virtual network and write logs to the same [Log Analytics workspace](../azure-monitor/logs/log-analytics-workspace-overview.md). To create the environment, run the following command:
81
107
82
108
```azurecli-interactive
83
-
az spring create \
84
-
--resource-group <name-of-resource-group> \
85
-
--name <Azure-Spring-Apps-instance-name>
109
+
az containerapp env create \
110
+
--name ${MANAGED_ENVIRONMENT} \
111
+
--resource-group ${RESOURCE_GROUP} \
112
+
--location ${LOCATION}
86
113
```
87
114
88
-
1. Select **Y** to install the Azure Spring Apps extension and run it.
115
+
1. Use the following command to create a variable to store the environment resource ID:
116
+
117
+
```azurecli-interactive
118
+
MANAGED_ENV_RESOURCE_ID=$(az containerapp env show \
119
+
--name ${MANAGED_ENVIRONMENT} \
120
+
--resource-group ${RESOURCE_GROUP} \
121
+
--query id \
122
+
--output tsv)
123
+
```
124
+
125
+
1. Use the following command to create an Azure Spring Apps service instance. The Azure Spring Apps Standard consumption plan instance is built on top of the Azure Container Apps environment. Create your Azure Spring Apps instance by specifying the resource ID of the environment you created.
## Create an app in your Azure Spring Apps instance
91
137
92
-
An [*App*](concept-understand-app-and-deployment.md) is an abstraction of one business app. Apps run in an Azure Spring Apps service instance, as shown in the following diagram.
138
+
An [*App*](concept-understand-app-and-deployment.md) is an abstraction of one business app. Apps run in an Azure Spring Apps service instance, or simply service instance, as shown in the following diagram.
93
139
94
-
:::image type="content" source="media/spring-cloud-app-and-deployment/app-deployment-rev.png" alt-text="Diagram showing the relationship between apps and an Azure Spring Apps service instance.":::
140
+
:::image type="content" source="media/spring-cloud-app-and-deployment/app-deployment-rev.png" alt-text="Diagram showing the relationship between apps and an Azure Spring Apps service instance." border="false":::
95
141
96
-
Use the following command to specify the app name on Azure Spring Apps as *hellospring*.
142
+
Use the following command to specify the app name on Azure Spring Apps and to allocate required resources:
97
143
98
144
```azurecli-interactive
99
145
az spring app create \
100
-
--resource-group <name-of-resource-group> \
101
-
--service <Azure-Spring-Apps-instance-name> \
102
-
--name hellospring \
146
+
--resource-group ${RESOURCE_GROUP} \
147
+
--service ${SERVICE_NAME} \
148
+
--name ${APP_NAME} \
149
+
--cpu 1 \
150
+
--memory 2Gi \
151
+
--instance-count 2 \
103
152
--assign-endpoint true
104
153
```
105
154
155
+
Azure Spring Apps creates an empty welcome application and provides its URL in the field named `properties.url`.
156
+
157
+
:::image type="content" source="media/quickstart/app-welcome-page.png" alt-text="Screenshot of the welcome page." lightbox="media/quickstart/app-welcome-page.png":::
158
+
106
159
## Clone and build the Spring Boot sample project
107
160
108
161
Use the following steps to clone the Spring Boot sample project.
@@ -127,39 +180,47 @@ Use the following steps to clone the Spring Boot sample project.
127
180
128
181
## Deploy the local app to Azure Spring Apps
129
182
130
-
Use the following command to deploy the *.jar* file for the app (*target/spring-boot-complete-0.0.1-SNAPSHOT.jar* on Windows).
183
+
Use the following command to deploy the *.jar* file for the app.
-[Azure CLI](/cli/azure/install-azure-cli). Install the Azure CLI extension for Azure Spring Apps Standard consumption plan by using the following command.
203
+
The application code used in this tutorial is a simple app. When you've completed this example, the application is accessible online, and you can manage it through the Azure portal.
149
204
150
-
```azurecli
151
-
az extension remove --name spring && \
152
-
az extension add --name spring
153
-
```
205
+
This quickstart explains how to:
154
206
155
-
- Use the following commands to install the Azure Container Apps extension for the Azure CLI and register these namespaces: `Microsoft.App`, `Microsoft.OperationalInsights`, and `Microsoft.AppPlatform`
207
+
> [!div class="checklist"]
156
208
157
-
```azurecli
158
-
az extension add --name containerapp --upgrade
159
-
az provider register --namespace Microsoft.App
160
-
az provider register --namespace Microsoft.OperationalInsights
161
-
az provider register --namespace Microsoft.AppPlatform
162
-
```
209
+
> - Generate a basic Spring project.
210
+
> - Provision a service instance.
211
+
> - Build and deploy an app with a public endpoint.
212
+
> - Clean up the resources.
213
+
214
+
At the end of this quickstart, you have a working Spring app running on Azure Spring Apps.
215
+
216
+
## [Azure CLI](#tab/Azure-CLI)
217
+
218
+
## Prerequisites
219
+
220
+
- An Azure subscription. If you don't have a subscription, create a [free account](https://azure.microsoft.com/free/) before you begin.
-[Azure CLI](/cli/azure/install-azure-cli). Install the Azure Spring Apps extension with the following command: `az extension add --name spring`
223
+
- If you're deploying Azure Spring Apps Enterprise tier for the first time in the target subscription, see the [Prerequisites](./how-to-enterprise-marketplace-offer.md#prerequisites) section of [View Azure Spring Apps Enterprise tier offering in Azure Marketplace](./how-to-enterprise-marketplace-offer.md).
163
224
164
225
## Provision an instance of Azure Spring Apps
165
226
@@ -171,7 +232,7 @@ Use the following steps to create an Azure Spring Apps service instance.
171
232
az account show
172
233
```
173
234
174
-
1. Azure Cloud Shell workspaces are temporary. When first started, the shell prompts you to associate an [Azure Storage](../storage/common/storage-introduction.md) instance with your subscription to persist files across sessions.
235
+
1. Azure Cloud Shell workspaces are temporary. When first started, the shell prompts you to select an [Azure Storage](../storage/common/storage-introduction.md) instance with your subscription to persist files across sessions.
175
236
176
237
:::image type="content" source="media/quickstart/azure-storage-subscription.png" alt-text="Screenshot of Azure Storage subscription." lightbox="media/quickstart/azure-storage-subscription.png":::
177
238
@@ -187,77 +248,40 @@ Use the following steps to create an Azure Spring Apps service instance.
187
248
az account set --subscription <subscription-ID>
188
249
```
189
250
190
-
1. Define variables for this quickstart with the names of your resources and desired settings.
1. Use the following command to create a resource group.
201
252
202
253
```azurecli-interactive
203
254
az group create \
204
-
--resource-group ${RESOURCE_GROUP} \
205
-
--location ${LOCATION}
206
-
```
207
-
208
-
1. An Azure Container Apps environment creates a secure boundary around a group of applications. Apps deployed to the same environment are deployed in the same virtual network and write logs to the same [Log Analytics workspace](../azure-monitor/logs/log-analytics-workspace-overview.md). To create the environment, run the following command:
209
-
210
-
```azurecli-interactive
211
-
az containerapp env create \
212
-
--name ${MANAGED_ENVIRONMENT} \
213
-
--resource-group ${RESOURCE_GROUP} \
214
-
--location ${LOCATION}
215
-
```
216
-
217
-
1. Use the following command to create a variable to store the environment resource ID:
218
-
219
-
```azurecli-interactive
220
-
MANAGED_ENV_RESOURCE_ID=$(az containerapp env show \
221
-
--name ${MANAGED_ENVIRONMENT} \
222
-
--resource-group ${RESOURCE_GROUP} \
223
-
--query id \
224
-
--output tsv)
255
+
--resource-group <name-of-resource-group> \
256
+
--location eastus
225
257
```
226
258
227
-
1. Use the following command to create an Azure Spring Apps service instance. The Azure Spring Apps Standard consumption plan instance is built on top of the Azure Container Apps environment. Create your Azure Spring Apps instance by specifying the resource ID of the environment you created.
259
+
1. Use the following command to create an Azure Spring Apps service instance.
1. Select **Y** to install the Azure Spring Apps extension and run it.
268
+
238
269
## Create an app in your Azure Spring Apps instance
239
270
240
-
An [*App*](concept-understand-app-and-deployment.md) is an abstraction of one business app. Apps run in an Azure Spring Apps service instance, or simply service instance, as shown in the following diagram.
271
+
An [*App*](concept-understand-app-and-deployment.md) is an abstraction of one business app. Apps run in an Azure Spring Apps service instance, as shown in the following diagram.
241
272
242
-
:::image type="content" source="media/spring-cloud-app-and-deployment/app-deployment-rev.png" alt-text="Diagram showing the relationship between apps and an Azure Spring Apps service instance." border="false":::
273
+
:::image type="content" source="media/spring-cloud-app-and-deployment/app-deployment-rev.png" alt-text="Diagram showing the relationship between apps and an Azure Spring Apps service instance.":::
243
274
244
-
Use the following command to specify the app name on Azure Spring Apps and to allocate required resources:
275
+
Use the following command to specify the app name on Azure Spring Apps as *hellospring*.
245
276
246
277
```azurecli-interactive
247
278
az spring app create \
248
-
--resource-group ${RESOURCE_GROUP} \
249
-
--service ${SERVICE_NAME} \
250
-
--name ${APP_NAME} \
251
-
--cpu 1 \
252
-
--memory 2Gi \
253
-
--instance-count 2 \
279
+
--resource-group <name-of-resource-group> \
280
+
--service <Azure-Spring-Apps-instance-name> \
281
+
--name hellospring \
254
282
--assign-endpoint true
255
283
```
256
284
257
-
Azure Spring Apps creates an empty welcome application and provides its URL in the field named `properties.url`.
258
-
259
-
:::image type="content" source="media/quickstart/app-welcome-page.png" alt-text="Screenshot of the welcome page." lightbox="media/quickstart/app-welcome-page.png":::
260
-
261
285
## Clone and build the Spring Boot sample project
262
286
263
287
Use the following steps to clone the Spring Boot sample project.
@@ -282,17 +306,14 @@ Use the following steps to clone the Spring Boot sample project.
282
306
283
307
## Deploy the local app to Azure Spring Apps
284
308
285
-
Use the following command to deploy the *.jar* file for the app.
309
+
Use the following command to deploy the *.jar* file for the app (*target/spring-boot-complete-0.0.1-SNAPSHOT.jar* on Windows).
@@ -426,6 +447,7 @@ Use the following steps to build and deploy your app.
426
447
To deploy a Spring Boot web app to Azure Spring Apps, follow the steps in [Java on Azure Spring Apps](https://code.visualstudio.com/docs/java/java-spring-apps).
427
448
428
449
---
450
+
::: zone-end
429
451
430
452
Once deployment has completed, you can access the app at `https://<service-instance-name>-hellospring.azuremicroservices.io/`.
0 commit comments