Production-ready recipes to deploy SRE Agents as code. Pick a recipe, run two commands, deploy.
Azure Cloud Shell has everything pre-installed — no setup needed.
For local use, run the install script to check and install all required tools:
# macOS / Linux
./bin/install-prerequisites.sh
# Windows (PowerShell 7+)
.\bin\ps\Install-Prerequisites.ps1To include optional tools (Terraform, azd):
./bin/install-prerequisites.sh --all # everything
./bin/install-prerequisites.sh --terraform # just Terraform
./bin/install-prerequisites.sh --check # check only, no installManual install (if you prefer)
| Tool | Install |
|---|---|
Azure CLI (az) |
brew install azure-cli or install guide |
jq |
brew install jq / apt install jq / winget install jqlang.jq |
| Python 3 + PyYAML | brew install python3 && pip3 install pyyaml |
curl |
Pre-installed on macOS/Linux |
| Terraform (optional) | brew install hashicorp/tap/terraform or install guide |
| azd (optional) | brew install azd or install guide |
The exporter installs PyYAML automatically when needed. Use --no-install-dependencies to require preinstalled dependencies, or run ./bin/install-prerequisites.sh --python-only to prepare Python and PyYAML explicitly.
git clone https://github.com/microsoft/sre-agent.git
cd sre-agent/sreagent-templates
# Step 0: Install prerequisites (skips already-installed tools)
./bin/install-prerequisites.sh
# Create agent config from a recipe
./bin/new-agent.sh --recipe azmon-lawappinsights --non-interactive \
--set agentName=my-agent \
--set resourceGroup=rg-my-agent \
--set location=swedencentral \
--set targetRGs=rg-my-workload \
-o my-agent/
# Deploy (~3 min)
./bin/deploy.sh my-agent/new-agent uses --subscription when provided, otherwise it uses the active Azure CLI subscription. Region choices are queried for that subscription. See the supported-regions reference when preparing non-interactive input.
Cloud Shell: Core deployment works with Cloud Shell's built-in auth. Some data-plane items (hooks, repos) require
az login --scope "https://azuresre.dev/.default"first, or can be configured later in the portal.
Logic App callback URLs contain signed credentials. Templates return only the Logic App name, and deployment scripts print a retrieval command instead of the URL. Run that command privately when configuring your external webhook sender, not in a CI job or a recorded terminal session:
az rest --method POST \
--url "/subscriptions/<subscription-id>/resourceGroups/<resource-group>/providers/Microsoft.Logic/workflows/<agent-name>-webhook-bridge/triggers/incoming_webhook/listCallbackUrl?api-version=2019-05-01" \
--query value -o tsvRetrieval requires
Microsoft.Logic/workflows/triggers/listCallbackUrl/action on the Logic App;
deployment read access is not sufficient. Pass the result directly to the
external webhook configuration or an approved secret store. Do not log it or
return it as a pipeline output.
Output compatibility: webhookBridgeName replaces webhookBridgeUrl in
main.bicep. The standalone
logic-app-bridge.bicep keeps logicAppName but no
longer returns logicAppCallbackUrl. Update pipelines that consumed either
removed output to retrieve the credential explicitly with the permission above.
Existing deployments: Updating templates does not invalidate previously exposed URLs or remove old deployment outputs. Rotate the affected Logic App access keys, update all webhook senders to use the new URLs, and remove affected deployment history entries (including nested deployments) and retained log or pipeline artifacts according to your retention requirements. Review both primary and secondary keys if either could have been exposed. Do not treat history deletion alone as credential revocation.
Offline regressions for both script variants (no Azure resources are changed):
bash tests/test-webhook-credentials.sh
pwsh -NoProfile -File tests/Test-WebhookCredentials.ps1| Recipe | Platform | One-line |
|---|---|---|
| azmon-lawappinsights | Azure Monitor | Alert response with AppInsights + Log Analytics, skills, subagents, scheduled tasks |
| pagerduty-law-vmcosmos | PagerDuty | VM + CosmosDB + HTTP error investigation with knowledge files and skills |
| dynatrace-mcp | Dynatrace | Dynatrace MCP connector for investigating application errors |
| minimal | (none) | Minimal agent — just infra + RBAC, add your own connectors and skills |
Each recipe README has the full parameter list, example values, and post-deploy steps.
Want a recipe for a different platform? Open a recipe request.
| Command | Purpose |
|---|---|
new-agent.sh --recipe <name> --set key=val -o dir/ |
Create agent config from recipe |
deploy.sh dir/ |
Deploy (Bicep + data-plane, ~3 min) |
deploy.sh dir/ --dry-run |
Assemble only, no ARM call |
deploy.sh dir/ --what-if |
ARM validation without deploying |
deploy.sh dir/ --force |
Redeploy even if no changes detected |
deploy-tf.sh dir/ |
Deploy via Terraform |
clone-agent.sh --from-agent <name> ... |
Clone: export → validate → deploy |
export-agent.sh --set agentName=clone -o dir/ |
Export a live agent to config dir |
diff-agent.sh $SUB $RG $AGENT dir/ |
Compare config vs live agent |
verify-agent.sh $SUB $RG $AGENT --expected dir/ |
22-point verification |
Every recipe deploys these resources (regardless of backend):
| Resource | Description |
|---|---|
| Resource Group | Container for all agent resources |
| User-Assigned Managed Identity (UAMI) | Agent's identity for RBAC |
| Log Analytics Workspace | Agent telemetry (created unless you supply one) |
| Application Insights | Agent monitoring (created unless you supply one) |
| SRE Agent | The agent itself |
| Connectors | Data sources (App Insights, LAW, PagerDuty, Dynatrace, etc.) |
| Skills, Subagents, Tools, Common Prompts | Agent capabilities from the recipe |
| RBAC role assignments | Reader, Log Analytics Reader, Monitoring Reader on target RGs |
The same config directory works with any backend:
| Backend | Command | Best for |
|---|---|---|
| Bicep (default) | deploy.sh dir/ |
Azure-native, Cloud Shell, CI/CD |
| Terraform | deploy-tf.sh dir/ |
Multi-cloud teams, TF state management |
| azd | azd up |
Azure Developer CLI, azd template ecosystem |
| PowerShell | Deploy-Agent.ps1 -InputPath dir/ |
Windows, Cloud Shell (PS) |
All backends run the same steps: assemble config → deploy infra → apply extras (data-plane).
# Export source agent config
./bin/export-agent.sh -s $SUB -g rg-source -n my-agent \
-o my-clone/ \
--set agentName=my-clone \
--set resourceGroup=rg-clone \
--set location=swedencentral
# Deploy with any backend
./bin/deploy.sh my-clone/ # Bicep
./bin/deploy-tf.sh my-clone/ # TerraformUses the azapi provider for Microsoft.App/agents. Same config directory, same results as Bicep.
# Create + deploy (identical to Bicep flow)
./bin/new-agent.sh --recipe azmon-lawappinsights --non-interactive \
--set agentName=my-agent \
--set resourceGroup=rg-my-agent \
--set location=swedencentral \
--set targetRGs=rg-my-workload \
-o my-agent/
./bin/deploy-tf.sh my-agent/
# Update (re-run — TF diffs and applies only changes)
./bin/deploy-tf.sh my-agent/
# Clone
./bin/export-agent.sh -s $SUB -g rg-my-agent -n my-agent \
-o my-clone/ --set agentName=my-clone --set resourceGroup=rg-clone
./bin/deploy-tf.sh my-clone/
# Destroy
./bin/deploy-tf.sh my-agent/ --destroyEach agent gets its own Terraform workspace — deploy multiple agents from the same repo without state conflicts.
| Tool | Install |
|---|---|
| Terraform 1.5+ | install guide |
| azapi provider | Auto-installed on terraform init |
| azurerm provider | Auto-installed on terraform init |
Wraps the Bicep flow in azd up. Set environment variables, run one command.
# Initialize
azd init -t sreagent-recipes # or clone + cd into repo
azd env new my-agent
# Set recipe + parameters
azd env set RECIPE azmon-lawappinsights
azd env set AZURE_AGENT_NAME my-agent
azd env set AZURE_RESOURCE_GROUP rg-my-agent
azd env set AZURE_LOCATION swedencentral
azd env set AZURE_TARGET_RGS rg-my-workload
azd env set AZURE_LAW_ID "/subscriptions/.../workspaces/my-law"
azd env set AZURE_AI_ID "/subscriptions/.../components/my-ai"
azd env set AZURE_AI_APPID "00000000-0000-0000-0000-000000000000"
# Deploy (create or update)
azd up
# Clone: export, create new env, azd up
./bin/export-agent.sh -s $SUB -g rg-my-agent -n my-agent \
-o agents/my-clone/ --set agentName=my-clone --set resourceGroup=rg-clone
azd env new my-clone
azd env set AZURE_AGENT_NAME my-clone
azd env set AZURE_RESOURCE_GROUP rg-clone
azd env set AZURE_LOCATION swedencentral
azd up
# Destroy
azd downRecipe-specific env vars:
| Recipe | Extra env vars |
|---|---|
| pagerduty | PAGERDUTY_API_KEY |
| dynatrace | DT_TENANT, DT_TOKEN, GITHUB_REPO |
Full PowerShell 7+ port in bin/ps/. Same config directory, same results.
./bin/ps/New-Agent.ps1 -Recipe azmon-lawappinsights -NonInteractive `
-Set @{agentName='my-agent'; resourceGroup='rg-my-agent'; location='swedencentral'; targetRGs='rg-my-workload'} `
-Output my-agent/
./bin/ps/Deploy-Agent.ps1 -InputPath my-agent/| Script | Purpose |
|---|---|
New-Agent.ps1 |
Create agent config from recipe |
Deploy-Agent.ps1 |
Deploy (Bicep + apply-extras) |
Export-Agent.ps1 |
Export/clone a live agent |
Verify-Agent.ps1 |
22-point verification |
Diff-Agent.ps1 |
Compare config vs live agent |
See examples/ci-cd/ for GitHub Actions and step-by-step setup.
A recipe is defined by 5 dimensions — think through each for your use case:
- Incident Platform — AzMonitor, PagerDuty, ServiceNow
- Connectors — Log Analytics, App Insights, Kusto, MCP (Dynatrace/Datadog/custom)
- Skills — investigation playbooks for your workload (VM, CosmosDB, HTTP errors, etc.)
- Knowledge — runbooks, architecture docs, incident templates
- Response Plan — severity filter, autonomous vs review, customInstructions prompt
See CONTRIBUTING.md for the full recipe design guide, naming conventions, and PR guidelines.