Skip to content

Commit 1ae78f6

Browse files
committed
updates
1 parent d1bfa5b commit 1ae78f6

File tree

1 file changed

+99
-7
lines changed

1 file changed

+99
-7
lines changed

articles/app-service/tutorial-sre-agent.md

Lines changed: 99 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,16 @@ ms.date: 04/22/2025
1010

1111
# Tutorial: Troubleshoot an App Service app using SRE Agent
1212

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

1515
In this tutorial, you:
1616

1717
> [!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
1921
> * 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
2123
> * Use AI-driven prompts to troubleshoot and fix errors
2224
2325
[!INCLUDE [quickstarts-free-trial-note](~/reusable-content/ce-skilling/azure/includes/quickstarts-free-trial-note.md)]
@@ -90,13 +92,34 @@ In the *Basics* tab, do the following actions.
9092

9193
1. Select **Save**.
9294

95+
### Enable App Service logs
96+
97+
This step is required to create applicaton logs that the SRE Agent can use to troubleshoot the app.
98+
99+
1. In the left menu, browse to the *Monitoring* section and select **App Service logs**.
100+
101+
1. Enter the following values.
102+
103+
| Property | Value | Remarks |
104+
|---|---|---|
105+
| Application logging | Select **File System**. | |
106+
| Retention Period (Days) | Enter **3**. | |
107+
108+
1. Select **Save**.
109+
93110
### Verify the sample app
94111

95112
1. Select **Overview** in the left menu.
96113

97114
1. Select **Browse** to verify the sample app.
98115

99-
1. The following message appears in your browser.
116+
1. To convert images, click `Tools` and select `Convert to PNG`.
117+
118+
![Click `Tools` and select `Convert to PNG`](./media/tutorial-azure-monitor/sample-monitor-app-tools-menu.png)
119+
120+
1. Select the first two images and click `convert`. This converts successfully.
121+
122+
![Select the first two images](./media/tutorial-azure-monitor/sample-monitor-app-convert-two-images.png)
100123

101124
## 2. Create an agent
102125

@@ -114,12 +137,12 @@ Next, create an agent to monitor the *my-aca-app-group* resource group.
114137
|---|---|---|
115138
| Subscription | Select your Azure subscription. | |
116139
| Resource group | Enter **my-sre-agent-group**. | |
117-
| Name | Enter **my-app-svc-sre-agent**. | |
140+
| Name | Enter **my-app-service-sre-agent**. | |
118141
| 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. |
119142

120143
1. Select the **Select resource groups** button.
121144

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

124147
1. Scroll to the bottom of the dialog window and select **Save**.
125148

@@ -131,7 +154,7 @@ Your agent has access to any resource inside the resource groups associated with
131154

132155
1. Go to the Azure portal, search for and select **Azure SRE Agent**.
133156

134-
1. Select **my-app-svc-agent** from the list.
157+
1. Select **my-app-service-agent** from the list.
135158

136159
1. Select **Chat with agent**.
137160

@@ -147,6 +170,75 @@ Now that you have an agent that sees your container app, you can create an oppor
147170
148171
## 4. Break the app
149172
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+
![Convert first five images](./media/tutorial-azure-monitor/sample-monitor-app-convert-five-images.png)
178+
179+
This action fails and produces a `HTTP 500` error that wasn't tested during development.
180+
181+
![The convert will result in a HTTP 500 error](./media/tutorial-azure-monitor/sample-monitor-app-http-500.png)
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.
150242
151243
## Next steps
152244

0 commit comments

Comments
 (0)