---
title: Build Your Own SQL Server DBA Agent
summary: Design and validate a focused read-only investigation workflow for a database reliability question of your choosing.
phase: Capstone
group: Capstone
tags:
- custom agent
- evidence
- read-only
highlight: true
---

# Challenge 09 — Build Your Own SQL Server DBA Agent

> **Capabilities added in this challenge**: Custom DBA Agent · Investigation Design · Read-Only Validation

## Purpose

* Design and demonstrate a read-only DBA agent that answers one bounded question with cited native evidence.
* Test it against an out-of-scope request and state the gaps that block production use.
* Expected time: 75-90 minutes.

## Introduction

You have practiced schema discovery, Query Store analysis, waits, blocking,
index evidence, query shape, parameter behavior, and incident handoffs. Now
design a focused database reliability workflow around a problem that matters to
your team.

Build and demonstrate a purpose-built SQL Server DBA agent configuration that
turns a clear operational question into a repeatable, evidence-led
investigation. It must not change database state.

## Description

Create a capstone that:

* Defines one database reliability question, its audience, impact, and bounded
  observation window
* Configures a focused DBA custom agent and target-specific investigation
  guidance using the supplied `sqlserver-mcp` connector and its approved tools
* Identifies the expected native evidence, important alternative explanations,
  and conditions where the agent must report insufficient evidence
* Demonstrates the workflow against an approved sample-database scenario and
  tests at least one unsupported or out-of-scope request
* Produces a concise technical handoff with evidence, recommendations, owners,
  validation considerations, and an explicit read-only confirmation

The scenario must extend the techniques from this track rather than repeat the
combined incident exercise in Challenge 08. Keep the database trust boundary
and the supplied MCP tool contract intact.

> **Optional accelerator:** if your scenario would benefit from packaging as a reusable Azure SRE Agent skill or subagent — rather than only a `sqlserver-mcp`-based agent configuration — the `rvas-sre-agent-jumpstart` skill can interview you about the use case and draft the capability for your review. It does not change or widen the read-only `sqlserver-mcp` trust boundary above. Install it and its two dependency skills with:
>
> ```bash
> copilot plugin marketplace add microsoft/frontier-sre-agent-rvas
> copilot plugin install rvas-sre-agent-jumpstart@rvas-sre-agent-jumpstart
> gh skill install mattpocock/skills skills/productivity/grilling --agent github-copilot
> gh skill install MicrosoftDocs/Agent-Skills skills/azure-sre-agent --agent github-copilot
> ```

### Solution steps

An acceptable capstone might investigate a recurring Query Store regression for
one business operation. You should:

1. Define the affected operation, user impact, database profile, and UTC time window.
2. Configure a narrowly scoped agent and guidance that use only
   `list_profiles`, `get_object`, `run_query`, and `analyze_query` through
   `sqlserver-mcp`.
3. Compare bounded Query Store intervals and plan evidence, then check one
   credible alternative such as workload change or parameter distribution.
4. Test a request outside the scenario scope and confirm the agent stops or
   explains the missing prerequisite without using another connection path.
5. Present a handoff that labels observations and hypotheses separately,
   recommends an owner-led validation, and confirms no database changes.

Other scenarios are valid when they use the available sample evidence and meet
the same safety and traceability standard.

## Success Criteria

- [ ] A scenario brief states the operational question, impact, audience, and observation window
- [ ] A purpose-built DBA agent and target-specific investigation guidance have a clear scope and use only the approved `sqlserver-mcp` tools
- [ ] The live or replayable demonstration cites native evidence, distinguishes observations from hypotheses, and considers at least one alternative explanation
- [ ] An unsupported request or evidence gap is handled safely without switching tools, inventing findings, or changing database state
- [ ] The final handoff gives actionable read-only recommendations with owners and validation considerations
- [ ] A concise presentation explains the scenario, design choices, demonstration, and production-readiness gaps
- [ ] **Explain in your own words** (two or three written sentences) — what evidence or organizational control would you require before this workflow could influence a production database decision?

## Learning Resources

* [Azure SRE Agent skills](https://learn.microsoft.com/azure/sre-agent/skills)
* [Azure SRE Agent subagents](https://learn.microsoft.com/azure/sre-agent/sub-agents)
* [Monitor and tune for performance](https://learn.microsoft.com/sql/relational-databases/performance/monitor-and-tune-for-performance)
* [Query Store usage scenarios](https://learn.microsoft.com/sql/relational-databases/performance/query-store-usage-scenarios)

## Tips

* Choose one question with a repeatable signal and an observable outcome.
* Reuse the supplied safety policy; narrow the agent's purpose rather than
  weakening its tool or permission boundaries.
* A well-supported conclusion of "insufficient evidence" is a valid result.

## Hints and notes

> Hidden until you click. Expand a section only when you want it.

<details>
<summary><strong>Background</strong></summary>

* A useful agent starts with a bounded operational question, not a broad role description.
* The `sqlserver-mcp` tool contract and database permissions remain the enforcement boundary.
* Every conclusion should be traceable to native evidence with a clear scope and time window.
* Missing evidence and safe refusal are valid outcomes; a confident unsupported root cause is not.
* A production workflow also needs ownership, review, and validation outside the agent.

</details>

<details>
<summary><strong>Expected Output</strong></summary>

* A scenario brief with impact, audience, observation scope, and expected signals.
* A purpose-built DBA custom-agent configuration and target-specific investigation guidance that preserve the supplied read-only policy.
* A live or replayable test showing evidence-based findings and a safe response to an unsupported request or evidence gap.
* A technical handoff with observations, hypotheses, alternatives, recommendations, owners, and validation considerations.
* A concise presentation of the scenario, design, demonstration, and production-readiness gaps.

</details>

<details>
<summary><strong>Common Issues and Hints</strong></summary>

* **Symptom:** The scenario asks the agent to diagnose every database problem. **Fix:** limit it to one question, one audience, and a bounded evidence window.
* **Symptom:** You add tools or database permissions to make the demo easier. **Fix:** preserve the supplied `sqlserver-mcp` contract and treat missing access as a reported prerequisite.
* **Symptom:** The report presents one signal as proven root cause. **Fix:** ask for a second corroborating signal, an alternative explanation, and explicit uncertainty.
* **Symptom:** The demo only shows the expected happy path. **Fix:** test a request outside scope or a case where the required evidence is unavailable.
* **Symptom:** Recommendations imply that the agent applied a fix. **Fix:** separate recommendation from execution and name the owner and validation needed before approval.
* **Symptom:** You want to package your design as a reusable skill or subagent rather than a one-off configuration. **Fix:** use the `rvas-sre-agent-jumpstart` skill as an optional accelerator; it drafts the capability but does not loosen the read-only `sqlserver-mcp` trust boundary this track enforces.

</details>

<details>
<summary><strong>Debrief Discussion Guide</strong></summary>

* What made the scenario narrow enough to produce a useful answer?
* Which native evidence most changed the team's confidence, and what remained unknown?
* How did the unsupported-request test demonstrate the trust boundary?
* What review, ownership, or monitoring would be needed before production use?

</details>
