Skip to content

Commit f335edc

Browse files
Merge pull request #239072 from moarychan/moary/quickstart/redesign-event-driven
Redesign quick start doc with standard tier - Launch your first event-driven app
2 parents 0030d1a + 3062535 commit f335edc

28 files changed

+1010
-407
lines changed

articles/spring-apps/.openpublishing.redirection.spring-apps.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,11 @@
3434
"source_path": "tutorial-custom-domain.md",
3535
"redirect_url": "/azure/spring-apps/how-to-custom-domain",
3636
"redirect_document_id": true
37+
},
38+
{
39+
"source_path": "quickstart-deploy-event-driven-app-standard-consumption.md",
40+
"redirect_url": "/azure/spring-apps/quickstart-deploy-event-driven-app",
41+
"redirect_document_id": true
3742
}
3843
]
3944
}
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
---
2+
author: karlerickson
3+
ms.author: v-shilichen
4+
ms.service: spring-apps
5+
ms.topic: include
6+
ms.date: 07/19/2023
7+
---
8+
9+
<!--
10+
For clarity of structure, a separate markdown file is used to describe how to clean up resources using Azure Portal or AZD.
11+
12+
[!INCLUDE [clean-up-resources-portal-or-azd](includes/quickstart-deploy-event-driven-app/clean-up-resources.md)]
13+
14+
-->
15+
16+
## 6. Clean up resources
17+
18+
::: zone pivot="sc-consumption-plan,sc-enterprise"
19+
20+
Be sure to delete the resources you created in this article when you no longer need them. To delete the resources, just delete the resource group that contains them. You can delete the resource group using the Azure portal. Alternatively, to delete the resource group by using Azure CLI, use the following command:
21+
22+
```azurecli
23+
az group delete --name ${RESOURCE_GROUP}
24+
```
25+
26+
::: zone-end
27+
28+
::: zone pivot="sc-standard"
29+
30+
You can delete the Azure resource group, which includes all the resources in the resource group. Use the following steps to delete the entire resource group, including the newly created service:
31+
32+
### [Azure portal](#tab/Azure-portal)
33+
34+
1. Locate your resource group in the Azure portal. On the navigation menu, select **Resource groups**. Then, select the name of your resource group - for example, **myresourcegroup**.
35+
36+
1. On your resource group page, select **Delete**. Enter the name of your resource group in the text box to confirm deletion - for example, **myresourcegroup** - then, select **Delete**.
37+
38+
### [Azure Developer CLI](#tab/Azure-Developer-CLI)
39+
40+
Use the following command to delete all the Azure resources used in this sample application:
41+
42+
```bash
43+
azd down
44+
```
45+
46+
The following list describes the command interactions:
47+
48+
- **Total resources to delete: \<your-resources-total>, are you sure you want to continue?**: Press <kbd>y</kbd>.
49+
- **Would you like to permanently delete these resources instead, allowing their names to be reused?**: Press <kbd>y</kbd>. Press <kbd>n</kbd> if you want to reuse the Key Vault.
50+
51+
The console outputs messages similar to the following example:
52+
53+
```output
54+
SUCCESS: Your application was removed from Azure in xx minutes xx seconds.
55+
```
56+
57+
---
58+
59+
::: zone-end
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
---
2+
author: karlerickson
3+
ms.author: v-shilichen
4+
ms.service: spring-apps
5+
ms.custom: event-tier1-build-2022
6+
ms.topic: include
7+
ms.date: 07/19/2023
8+
---
9+
10+
<!--
11+
For clarity of structure, a separate markdown file is used to describe how to prepare event-driven project.
12+
13+
[!INCLUDE [deployment-event-driven](../../includes/quickstart-deploy-event-driven-app/deployment-event-driven.md)]
14+
15+
-->
16+
17+
This section provides the steps to deploy your application to Azure Spring Apps.
18+
19+
### [Azure portal](#tab/Azure-portal)
20+
21+
Use the following steps to deploy your JAR file with the [Maven plugin for Azure Spring Apps](https://github.com/microsoft/azure-maven-plugins/wiki/Azure-Spring-Apps).
22+
23+
1. Navigate to the sample project directory and use the following command to configure the app for Azure Spring Apps:
24+
25+
```bash
26+
./mvnw com.microsoft.azure:azure-spring-apps-maven-plugin:1.17.0:config
27+
```
28+
29+
The following list describes the command interactions:
30+
31+
- **OAuth2 login**: You need to authorize the login to Azure based on the OAuth2 protocol.
32+
- **Select subscription**: Select the subscription list number of the Azure Spring Apps instance you created, which defaults to the first subscription in the list. If you use the default number, press <kbd>Enter</kbd>.
33+
- **Select Azure Spring Apps for deployment**: Select the list number of the Azure Spring Apps instance you created. If you use the default number, press <kbd>Enter</kbd>.
34+
- **Input the app name(simple-event-driven-app)**: Provide an app name. To use the default project artifact ID as the name, press <kbd>Enter</kbd>.
35+
- **Expose public access for this app (Simple Event Driven App)?**: Press <kbd>n</kbd>.
36+
- **Confirm to save all the above configurations (Y/n)**: Press <kbd>y</kbd>. If you press <kbd>n</kbd>, the configuration isn't saved in the POM file.
37+
38+
1. Use the following command to deploy the app:
39+
40+
```bash
41+
./mvnw com.microsoft.azure:azure-spring-apps-maven-plugin:1.17.0:deploy
42+
```
43+
44+
The following list describes the command interaction:
45+
46+
- **OAuth2 login**: You need to authorize the login to Azure based on the OAuth2 protocol.
47+
48+
After the command is executed, you can see the following output, which indicates that the deployment was successful.
49+
50+
```output
51+
[INFO] Deployment(default) is successfully updated.
52+
[INFO] Deployment Status: Running
53+
```
54+
55+
### [Azure Developer CLI](#tab/Azure-Developer-CLI)
56+
57+
Use the following steps to use AZD to package the app, provision the Azure resources required by the web application, and then deploy to Azure Spring Apps.
58+
59+
1. Use the following command to package a deployable copy of your application:
60+
61+
```bash
62+
azd package
63+
```
64+
65+
1. Use the following command to deploy the application code to those newly provisioned resources:
66+
67+
```bash
68+
azd deploy
69+
```
70+
71+
The console outputs messages similar to the following example:
72+
73+
```output
74+
Deploying services (azd deploy)
75+
76+
WARNING: Feature 'springapp' is in alpha stage.
77+
To learn more about alpha features and their support, visit https://aka.ms/azd-feature-stages.
78+
79+
(✓) Done: Deploying service simple-event-driven-app
80+
- No endpoints were found
81+
82+
SUCCESS: Your application was deployed to Azure in xx minutes xx seconds.
83+
You can view the resources created under the resource group rg-<your-environment-name> in Azure Portal:
84+
https://portal.azure.com/#@/resource/subscriptions/<your-subscription-id>/resourceGroups/rg-<your-environment-name>/overview
85+
```
86+
87+
> [!NOTE]
88+
> You can also use `azd up` to combine the previous three commands: `azd package` (packages a deployable copy of your application), `azd provision` (provisions Azure resources), and `azd deploy` (deploys application code). For more information, see [Azure-Samples/ASA-Samples-Event-Driven-Application](https://github.com/Azure-Samples/ASA-Samples-Event-Driven-Application.git).
89+
90+
---
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
---
2+
author: karlerickson
3+
ms.author: v-shilichen
4+
ms.service: spring-apps
5+
ms.custom: event-tier1-build-2022
6+
ms.topic: include
7+
ms.date: 07/19/2023
8+
---
9+
10+
<!--
11+
For clarity of structure, a separate markdown file is used to describe how to deploy to Azure Spring Apps with Basic/Standard plan.
12+
13+
[!INCLUDE [deploy-event-driven-app-with-basic-standard-plan](includes/quickstart-deploy-event-driven-app/deploy-event-driven-app-basic-standard-plan.md)]
14+
15+
-->
16+
17+
## 2. Prepare the Spring project
18+
19+
[!INCLUDE [prepare-spring-project-event-driven](../../includes/quickstart-deploy-event-driven-app/prepare-spring-project-event-driven.md)]
20+
21+
## 3. Prepare the cloud environment
22+
23+
[!INCLUDE [prepare-cloud-environment-event-driven](../../includes/quickstart-deploy-event-driven-app/prepare-cloud-environment-event-driven.md)]
24+
25+
## 4. Deploy the app to Azure Spring Apps
26+
27+
[!INCLUDE [deployment-event-driven](../../includes/quickstart-deploy-event-driven-app/deploy-app-azure-spring-apps-event-driven.md)]
Lines changed: 159 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,159 @@
1+
---
2+
author: karlerickson
3+
ms.author: v-shilichen
4+
ms.service: spring-apps
5+
ms.custom: event-tier1-build-2022
6+
ms.topic: include
7+
ms.date: 07/19/2023
8+
---
9+
10+
<!--
11+
For clarity of structure, a separate markdown file is used to describe how to deploy to Azure Spring Apps with Enterprise plan.
12+
13+
[!INCLUDE [deploy-event-driven-app-with-enterprise-plan](includes/quickstart-deploy-event-driven-app/deploy-event-driven-app-enterprise-plan.md)]
14+
15+
-->
16+
17+
## 2. Prepare the Spring project
18+
19+
Use the following steps to prepare the sample locally.
20+
21+
[!INCLUDE [prepare-spring-project-git-event-driven](../../includes/quickstart-deploy-event-driven-app/prepare-spring-project-git-event-driven.md)]
22+
23+
## 3. Prepare the cloud environment
24+
25+
The main resources you need to run this sample are an Azure Spring Apps instance and an Azure Service Bus instance. Use the following steps to create these resources.
26+
27+
### 3.1. Provide names for each resource
28+
29+
Create variables to hold the resource names by using the following commands. Be sure to replace the placeholders with your own values.
30+
31+
```azurecli
32+
export RESOURCE_GROUP=<event-driven-app-resource-group-name>
33+
export LOCATION=<desired-region>
34+
export SERVICE_BUS_NAME_SPACE=<event-driven-app-service-bus-namespace>
35+
export AZURE_SPRING_APPS_INSTANCE=<Azure-Spring-Apps-instance-name>
36+
export APP_NAME=<event-driven-app-name>
37+
```
38+
39+
### 3.2. Create a new resource group
40+
41+
Use the following steps to create a new resource group:
42+
43+
1. Use the following command to sign in to the Azure CLI:
44+
45+
```azurecli
46+
az login
47+
```
48+
49+
1. Use the following command to set the default location:
50+
51+
```azurecli
52+
az configure --defaults location=${LOCATION}
53+
```
54+
55+
1. Use the following command to list all available subscriptions to determine the subscription ID to use:
56+
57+
```azurecli
58+
az account list --output table
59+
```
60+
61+
1. Use the following command to set the default subscription:
62+
63+
```azurecli
64+
az account set --subscription <subscription-ID>
65+
```
66+
67+
1. Use the following command to create a resource group:
68+
69+
```azurecli
70+
az group create --resource-group ${RESOURCE_GROUP}
71+
```
72+
73+
1. Use the following command to set the newly created resource group as the default resource group:
74+
75+
```azurecli
76+
az configure --defaults group=${RESOURCE_GROUP}
77+
```
78+
79+
### 3.3. Install extension and register namespace
80+
81+
Use the following commands to install the Azure Spring Apps extension for the Azure CLI and register the `Microsoft.SaaS` namespace:
82+
83+
```azurecli
84+
az extension add --name spring --upgrade
85+
az provider register --namespace Microsoft.SaaS
86+
```
87+
88+
### 3.4. Create an Azure Spring Apps instance
89+
90+
Use the following command to create your Azure Spring Apps instance:
91+
92+
```azurecli
93+
az spring create \
94+
--name ${AZURE_SPRING_APPS_INSTANCE} \
95+
--sku Enterprise
96+
```
97+
98+
Then, use the following command to create an app in the Azure Spring Apps instance:
99+
100+
```azurecli
101+
az spring app create \
102+
--service ${AZURE_SPRING_APPS_INSTANCE} \
103+
--name ${APP_NAME}
104+
```
105+
106+
### 3.5. Create a Service Bus instance
107+
108+
Use the following command to create a Service Bus namespace:
109+
110+
```azurecli
111+
az servicebus namespace create --name ${SERVICE_BUS_NAME_SPACE}
112+
```
113+
114+
Then, use the following commands to create two queues named `lower-case` and `upper-case`:
115+
116+
```azurecli
117+
az servicebus queue create \
118+
--namespace-name ${SERVICE_BUS_NAME_SPACE} \
119+
--name lower-case
120+
az servicebus queue create \
121+
--namespace-name ${SERVICE_BUS_NAME_SPACE} \
122+
--name upper-case
123+
```
124+
125+
### 3.6. Connect app instance to Service Bus instance
126+
127+
Now, both the Service Bus and the app in Azure Spring Apps have been created, but the app can't connect to the Service Bus. Use the following steps to enable the app to connect to the Service Bus, and then deploy the app:
128+
129+
1. Get the Service Bus's connection string by using the following command:
130+
131+
```azurecli
132+
export SERVICE_BUS_CONNECTION_STRING=$( \
133+
az servicebus namespace authorization-rule keys list \
134+
--namespace-name ${SERVICE_BUS_NAME_SPACE} \
135+
--name RootManageSharedAccessKey \
136+
--query primaryConnectionString \
137+
--output tsv)
138+
```
139+
140+
1. Use the following command to provide the connection string to the app through an environment variable:
141+
142+
```azurecli
143+
az spring app update \
144+
--service ${AZURE_SPRING_APPS_INSTANCE} \
145+
--name ${APP_NAME} \
146+
--env SPRING_CLOUD_AZURE_SERVICEBUS_CONNECTIONSTRING=${SERVICE_BUS_CONNECTION_STRING} \
147+
SPRING_CLOUD_AZURE_KEYVAULT_SECRET_PROPERTYSOURCEENABLED=false
148+
```
149+
150+
## 4. Deploy the app to Azure Spring Apps
151+
152+
Now the cloud environment is ready. Deploy the app by using the following command:
153+
154+
```azurecli
155+
az spring app deploy \
156+
--service ${AZURE_SPRING_APPS_INSTANCE} \
157+
--name ${APP_NAME} \
158+
--artifact-path target/simple-event-driven-app-0.0.1-SNAPSHOT.jar
159+
```

0 commit comments

Comments
 (0)