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/app-service/tutorial-sre-agent.md
+99-7Lines changed: 99 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,14 +10,16 @@ ms.date: 04/22/2025
10
10
11
11
# Tutorial: Troubleshoot an App Service app using SRE Agent
12
12
13
-
The Azure SRE (Site Reliability Engineering) Agent helps you manage and monitor Azure resources by using AI-enabled capabilities. Agents guide you in solving problems and aids in build resilient, self-healing systems on your behalf.
13
+
The Azure SRE (Site Reliability Engineering) Agent helps you manage and monitor Azure resources by using AI-enabled capabilities. Agents guide you in solving problems and aids in build resilient, self-healing systems on your behalf. The sample app includes code meant to exhaust memory and cause HTTP 500 errors, so you can diagnose and fix the problem using SRE Agent.
14
14
15
15
In this tutorial, you:
16
16
17
17
> [!div class="checklist"]
18
-
> * Deploy a sample container app using the Azure portal
18
+
> * Create an App Service app using the Azure portal
19
+
> * Deploy a sample App Service app using the Azure portal
20
+
> * Enable App Service logs
19
21
> * Create an Azure SRE Agent to monitor the app
20
-
> *Intentionally misconfigure the container app
22
+
> *Cause the app to produce a HTTP 500 error
21
23
> * Use AI-driven prompts to troubleshoot and fix errors
1. To convert images, click `Tools` and select `Convert to PNG`.
117
+
118
+

119
+
120
+
1. Select the first two images and click `convert`. This converts successfully.
121
+
122
+

100
123
101
124
## 2. Create an agent
102
125
@@ -114,12 +137,12 @@ Next, create an agent to monitor the *my-aca-app-group* resource group.
114
137
|---|---|---|
115
138
| Subscription | Select your Azure subscription. ||
116
139
| Resource group | Enter **my-sre-agent-group**. ||
117
-
| Name | Enter **my-app-svc-sre-agent**. ||
140
+
| Name | Enter **my-app-service-sre-agent**. ||
118
141
| Region | Select **Sweden Central**. | During preview, SRE Agents are only available in the *Sweden Central* region, but they can monitor resources in any Azure region. |
119
142
120
143
1. Select the **Select resource groups** button.
121
144
122
-
1. In the *Select resource groups to monitor* window, search for and select the **my-aca-app-group** resource group.
145
+
1. In the *Select resource groups to monitor* window, search for and select the **my-app-service-group** resource group.
123
146
124
147
1. Scroll to the bottom of the dialog window and select **Save**.
125
148
@@ -131,7 +154,7 @@ Your agent has access to any resource inside the resource groups associated with
131
154
132
155
1. Go to the Azure portal, search for and select **Azure SRE Agent**.
133
156
134
-
1. Select **my-app-svc-agent** from the list.
157
+
1. Select **my-app-service-agent** from the list.
135
158
136
159
1. Select **Chat with agent**.
137
160
@@ -147,6 +170,75 @@ Now that you have an agent that sees your container app, you can create an oppor
147
170
148
171
## 4. Break the app
149
172
173
+
1. Now that the agent has been created, browse to the app's URL.
174
+
175
+
1. Try to convert the first five images.
176
+
177
+

178
+
179
+
This action fails and produces a `HTTP 500` error that wasn't tested during development.
180
+
181
+

182
+
183
+
## 5. Fix the app
184
+
185
+
1. Go to the Azure portal, search for and select **Azure SRE Agent**.
186
+
187
+
1. Select **my-app-service-agent** from the list.
188
+
189
+
1. Select **Chat with agent**.
190
+
191
+
1. In the chat box, give your agent the following command and wait for a response.
192
+
193
+
```text
194
+
What's wrong with my-app-service-app?
195
+
```
196
+
197
+
From here, the agent should recognize that the tag name is invalid.
198
+
199
+
While every chat session is different, you should see a response that resembles the following response.
200
+
201
+
> The container app my-container-app appears to be in a healthy state ("Succeeded"), but I did notice a potential issue:
202
+
>
203
+
> - The container image specified is mcr.microsoft.com/k8se/quickstart:latest1. The ":latest1" tag is unusual and might be a typo (the standard tag is usually ":latest"). If this is not intentional, it could cause image pull failures or unexpected container behavior.
204
+
>
205
+
> Other than that, there are no critical errors or warning states reported for my-container-app.
206
+
>
207
+
> Would you like me to investigate further for hidden issues such as image pull errors, app crashes, or logs? If yes, please specify what symptoms you're experiencing (e.g., app not responding, errors in logs, etc.).
208
+
209
+
1. In the chat box, give your agent the following command and wait for a response.
210
+
211
+
```text
212
+
Rollback to the last working version.
213
+
```
214
+
215
+
As your agent processes this command, it runs diagnostics and reports back status information. After the agent inspects the previous revisions, the agent's response will include with something that resembles the following message:
216
+
217
+
> You have requested to roll back your container app to the last known working image. This action will cause a brief restart of your app. Proceeding with the rollback now.
218
+
219
+
1. As the agent concludes the rollback analysis, it asks you for approval to execute the rollback operation.
220
+
221
+
To approve the action, reply with the following prompt:
222
+
223
+
```text
224
+
approved
225
+
```
226
+
227
+
After the rollback is successful, you should see a response similar to:
228
+
229
+
> Rollback complete! Your container app has been reverted to the last known working image: mcr.microsoft.com/k8se/quickstart:latest. Please monitor your app to ensure it starts successfully.
230
+
231
+
## 6. Verify repair
232
+
233
+
Now you can prompt your agent to return your app's fully qualified domain name (FQDN) so you can verify a successful deployment.
234
+
235
+
1. In the chat box, enter the following prompt.
236
+
237
+
```text
238
+
What is the FQDN for my-container-app?
239
+
```
240
+
241
+
1. To verify your container app is working properly, open the FQDN in a web browser.
0 commit comments