Skip to content

Commit d1bfa5b

Browse files
committed
updates
1 parent 4a5cca6 commit d1bfa5b

File tree

1 file changed

+97
-60
lines changed

1 file changed

+97
-60
lines changed

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

Lines changed: 97 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: 'Tutorial: Troubleshoot with SRE Agent on Azure App Service'
2+
title: 'Tutorial: Troubleshoot an app using Azure SRE Agent (preview) in Azure App Service'
33
description: Learn how to use SRE Agent and Azure App Service to identify and fix app issues with AI-assisted troubleshooting.
44
author: msangapu-msft
55
ms.author: msangapu
@@ -10,106 +10,143 @@ ms.date: 04/22/2025
1010

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

13-
This tutorial shows how to deploy a broken web app to Azure App Service, create an Agent Space, and use its AI-assisted capabilities to troubleshoot and fix application issues. You'll use the Azure Developer CLI (azd) to provision and deploy resources, simulate a bug, and use Agent Space to diagnose and resolve the error.
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.
14+
15+
In this tutorial, you:
1416

1517
> [!div class="checklist"]
16-
> * Deploy a sample broken app using azd
17-
> * Set up Agent Space and link the resource group
18+
> * Deploy a sample container app using the Azure portal
19+
> * Create an Azure SRE Agent to monitor the app
20+
> * Intentionally misconfigure the container app
1821
> * Use AI-driven prompts to troubleshoot and fix errors
1922
2023
[!INCLUDE [quickstarts-free-trial-note](~/reusable-content/ce-skilling/azure/includes/quickstarts-free-trial-note.md)]
2124

2225
## Prerequisites
2326

