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
> Azure Spring Apps is the new name for the Azure Spring Cloud service. Although the service has a new name, you'll see the old name in some places for a while as we work to update assets such as screenshots, videos, and diagrams.
This quickstart explains how to deploy a small application to run on Azure Spring Apps.
22
+
This article explains how to deploy a small application to run on Azure Spring Apps.
23
23
24
-
The application code used in this tutorial is a simple app. When you've completed this example, the application will be accessible online, and you can manage it through the Azure portal.
24
+
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.
25
25
26
26
This quickstart explains how to:
27
27
@@ -32,27 +32,28 @@ This quickstart explains how to:
32
32
> - Build and deploy an app with a public endpoint.
33
33
> - Clean up the resources.
34
34
35
-
At the end of this quickstart, you'll have a working spring app running on Azure Spring Apps.
35
+
At the end of this quickstart, you have a working spring app running on Azure Spring Apps.
36
36
37
37
## [Azure CLI](#tab/Azure-CLI)
38
38
39
39
## Prerequisites
40
40
41
41
- 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`
43
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).
44
45
45
46
## Provision an instance of Azure Spring Apps
46
47
47
-
Use the following steps to provision a service instance.
48
+
Use the following steps to create an Azure Spring Apps service instance.
48
49
49
-
1. Select **Try It** and sign in to your Azure account in [Azure Cloud Shell](../cloud-shell/overview.md).
50
+
1. Select **Open Cloudshell** and sign in to your Azure account in [Azure Cloud Shell](../cloud-shell/overview.md).
50
51
51
52
```azurecli-interactive
52
53
az account show
53
54
```
54
55
55
-
1. Azure Cloud Shell workspaces are temporary. On initial start, the shell prompts you to associate an [Azure Storage](../storage/common/storage-introduction.md) instance with your subscription to persist files across sessions.
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.
56
57
57
58
:::image type="content" source="media/quickstart/azure-storage-subscription.png" alt-text="Screenshot of Azure Storage subscription." lightbox="media/quickstart/azure-storage-subscription.png":::
58
59
@@ -62,7 +63,7 @@ Use the following steps to provision a service instance.
62
63
az account list --output table
63
64
```
64
65
65
-
1. Use the following command to choose and link to your subscription.
66
+
1. Use the following command to set your default subscription.
66
67
67
68
```azurecli-interactive
68
69
az account set --subscription <subscription-id>
@@ -81,19 +82,23 @@ Use the following steps to provision a service instance.
81
82
```azurecli-interactive
82
83
az spring create \
83
84
--resource-group <name-of-resource-group> \
84
-
--name <service-instance-name>
85
+
--name <Azure-Spring-Apps-instance-name>
85
86
```
86
87
87
-
1.Choose**Y** to install the Azure Spring Apps extension and run it.
88
+
1.Select**Y** to install the Azure Spring Apps extension and run it.
88
89
89
90
## Create an app in your Azure Spring Apps instance
90
91
91
-
Use the following command to specify the app name on Azure Spring Apps as *hellospring*.
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.
93
+
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.":::
95
+
96
+
Use the following command to specify the app name on Azure Spring Apps as *hello spring*.
92
97
93
98
```azurecli-interactive
94
99
az spring app create \
95
100
--resource-group <name-of-resource-group> \
96
-
--service <service-instance-name> \
101
+
--service <Azure-Spring-Apps-instance-name> \
97
102
--name hellospring \
98
103
--assign-endpoint true
99
104
```
@@ -127,13 +132,170 @@ Use the following command to deploy the *.jar* file for the app (*target/spring-
-[Azure CLI](/cli/azure/install-azure-cli). Install the spring extension for `StandardGen2` Azure Spring Apps by using the following command.
149
+
150
+
```shell
151
+
az extension add --upgrade --name spring
152
+
```
153
+
154
+
- 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`
155
+
156
+
```shell
157
+
az extension add --name containerapp --upgrade
158
+
az provider register --namespace Microsoft.App
159
+
az provider register --namespace Microsoft.OperationalInsights
160
+
az provider register --namespace Microsoft.AppPlatform
161
+
```
162
+
163
+
## Provision an instance of Azure Spring Apps
164
+
165
+
Use the following steps to create an Azure Spring Apps service instance.
166
+
167
+
1. Select **Open Cloudshell** and sign in to your Azure account in [Azure Cloud Shell](../cloud-shell/overview.md).
168
+
169
+
```azurecli-interactive
170
+
az account show
171
+
```
172
+
173
+
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.
174
+
175
+
:::image type="content" source="media/quickstart/azure-storage-subscription.png" alt-text="Screenshot of Azure Storage subscription." lightbox="media/quickstart/azure-storage-subscription.png":::
176
+
177
+
1. After you sign in successfully, use the following command to display a list of your subscriptions.
178
+
179
+
```azurecli-interactive
180
+
az account list --output table
181
+
```
182
+
183
+
1. Use the following command to set your default subscription.
184
+
185
+
```azurecli-interactive
186
+
az account set --subscription <subscription-id>
187
+
```
188
+
189
+
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.
200
+
201
+
```azurecli-interactive
202
+
az group create \
203
+
--resource-group ${RESOURCE_GROUP} \
204
+
--location ${LOCATION}
205
+
```
206
+
207
+
1. An Azure Container App 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/azure-monitor/logs/log-analytics-workspace-overview). To create the environment, run the following command:
208
+
209
+
```azurecli-interactive
210
+
az containerapp env create \
211
+
--name ${MANAGED_ENVIRONMENT} \
212
+
--resource-group ${RESOURCE_GROUP} \
213
+
--location ${LOCATION}
214
+
```
215
+
216
+
1. Use the following command to create a variable to store the environment resource ID:
217
+
218
+
```azurecli-interactive
219
+
MANAGED_ENV_RESOURCE_ID=$(az containerapp env show \
220
+
--name ${MANAGED_ENVIRONMENT} \
221
+
--resource-group ${RESOURCE_GROUP} \
222
+
--query id \
223
+
--output tsv)
224
+
```
225
+
226
+
1. Use the following command to create an Azure Spring Apps service instance. The `StandardGen2` Azure Spring Apps 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
238
+
239
+
An [*App*](/azure/spring-apps/concept-understand-app-and-deployment) 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.
240
+
241
+
:::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.":::
242
+
243
+
Use the following command to specify the app name on Azure Spring Apps and to allocate required resources:
244
+
245
+
```azurecli-interactive
246
+
az spring app create \
247
+
--resource-group ${RESOURCE_GROUP} \
248
+
--service ${SERVICE_NAME} \
249
+
--name ${APP_NAME} \
250
+
--cpu 1 \
251
+
--memory 2Gi \
252
+
--instance-count 2 \
253
+
--assign-endpoint true
254
+
```
255
+
256
+
Azure Spring Apps creates an empty welcome application and provides its URL in the field named `properties.url`.
257
+
258
+
:::image type="content" source="media/quickstart/app-welcome-page.png" alt-text="Screenshot of the welcome page." lightbox="media/quickstart/app-welcome-page.png":::
259
+
260
+
## Clone and build the Spring Boot sample project
261
+
262
+
Use the following steps to clone the Spring Boot sample project.
263
+
264
+
1. Use the following command to clone the [Spring Boot sample project](https://github.com/spring-guides/gs-spring-boot.git) from GitHub.
@@ -149,37 +311,36 @@ Use the following steps to create the project:
149
311
150
312
1. Use [Spring Initializr](https://start.spring.io/#!type=maven-project&language=java&platformVersion=2.6.10&packaging=jar&jvmVersion=11&groupId=com.example&artifactId=hellospring&name=hellospring&description=Demo%20project%20for%20Spring%20Boot&packageName=com.example.hellospring&dependencies=web,cloud-eureka,actuator,cloud-config-client) to generate a sample project with recommended dependencies for Azure Spring Apps. The following URL provides default settings for you.
The following image shows the recommended Initializr settings for the *hellospring* sample project.
318
+
The following image shows the recommended Initializr settings for the *hellospring* sample project.
157
319
158
-
This example uses Java version 11. To use a different Java version, change the Java version setting under **Project Metadata**.
320
+
This example uses Java version 11. To use a different Java version, change the Java version setting under **Project Metadata**.
159
321
160
-
:::image type="content" source="media/quickstart/initializr-page.png" alt-text="Screenshot of Spring Initializr page." lightbox="media/quickstart/initializr-page.png":::
322
+
:::image type="content" source="media/quickstart/initializr-page.png" alt-text="Screenshot of Spring Initializr page." lightbox="media/quickstart/initializr-page.png":::
161
323
162
324
1. When all dependencies are set, select **Generate**.
163
325
1. Download and unpack the package, and then create a web controller for your web application by adding the file *src/main/java/com/example/hellospring/HelloController.java* with the following contents:
Use the following steps to create an instance of Azure Spring Apps using the Azure portal.
185
346
@@ -195,11 +356,11 @@ Use the following steps to create an instance of Azure Spring Apps using the Azu
195
356
196
357
:::image type="content" source="media/quickstart/spring-apps-create.png" alt-text="Screenshot of Azure portal showing Azure Spring Apps resource with Create button highlighted." lightbox="media/quickstart/spring-apps-create.png":::
197
358
198
-
1.Fill out the form on the AzureSpringApps**Create** page. Consider the following guidelines:
359
+
1. Fill out the form on the Azure Spring Apps **Create** page. Consider the following guidelines:
199
360
200
361
-**Subscription**: Select the subscription you want to be billed for this resource.
201
362
-**Resource group**: Creating new resource groups for new resources is a best practice.
202
-
- **Service Name**: Specify the service instance name. You'll use this name later in this article where the *\<service-instance-name\>* placeholder appears. The name must be between 4 and 32 characters long and can contain only lowercase letters, numbers, and hyphens. The first character of the service name must be a letter and the last character must be either a letter or a number.
363
+
-**Service Name**: Specify the service instance name. You use this name later in this article where the *\<Azure-Spring-Apps-instance-name\>* placeholder appears. The name must be between 4 and 32 characters long and can contain only lowercase letters, numbers, and hyphens. The first character of the service name must be a letter and the last character must be either a letter or a number.
203
364
-**Region**: Select the region for your service instance.
204
365
205
366
:::image type="content" source="media/quickstart/portal-start.png" alt-text="Screenshot of Azure portal showing Azure Spring Apps Create page." lightbox="media/quickstart/portal-start.png":::
@@ -280,9 +441,9 @@ echo "Press [ENTER] to continue ..."
280
441
281
442
## Next steps
282
443
283
-
In this quickstart, you learned how to generate a basic Spring project, provision a service instance, build and deploy an app with a public endpoint, and clean up the resources.
444
+
In this quickstart, you learned how to build and deploy a Spring app in an Azure Spring Apps service instance. You also learned how to deploy an app with a public endpoint, and how to clean up resources.
284
445
285
-
You also have access to powerful logs, metrics, and distributed tracing capability from the Azure portal. For more information, see [Quickstart: Monitoring Azure Spring Apps apps with logs, metrics, and tracing](./quickstart-logs-metrics-tracing.md).
446
+
You have access to powerful logs, metrics, and distributed tracing capability from the Azure portal. For more information, see [Quickstart: Monitoring Azure Spring Apps apps with logs, metrics, and tracing](./quickstart-logs-metrics-tracing.md).
286
447
287
448
To learn how to use more Azure Spring capabilities, advance to the quickstart series that deploys a sample application to Azure Spring Apps:
0 commit comments