Lesson 54 — Creating Your First Incident Response Playbook
Build a low-risk, incident-triggered Azure Logic Apps playbook that records useful context without making disruptive security changes. Learn how to connect Sentinel, test the workflow and verify exactly what happened.

What you will learn
Build, authorize and validate your first Sentinel playbook.
The case — a response that leaves evidence
A Sentinel incident arrives. Rather than automatically disabling accounts or isolating machines, Agent Foskett wants a workflow that adds a traceable investigation comment. This first playbook will demonstrate the integration while keeping the action reversible and low impact.Learning objectives
- Distinguish Sentinel automation rules from Logic Apps playbooks.
- Choose a supported Sentinel incident trigger.
- Configure a Logic App with a suitable identity and permissions.
- Add an incident comment using the incident context supplied by the trigger.
- Test with a controlled lab incident and inspect run history.
- Recognise duplicate execution, authorization failures and unsafe response patterns.
How the components fit together
The automation rule decides when to run. The playbook defines what happens.
Prerequisites and safe lab boundaries
- A Microsoft Sentinel-enabled Log Analytics workspace with permission to view and manage lab incidents.
- Rights to create or edit Logic Apps and grant the necessary access, or an administrator available to assist.
- Permission to configure Sentinel automation rules and playbook access.
- A dedicated test incident or an approved lab detection that you can safely trigger.
- A naming convention and change record for lab resources.
Do not test against an active production incident. The exact portal menus and permission labels can vary with the Sentinel experience and Logic Apps plan.
Step 1 — Define the intended behaviour
Trigger: a designated lab incident matches a narrowly scoped automation rule.
Action: append a comment such as “SOC lab playbook executed; analyst review still required.”
Non-goals: no incident closure, user disablement, IP blocking, endpoint isolation or external data transmission.
Success: one intended playbook run, one comment, and a visible execution record.
Step 2 — Choose a Logic Apps hosting model
| Option | Teaching consideration |
|---|---|
| Logic Apps Consumption | Common straightforward choice for a small event-driven lab; check regional availability and connector charges. |
| Logic Apps Standard | Useful for more complex deployments and shared runtime scenarios; hosting and networking differ. |
For this exercise, use a supported Logic Apps configuration in the same organizational environment as Sentinel. Pricing, connector availability and deployment options should be checked in your tenant.
Step 3 — Create the playbook
- Open the relevant Microsoft Sentinel workspace and find the Automation / Playbooks experience, or create a Logic App through Azure.
- Create a clearly named lab playbook, for example
AF-LAB-Incident-Comment. - Select the correct subscription, resource group, region and Logic Apps plan.
- Open the workflow designer and add the Microsoft Sentinel incident trigger supported by your connector.
- Save the workflow and resolve any connector or authentication prompts.
Use an incident-triggered workflow rather than an alert- or entity-triggered workflow; their input schemas are not interchangeable.
Step 4 — Understand the trigger payload
The Sentinel incident trigger supplies incident context to downstream actions. Use the designer’s dynamic content rather than typing an incident identifier by hand. Inspect the available fields in your tenant; do not assume that the incident number, ARM resource identifier and incident URL are the same value.
For troubleshooting, view the trigger inputs in run history while taking care not to expose sensitive incident data in screenshots.
Step 5 — Configure identity and authorization
- Prefer a dedicated managed identity where the selected connector and action support it.
- Grant only the Sentinel workspace permissions needed to update the target incident; the appropriate built-in role may be Microsoft Sentinel Responder, subject to your organization’s access model.
- Review whether the connector action uses the managed identity or a separate connection identity.
- Ensure Sentinel is authorized to run the playbook resource through the required resource-group playbook permissions.
- Recheck authorization after any connection or identity change.
Permissions to edit an incident and permissions for Sentinel to invoke a Logic App are distinct. A successful save does not prove the workflow can run.
Step 6 — Add a low-risk incident action
- After the incident trigger, add the Microsoft Sentinel connector action for adding a comment to an incident (the exact label may vary).
- Populate the incident reference using the trigger’s incident resource identifier or the fields requested by the connector.
- Set the comment to
Agent Foskett lab: playbook executed. Analyst validation required. - Save and confirm that no other actions have been introduced accidentally.
Do not confuse the incident comment action with a generic HTTP call. The supported connector handles the expected incident reference and authentication pattern.
Step 7 — Optional: make the comment informative
Include a short workflow identifier and a safe timestamp in the comment, if supported by the designer. Avoid dumping full trigger JSON, tokens, personal information or alert evidence into the comment. Keep comments readable and relevant to the analyst.
Step 8 — Create a narrow automation rule
- In Sentinel, open the automation-rule configuration.
- Choose an incident created trigger appropriate to the incident source.
- Add a precise lab condition, such as a dedicated incident title prefix or other reliable test-only attribute available in your environment.
- Add the action Run playbook and select your saved playbook.
- Set rule order and expiration according to your lab plan, then save.
Check that the rule is not broad enough to run on all production incidents. Rule support and trigger behavior can differ for Microsoft Defender XDR-originated incidents.
Step 9 — Check playbook availability
If the playbook does not appear in the automation-rule picker, check that it has the correct Sentinel incident trigger, is saved and enabled, resides in a supported subscription/tenant arrangement, and that Sentinel has permission to run playbooks in its resource group. Recheck the connection identity and access scopes.
Step 10 — Run a controlled test
- Generate or use an approved lab incident that matches the rule conditions.
- Record the incident identifier and creation time.
- Confirm the automation rule was evaluated and the playbook was invoked.
- Open Logic Apps Run history and inspect the latest execution.
- Return to the incident and verify the expected comment is present.
- Test a second incident that should not match and confirm there is no execution.
Step 11 — Read the run history
| Stage | Evidence to inspect |
|---|---|
| Trigger | Did Sentinel invoke the expected incident workflow? |
| Connection | Was authentication accepted for the incident action? |
| Action | Did the comment step succeed or fail? |
| Incident | Is the comment actually visible in the correct incident? |
A green run is useful evidence, but always validate the result in Sentinel itself.
Step 12 — Troubleshoot common failures
| Symptom | Check |
|---|---|
| No playbook run | Incident source, automation-rule conditions, rule status and ordering |
| Playbook missing from picker | Trigger type, playbook access and resource-group permissions |
| 401 or 403 error | Connection authentication, identity and Sentinel workspace role assignments |
| Incident not found | Incident resource ID and workspace context |
| Duplicate comments | Multiple matching rules, retries or duplicate trigger invocations |
| Run succeeds, no visible comment | Target incident, action output, refresh and eventual consistency |
Step 13 — Guard against duplicate actions
Automation systems may retry after transient errors, and more than one rule can match the same incident. For this low-risk exercise, duplicate comments are a useful warning. For future high-impact actions, design explicit idempotency checks and a human approval gate where needed.
Never assume a workflow will execute exactly once simply because it has one trigger.
Step 14 — KQL: verify incident history context
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
SecurityIncident
| where TimeGenerated > ago(7d)
| summarize arg_max(TimeGenerated, *)
by IncidentNumber
| project IncidentNumber, Title, Status,
Severity, TimeGenerated
| order by TimeGenerated descThis query helps identify lab incidents and their latest available snapshots. SecurityIncident is not a reliable substitute for Logic Apps run history, and incident comments are not guaranteed to appear as queryable fields in this table.
Step 15 — Verify the correct execution count
Record the number of matching incidents, expected invocations and actual Logic Apps runs. Investigate any difference before treating the workflow as ready. Where retries occur, distinguish a single run with retried actions from multiple separate runs.
Step 16 — Protect investigation evidence
Automation comments should identify the workflow and what it actually did. They must not imply containment, compromise or remediation when those actions did not occur. Preserve the analyst’s original evidence and avoid rewriting incident classifications or closure notes in this lab.
Step 17 — Document the change and rollback
- Record the playbook name, resource group, identity, connection, action and intended matching condition.
- Document how to disable the automation rule immediately.
- Retain the Logic App run history and test results according to organizational policy.
- Remove temporary lab permissions and resources when testing is complete.
- Keep a named owner for ongoing review.
Step 18 — Agent Foskett case file: The helpful robot
The SOC manager proudly announces, “Our new playbook responded to every incident overnight.”
Agent Foskett checks the evidence. Every incident has a new comment: Investigation complete. No investigation has actually happened.
“Impressive,” he says. “We have automated the confidence. Now we just need to automate the facts.”
Lesson: a playbook must report the action it performed, not the conclusion someone hopes it reached.
Hands-on assessment
- Create a named lab playbook with a supported Sentinel incident trigger.
- Add a single comment action using the correct incident reference.
- Configure the required identity and playbook access.
- Create a narrow automation rule that invokes the playbook.
- Prove a matching test incident receives exactly the intended comment.
- Prove a non-matching incident does not run the playbook.
- Capture run-history evidence and write a rollback note.
Publishing and operational checklist
- Trigger type and incident source verified.
- Connector identity and Sentinel permissions verified.
- Automation rule narrowly scoped.
- No destructive actions in the lab workflow.
- Matching and non-matching tests completed.
- Run history and incident outcome reconciled.
- Retry and duplicate-run behavior considered.
- Owner, cost considerations and rollback documented.
Agent Foskett takeaway
Good automation is not measured by how many buttons it presses. It is measured by whether the right action happened, for the right incident, with evidence to prove it.
The logs already knew. This time, the playbook left a note.