24-
To complete this tutorial, you need:
27+
To complete this tutorial, you need an [Azure subscription](https://azure.microsoft.com/free/).
28+
29+
## 1. Create an App Service app
30+
31+
Begin by creating an app for your agent to monitor.
32+
33+
1. Go to the [Azure portal](https://portal.azure.com) and search for **App Services** in the top search bar.
34+
35+
1. Select **App Services** in the search results.
36+
37+
1. Select the **Create** button and select **Web App**.
38+
39+
### Basics tab
40+
41+
In the *Basics* tab, do the following actions.
42+
43+
1. Enter the following values in the *Project details* section.
44+
45+
| Setting | Action |
46+
|---|---|
47+
| Subscription | Select your Azure subscription. |
48+
| Resource group | Select **Create new** and enter **my-app-service-group**. |
49+
50+
1. Enter the following values in the *Instance details* section.
51+
52+
| Name app name | Enter **my-sre-app**. |
53+
| Publish | Select **Code**. |
54+
| Runtime stack| Select **PHP 8.4**. |
55+
| Region | Select a region near you. |
56+
57+
1. Select the **Deployment** tab.
58+
59+
1. Enable **Basic authentication** in the *Authentication settings* section.
60+
61+
1. Select **Review and create** at the bottom of the page.
62+
63+
If no errors are found, the *Create* button is enabled.
64+
65+
If there are errors, any tab containing errors is marked with a red dot. Navigate to the appropriate tab. Fields containing an error are highlighted in red. Once all errors are fixed, select **Review and create** again.
66+
67+
1. Select **Create**.
68+
69+
A page with the message *Deployment is in progress* is displayed. Once the deployment is successfully completed, you see the message: *Your deployment is complete*.
70+
71+
### Deploy the sample app
72+
73+
1. To view your new App Service, select **Go to resource**.
2574

26-
- [Azure subscription](https://azure.microsoft.com/free/)
27-
- [Azure CLI installed](https://learn.microsoft.com/en-us/cli/azure/install-azure-cli)
28-
- [Azure Developer CLI (azd) installed](https://learn.microsoft.com/en-us/azure/developer/azure-developer-cli/install-azd)
29-
- Git installed
75+
1. Go to the [Azure portal](https://portal.azure.com) and search for **App Services** in the top search bar.
3076

31-
[!INCLUDE [azure-cli-prepare-your-environment-no-header.md](~/reusable-content/azure-cli/azure-cli-prepare-your-environment-no-header.md)]
77+
1. Select **App Services** in the search results.
3278

33-
## Create Azure resources
79+
1. Select **my-sre-app** from the list of App Services.
3480

35-
### Clone and deploy the app
81+
1. In the left menu, select **Deployment center** from the *Deployment* section.
3682

37-
Clone a broken app sample:
83+
1. Enter the following values in the *Settings* tab.
3884

39-
```bash
40-
git clone https://github.com/Azure-Samples/broken-python-webapp.git
41-
cd broken-python-webapp
42-
```
85+
| Property | Value | Remarks |
86+
|---|---|---|
87+
| Source | Select **External Git**. | |
88+
| Repository | Enter **https://github.com/Azure-Samples/App-Service-Troubleshoot-Azure-Monitor**. | |
89+
| Branch | Enter **master**. | |
4390

44-
Initialize the environment and project:
91+
1. Select **Save**.
4592

46-
```bash
47-
azd init --template . --environment brokenapp-env
48-
```
93+
### Verify the sample app
4994

50-
Provision and deploy the app:
95+
1. Select **Overview** in the left menu.
5196

52-
```bash
53-
azd up
54-
```
97+
1. Select **Browse** to verify the sample app.
5598

56-
### Create Agent Space
99+
1. The following message appears in your browser.
57100

58-
1. Go to the [Azure Portal](https://portal.azure.com)
59-
2. Search for **Agent Space** and select **+ Create**
60-
3. Choose a name, region, and link the same resource group created by `azd`
61-
4. Complete the creation
101+
## 2. Create an agent
62102

63-
## Troubleshoot the broken app
103+
Next, create an agent to monitor the *my-aca-app-group* resource group.
64104

65-
### Verify the app is running
105+
1. Go to the Azure portal and search for and select **Azure SRE Agent**.
66106

67-
Browse to your app’s URL from the `azd` output. You should see the app loading or returning an error.
107+
1. Select **Create**.
68108

69-
### Simulate a broken state
109+
1. Enter the following values in the *Create agent* window.
70110

71-
In the Azure Portal:
111+
During this step, you create a new resource group specifically for your agent which is independent of the group you create for your application.
72112

73-
1. Go to your App Service
74-
2. Select **Configuration > Application settings**
75-
3. Remove a key like `APP_MODE` or alter it to trigger a runtime error
76-
4. Save and restart the app
113+
| Property | Value | Remarks |
114+
|---|---|---|
115+
| Subscription | Select your Azure subscription. | |
116+
| Resource group | Enter **my-sre-agent-group**. | |
117+
| Name | Enter **my-app-svc-sre-agent**. | |
118+
| 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. |
77119

78-
### Use Agent Space to identify and fix the issue
120+
1. Select the **Select resource groups** button.
79121

80-
Open your Agent Space and begin chatting:
122+
1. In the *Select resource groups to monitor* window, search for and select the **my-aca-app-group** resource group.
81123

82-
#### Prompt to identify the issue:
124+
1. Scroll to the bottom of the dialog window and select **Save**.
83125

84-
> "My App Service app in resource group `brokenapp-env-rg` is returning a 500 error. Can you help me figure out why?"
126+
1. Select **Create**.
85127

86-
#### Prompt to confirm recent change:
128+
## 3. Chat with your agent
87129

88-
> "I recently removed the `APP_MODE` setting. Could this be causing the issue?"
130+
Your agent has access to any resource inside the resource groups associated with the agent. Use the chat feature to help you inquire about and resolve issues related to your resources.
89131

90-
Agent Space will analyze logs, configurations, and suggest a fix.
132+
1. Go to the Azure portal, search for and select **Azure SRE Agent**.
91133

92-
### Apply the fix
134+
1. Select **my-app-svc-agent** from the list.
93135

94-
Restore the environment variable in App Service or make the recommended code change, then redeploy:
136+
1. Select **Chat with agent**.
95137

96-
```bash
97-
azd deploy
98-
```
138+
1. In the chat box, give your agent the following command.
99139

100-
## Verify the fix
140+
```text
141+
List my app service apps
142+
```
101143
102-
- Browse to your app again
103-
- Confirm the 500 error is resolved
104-
- Repeat the steps that caused the issue to verify it's fixed
144+
1. The agent responds with details about the container app deployed in the *my-aca-app-group* resource group.
105145
106-
## Clean up resources
146+
Now that you have an agent that sees your container app, you can create an opportunity for the agent to make a repair on your behalf.
107147
108-
To remove all created resources:
148+
## 4. Break the app
109149
110-
```bash
111-
azd down
112-
```
113150
114151
## Next steps
115152

0 commit comments

Comments
 (0)