Skip to content

Commit 8ceb6ec

Browse files
committed
edits
1 parent 437bf5c commit 8ceb6ec

File tree

1 file changed

+72
-71
lines changed

1 file changed

+72
-71
lines changed

articles/spring-apps/quickstart-deploy-event-driven-app-standard-consumption.md

Lines changed: 72 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -51,24 +51,18 @@ Use the following steps to prepare the sample locally.
5151

5252
## Prepare the cloud environment
5353

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.
5555

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.
5757

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.
59-
60-
```azurecli
61-
RESOURCE_GROUP=<event-driven-app-resource-group-name>
62-
LOCATION=<desired-region>
63-
SERVICE_BUS_NAME_SPACE=<event-driven-app-service-bus-namespace>
64-
AZURE_CONTAINER_APPS_ENVIRONMENT=<Azure-Container-Apps-environment-name>
65-
AZURE_SPRING_APPS_INSTANCE=<Azure-Spring-Apps-instance-name>
66-
APP_NAME=<event-driven-app-name>
67-
```
68-
69-
### Step 2 - Create a new resource group
70-
71-
To manage the resources easily, create a resource group to hold these resources. Use the following steps to create a new resource group.
58+
```azurecli
59+
RESOURCE_GROUP=<event-driven-app-resource-group-name>
60+
LOCATION=<desired-region>
61+
SERVICE_BUS_NAME_SPACE=<event-driven-app-service-bus-namespace>
62+
AZURE_CONTAINER_APPS_ENVIRONMENT=<Azure-Container-Apps-environment-name>
63+
AZURE_SPRING_APPS_INSTANCE=<Azure-Spring-Apps-instance-name>
64+
APP_NAME=<event-driven-app-name>
65+
```
7266

7367
1. Sign in to Azure by using the following command:
7468

@@ -82,13 +76,13 @@ To manage the resources easily, create a resource group to hold these resources.
8276
az configure --defaults location=${LOCATION}
8377
```
8478

85-
1. Set your default subscription. Firstly, list all available subscriptions:
79+
1. Set your default subscription. First, list all available subscriptions:
8680

8781
```azurecli
8882
az account list --output table
8983
```
9084

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.
9286

9387
```azurecli
9488
az account set --subscription <subscription-ID>
@@ -106,7 +100,9 @@ To manage the resources easily, create a resource group to hold these resources.
106100
az configure --defaults group=${RESOURCE_GROUP}
107101
```
108102

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.
110106

111107
1. Use the following command to create a Service Bus namespace.
112108

@@ -125,14 +121,12 @@ To manage the resources easily, create a resource group to hold these resources.
125121
--name upper-case
126122
```
127123

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
133125

134126
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.
135127

128+
Use the following steps to create the environment:
129+
136130
1. Install the Azure Container Apps extension for the CLI by using the following command:
137131

138132
```azurecli
@@ -157,12 +151,14 @@ The Azure Container Apps environment creates a secure boundary around a group of
157151
az containerapp env create --name ${AZURE_CONTAINER_APPS_ENVIRONMENT}
158152
```
159153

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.
161157

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:
163159

164160
```azurecli
165-
az extension remove -n spring && \
161+
az extension remove --name spring && \
166162
az extension add \
167163
--source https://ascprivatecli.blob.core.windows.net/cli-extension/spring-1.8.0-py3-none-any.whl \
168164
--yes
@@ -179,7 +175,8 @@ The Azure Container Apps environment creates a secure boundary around a group of
179175
```azurecli
180176
MANAGED_ENV_RESOURCE_ID=$(az containerapp env show \
181177
--name ${AZURE_CONTAINER_APPS_ENVIRONMENT} \
182-
--query id -o tsv)
178+
--query id \
179+
--output tsv)
183180
```
184181

185182
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
191188
--sku standardGen2
192189
```
193190

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:
208192

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+
```
210203

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
212205

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.
214207

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:
216209

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 \
212+
--namespace-name ${SERVICE_BUS_NAME_SPACE} \
213+
--name RootManageSharedAccessKey \
214+
--query primaryConnectionString \
215+
--output tsv)
216+
```
228217

229-
```azurecli
230-
az spring app update \
231-
--service ${AZURE_SPRING_APPS_INSTANCE} \
232-
--name ${APP_NAME} \
233-
--env SERVICE_BUS_CONNECTION_STRING=${SERVICE_BUS_CONNECTION_STRING}
234-
```
218+
1. Use the following command to provide the connection string to the app through an environment variable.
235219

236-
## Deploy the app to Azure Spring Apps
220+
```azurecli
221+
az spring app update \
222+
--service ${AZURE_SPRING_APPS_INSTANCE} \
223+
--name ${APP_NAME} \
224+
--env SERVICE_BUS_CONNECTION_STRING=${SERVICE_BUS_CONNECTION_STRING}
225+
```
237226

238-
Now the cloud environment is ready. Deploy the app by using the following command.
227+
1. Now the cloud environment is ready. Deploy the app by using the following command.
239228

240-
```azurecli
241-
az spring app deploy \
242-
--service ${AZURE_SPRING_APPS_INSTANCE} \
243-
--name ${APP_NAME} \
244-
--artifact-path target/simple-event-driven-app-0.0.1-SNAPSHOT.jar
245-
```
229+
```azurecli
230+
az spring app deploy \
231+
--service ${AZURE_SPRING_APPS_INSTANCE} \
232+
--name ${APP_NAME} \
233+
--artifact-path target/simple-event-driven-app-0.0.1-SNAPSHOT.jar
234+
```
246235

247236
## Validate the event-driven app
248237

249238
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.
250239

251240
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+
252242
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).
253243

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+
254255
## Next steps
255256

256257
- [Azure Spring Apps Samples](https://github.com/Azure-Samples/Azure-Spring-Cloud-Samples).

0 commit comments

Comments
 (0)