@@ -31,7 +31,7 @@ In this tutorial, you will:
31
31
32
32
To complete this tutorial, you need an [ Azure subscription] ( https://azure.microsoft.com/free/ ) .
33
33
34
- ## Create an App Service app
34
+ ## 1. Create an App Service app
35
35
36
36
Start by creating a web app that the SRE Agent will monitor.
37
37
@@ -46,19 +46,19 @@ In the *Basics* tab, provide the following details:
46
46
47
47
** Project details**
48
48
49
- | Setting | Value |
49
+ | Setting | Value |
50
50
| -----------------| --------------------------------|
51
- | Subscription | Your Azure subscription |
52
- | Resource group | ** Create new** → ` my-app-service-group ` |
51
+ | Subscription | Your Azure subscription |
52
+ | Resource group | ** Create new** → ` my-app-service-group ` |
53
53
54
54
** Instance details**
55
55
56
- | Setting | Value |
56
+ | Setting | Value |
57
57
| -----------------| --------------------------------|
58
- | Name | ` my-sre-app ` |
59
- | Publish | ** Code** |
60
- | Runtime stack | ** PHP 8.4** |
61
- | Region | A region near you |
58
+ | Name | ` my-sre-app ` |
59
+ | Publish | ** Code** |
60
+ | Runtime stack | ** PHP 8.4** |
61
+ | Region | A region near you |
62
62
63
63
64
64
1 . Select the ** Deployment** tab.
@@ -70,15 +70,14 @@ In the *Basics* tab, provide the following details:
70
70
71
71
1 . Select ** Review and create** .
72
72
73
- - If validation passes, the ** Create** button becomes active.
74
- - If there are errors, tabs with issues are marked with a red dot. Fix the highlighted fields and try again.
73
+ - If validation passes, the ** Create** button becomes active.
74
+ - If there are errors, tabs with issues are marked with a red dot. Fix the highlighted fields and try again.
75
75
76
76
1 . Select ** Create** to deploy the app.
77
77
78
78
Once deployment completes, you’ll see the message: * Your deployment is complete* .
79
79
80
- ### Deploy the sample app
81
-
80
+ ## 2. Deploy the sample app
82
81
83
82
Now that your App Service app is created, deploy the sample application from GitHub.
84
83
@@ -88,16 +87,15 @@ Now that your App Service app is created, deploy the sample application from Git
88
87
89
88
1 . In the * Settings* tab, configure the following:
90
89
91
- | Property | Value |
92
- |------------|--------------------------------------------------------------------|
93
- | Source | ** External Git** |
94
- | Repository | ` https://github.com/Azure-Samples/App-Service-Agent-Tutorial ` |
95
- | Branch | ` working ` |
96
-
90
+ | Property | Value |
91
+ | ------------| ------------------------------------------------------------|
92
+ | Source | ** External Git** |
93
+ | Repository | ` https://github.com/Azure-Samples/App-Service-Agent-Tutorial ` |
94
+ | Branch | ` working ` |
97
95
98
96
1 . Select ** Save** to apply the deployment settings.
99
97
100
- ## Configure the app
98
+ ## 3. Configure the app
101
99
102
100
Next, configure your app with a startup command and enable logging to support diagnostics with the SRE Agent.
103
101
@@ -112,9 +110,9 @@ The sample app uses NGINX. The default NGINX configuration expects a `50x.html`
112
110
113
111
1 . Enter the following command:
114
112
115
- ```bash
116
- /home/site/wwwroot/startup.sh
117
- ```
113
+ ``` bash
114
+ /home/site/wwwroot/startup.sh
115
+ ```
118
116
119
117
1. Select ** Save** to apply the changes.
120
118
@@ -126,14 +124,14 @@ Enable logging so the SRE Agent can collect diagnostic data from your app.
126
124
127
125
1. Configure the following settings:
128
126
129
- | Property | Value | Remarks |
130
- |------------------------|- -----------------|----------------------------------------|
131
- | Application logging | ** File System** | Enables log collection for diagnostics |
132
- | Retention Period (Days)| ` 3 ` | Retains logs for 3 days |
127
+ | Property | Value | Remarks |
128
+ | ------------------------| -----------------| ----------------------------------------|
129
+ | Application logging | ** File System** | Enables log collection for diagnostics |
130
+ | Retention Period (Days)| ` 3` | Retains logs for 3 days |
133
131
134
132
1. Select ** Save** to apply the logging configuration.
135
133
136
- ## Verify the sample app
134
+ # # 4. Verify the sample app
137
135
138
136
After deployment and configuration, verify that the sample app is running correctly.
139
137
@@ -145,8 +143,8 @@ After deployment and configuration, verify that the sample app is running correc
145
143
146
144
1. Once the app loads, test its functionality:
147
145
148
- - Click ** Tools** in the app’s navigation bar.
149
- - Select ** Convert to PNG** .
146
+ - Click ** Tools** in the app’s navigation bar.
147
+ - Select ** Convert to PNG** .
150
148
151
149
! [Click ` Tools` and select `Convert to PNG` ](./media/tutorial-azure-monitor/sample-monitor-app-tools-menu.png)
152
150
@@ -156,7 +154,7 @@ After deployment and configuration, verify that the sample app is running correc
156
154
157
155
! [Select the first two images](./media/tutorial-azure-monitor/sample-monitor-app-convert-two-images.png)
158
156
159
- ## Create a deployment slot
157
+ # # 5. Create a deployment slot
160
158
161
159
To simulate a failure scenario, create a secondary deployment slot.
162
160
@@ -167,10 +165,10 @@ To simulate a failure scenario, create a secondary deployment slot.
167
165
1. Enter the following values.
168
166
169
167
170
- | Property | Value | Remarks |
171
- |--------------------|---------------|----------------------------------|
172
- | Name | ` broken ` | Name of the slot to simulate failure |
173
- | Clone settings from| ` my-sre-app ` | Copies configuration from the main app |
168
+ | Property | Value | Remarks |
169
+ | --------------------| ---------------| ----------------------------------|
170
+ | Name | ` broken` | Name of the slot to simulate failure |
171
+ | Clone settings from| ` my-sre-app` | Copies configuration from the main app |
174
172
175
173
176
174
1. Scroll to the bottom of the dialog window and select **Add**.
@@ -185,15 +183,15 @@ To simulate a failure scenario, create a secondary deployment slot.
185
183
186
184
In the * Settings* tab, configure the following:
187
185
188
- | Property | Value |
189
- |------------|-------- ------------------------------------------------------------|
190
- | Source | ** External Git** |
191
- | Repository | ` https://github.com/Azure-Samples/App-Service-Agent-Tutorial ` |
192
- | Branch | ` broken ` |
186
+ | Property | Value |
187
+ | ------------| ------------------------------------------------------------|
188
+ | Source | ** External Git** |
189
+ | Repository | ` https://github.com/Azure-Samples/App-Service-Agent-Tutorial` |
190
+ | Branch | ` broken` |
193
191
194
192
1. Select ** Save** to apply the deployment settings.
195
193
196
- ## Create an SRE Agent
194
+ # # 6. Create an SRE Agent
197
195
198
196
Now, create an Azure SRE Agent to monitor your App Service app.
199
197
@@ -203,15 +201,15 @@ Now, create an Azure SRE Agent to monitor your App Service app.
203
201
204
202
1. In the * Create agent* window, enter the following values:
205
203
206
- > During this step, you’ll create a new resource group for the agent. This group is separate from the one used for your app.
204
+ > During this step, you’ll create a new resource group for the agent. This group is separate from the one used for your app.
207
205
208
- | Property | Value | Remarks |
209
- |------------------|---------------------------|-------------------------------------------------------------------------|
210
- | Subscription | Your Azure subscription | |
211
- | Resource group | ` my-sre-agent-group ` | New group for the SRE Agent |
212
- | Name | ` my-app-service-sre-agent ` | |
213
- | Region | ** Sweden Central** | Required during preview; can monitor resources in any Azure region |
214
- | Choose role | ** Contributor** | Grants the agent permission to take action on your behalf |
206
+ | Property | Value | Remarks |
207
+ | ------------------| ---------------------------| -------------------------------------------------------------------------|
208
+ | Subscription | Your Azure subscription | |
209
+ | Resource group | ` my-sre-agent-group` | New group for the SRE Agent |
210
+ | Name | ` my-app-service-sre-agent` | |
211
+ | Region | ** Sweden Central** | Required during preview; can monitor resources in any Azure region |
212
+ | Choose role | ** Contributor** | Grants the agent permission to take action on your behalf |
215
213
216
214
1. Select ** Select resource groups** .
217
215
@@ -221,10 +219,9 @@ Now, create an Azure SRE Agent to monitor your App Service app.
221
219
222
220
1. Back in the * Create agent* window, select **Create**.
223
221
224
- > The agent creation process may take a few minutes to complete.
225
-
222
+ > The agent creation process may take a few minutes to complete.
226
223
227
- ## Chat with your agent
224
+ # # 7. Chat with your agent
228
225
229
226
Once your SRE Agent is deployed and connected to your resource group, you can interact with it using natural language to monitor and troubleshoot your app.
230
227
@@ -244,9 +241,7 @@ Once your SRE Agent is deployed and connected to your resource group, you can in
244
241
245
242
Now that the agent can see your app, you’re ready to simulate a failure and let the agent help you resolve it.
246
243
247
-
248
-
249
- ## Break the app
244
+ # # 8. Break the app
250
245
251
246
Now simulate a failure scenario by swapping to the broken deployment slot.
252
247
@@ -255,11 +250,11 @@ Now simulate a failure scenario by swapping to the broken deployment slot.
255
250
1. Select ** Swap** .
256
251
257
252
1. In the * Swap* dialog, configure the following:
258
-
259
- | Property | Value | Remarks |
260
- |----------|-------------------|----------------------------------|
261
- | Source | ` my-sre-app-broken ` | The slot with the faulty version |
262
- | Target | ` my-sre-app ` | The production slot |
253
+
254
+ | Property | Value | Remarks |
255
+ | ----------| -- -------------------| ----------------------------------|
256
+ | Source | ` my-sre-app-broken` | The slot with the faulty version |
257
+ | Target | ` my-sre-app` | The production slot |
263
258
264
259
1. Scroll to the bottom and select **Start Swap** .
265
260
@@ -269,18 +264,17 @@ Now simulate a failure scenario by swapping to the broken deployment slot.
269
264
270
265
1. Attempt to convert five images using the app interface:
271
266
272
- ./media/tutorial-azure-monitor/sample-monitor-app-convert-five-images .png
267
+ ! [Select the first five images]( ./media/tutorial-azure-monitor/sample-monitor-app-working .png)
273
268
274
269
1. The conversion should fail and return an HTTP 500 error:
275
270
276
- ./media/tutorial-azure-monitor/sample-monitor-app-http-500.png
271
+ ! [HTTP 500]( ./media/tutorial-azure-monitor/sample-monitor-app-http-500.png)
277
272
278
273
1. Repeat the conversion step a few more times to generate additional HTTP 500 logs.
279
274
280
275
> These logs will help the SRE Agent detect and diagnose the issue.
281
276
282
-
283
- ## Fix the app
277
+ # # 9. Fix the app
284
278
285
279
Now that the app is experiencing failures, use the SRE Agent to diagnose and resolve the issue.
286
280
@@ -304,7 +298,7 @@ Now that the app is experiencing failures, use the SRE Agent to diagnose and res
304
298
305
299
1. After a short delay, the agent will prompt you to approve the rollback:
306
300
307
- > * Performing Slot Swap rollback to Restore Application Availability for my-sre-app*
301
+ > *Performing Slot Swap rollback to Restore Application Availability for my-sre-app*
308
302
> **[Approve]** **[Deny]**
309
303
310
304
1. Select **Approve** to initiate the rollback.
@@ -318,8 +312,7 @@ Now that the app is experiencing failures, use the SRE Agent to diagnose and res
318
312
>
319
313
> *Please provide the GitHub repository URL where you want the issue to be raised.*
320
314
321
-
322
- ## Verify the fix
315
+ ## 10. Verify the fix
323
316
324
317
After the SRE Agent rolls back the slot swap, confirm that your app is functioning correctly.
325
318
0 commit comments