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-event-driven-app-standard-consumption.md
+72-71Lines changed: 72 additions & 71 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -51,24 +51,18 @@ Use the following steps to prepare the sample locally.
51
51
52
52
## Prepare the cloud environment
53
53
54
-
The main resources you needto run this sample is an Azure Spring Apps instance and an Azure Service Bus instance. This section provides the steps to create these resources.
54
+
The main resources you need to run this sample is an Azure Spring Apps instance and an Azure Service Bus instance. Use the following steps to create these resources.
55
55
56
-
### Step 1 - Set names for resources
56
+
1. Use the following commands to create variables for the names of your resources and for other settings as needed. Resource names in Azure must be unique.
57
57
58
-
Use the following commands to create variables for the names of your resources and for other settings as needed. Resource names in Azure must be unique.
1. Sign in to Azure by using the following command:
74
68
@@ -82,13 +76,13 @@ To manage the resources easily, create a resource group to hold these resources.
82
76
az configure --defaults location=${LOCATION}
83
77
```
84
78
85
-
1. Set your default subscription. Firstly, list all available subscriptions:
79
+
1. Set your default subscription. First, list all available subscriptions:
86
80
87
81
```azurecli
88
82
az account list --output table
89
83
```
90
84
91
-
Determine the ID of the subscription you want to set and use it with the following command to set your default subscription.
85
+
1. Determine the ID of the subscription you want to set and use it with the following command to set your default subscription.
92
86
93
87
```azurecli
94
88
az account set --subscription <subscription-ID>
@@ -106,7 +100,9 @@ To manage the resources easily, create a resource group to hold these resources.
106
100
az configure --defaults group=${RESOURCE_GROUP}
107
101
```
108
102
109
-
### Step 3 - Create a Service Bus instance
103
+
## Create a Service Bus instance
104
+
105
+
Create a Service Bus instance by using the following steps.
110
106
111
107
1. Use the following command to create a Service Bus namespace.
112
108
@@ -125,14 +121,12 @@ To manage the resources easily, create a resource group to hold these resources.
125
121
--name upper-case
126
122
```
127
123
128
-
### Step 4 - Create an Azure Spring Apps Consumption plan instance
129
-
130
-
An Azure Spring Apps Consumption plan hosts the Spring event-driven app. This section provides the steps of to create an instance of an Azure Spring Apps Consumption plan and then creates an app inside the plan.
131
-
132
-
#### Step 4.1 - Create an Azure Container Apps environment
124
+
## Create an Azure Container Apps environment
133
125
134
126
The 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.
135
127
128
+
Use the following steps to create the environment:
129
+
136
130
1. Install the Azure Container Apps extension for the CLI by using the following command:
137
131
138
132
```azurecli
@@ -157,12 +151,14 @@ The Azure Container Apps environment creates a secure boundary around a group of
157
151
az containerapp env create --name ${AZURE_CONTAINER_APPS_ENVIRONMENT}
158
152
```
159
153
160
-
#### Step 4.2 - Create Azure Spring Apps instance
154
+
## Create the Azure Spring Apps instance
155
+
156
+
An Azure Spring Apps Consumption plan instance hosts the Spring event-driven app. Use the following steps to create the service instance and then create an app inside the instance.
161
157
162
-
1. Install the Spring extension designed for StandardGen2 Azure Spring Apps.
158
+
1. Install the Spring extension designed for `StandardGen2` Azure Spring Apps by using the following command:
@@ -179,7 +175,8 @@ The Azure Container Apps environment creates a secure boundary around a group of
179
175
```azurecli
180
176
MANAGED_ENV_RESOURCE_ID=$(az containerapp env show \
181
177
--name ${AZURE_CONTAINER_APPS_ENVIRONMENT} \
182
-
--query id -o tsv)
178
+
--query id \
179
+
--output tsv)
183
180
```
184
181
185
182
1. Use the following command to create your Azure Spring Apps instance, specifying the resource ID of the Azure Container Apps environment you created.
@@ -191,66 +188,70 @@ The Azure Container Apps environment creates a secure boundary around a group of
191
188
--sku standardGen2
192
189
```
193
190
194
-
#### Step 4.3 - Create an app in Azure Spring Apps
195
-
196
-
Create an app in the Azure Spring Apps instance by using the following command:
197
-
198
-
```azurecli
199
-
az spring app create \
200
-
--service ${AZURE_SPRING_APPS_INSTANCE} \
201
-
--name ${APP_NAME} \
202
-
--cpu 1 \
203
-
--memory 2 \
204
-
--instance-count 2 \
205
-
--runtime-version Java_17 \
206
-
--assign-endpoint true
207
-
```
191
+
1. Create an app in the Azure Spring Apps instance by using the following command:
208
192
209
-
### Step 5 - Bind Service Bus to Azure Spring Apps
193
+
```azurecli
194
+
az spring app create \
195
+
--service ${AZURE_SPRING_APPS_INSTANCE} \
196
+
--name ${APP_NAME} \
197
+
--cpu 1 \
198
+
--memory 2 \
199
+
--instance-count 2 \
200
+
--runtime-version Java_17 \
201
+
--assign-endpoint true
202
+
```
210
203
211
-
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. This section provides the steps to enable the app to connect to the Service Bus.
204
+
## Bind the Service Bus to Azure Spring Apps and deploy the app
212
205
213
-
#### Step 5.1 - Get a connection string
206
+
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.
214
207
215
-
To enable the app to connect to the Service Bus, get the Service Bus's connection string by using the following command:
208
+
1. Get the Service Bus's connection string by using the following command:
216
209
217
-
```azurecli
218
-
SERVICE_BUS_CONNECTION_STRING=$(az servicebus namespace authorization-rule keys list \
219
-
--namespace-name ${SERVICE_BUS_NAME_SPACE} \
220
-
--name RootManageSharedAccessKey \
221
-
--query primaryConnectionString \
222
-
--output tsv)
223
-
```
224
-
225
-
#### Step 5.2 - Set environment variable in app
226
-
227
-
Provide the connection string to the app by using the following command to add an environment variable.
210
+
```azurecli
211
+
SERVICE_BUS_CONNECTION_STRING=$(az servicebus namespace authorization-rule keys list \
Use the following steps to confirm that the event-driven app works correctly. You can validate the app by sending a message to the `lower-case` queue, then confirming that there's a message in the `upper-case` queue.
250
239
251
240
1. Send a message to `lower-case` queue with Service Bus Explorer. For more information, see the [Send a message to a queue or topic](../service-bus-messaging/explorer.md#send-a-message-to-a-queue-or-topic) section of [Use Service Bus Explorer to run data operations on Service Bus](../service-bus-messaging/explorer.md).
241
+
252
242
1. Confirm that there's a new message sent to the `upper-case` queue. For more information, see the [Peek a message](../service-bus-messaging/explorer.md#peek-a-message) section of [Use Service Bus Explorer to run data operations on Service Bus](../service-bus-messaging/explorer.md).
253
243
244
+
## Clean up resources
245
+
246
+
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. Alternately, to delete the resource group by using Azure CLI, use the following commands:
247
+
248
+
```azurecli
249
+
echo "Enter the Resource Group name:" &&
250
+
read resourceGroupName &&
251
+
az group delete --name $resourceGroupName &&
252
+
echo "Press [ENTER] to continue ..."
253
+
```
254
+
254
255
## Next steps
255
256
256
257
-[Azure Spring Apps Samples](https://github.com/Azure-Samples/Azure-Spring-Cloud-Samples).
0 commit comments