Agent Foskett Academy • Microsoft Sentinel • Module 6 • Lesson 54

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.

Module 6 — SOC Automation and Response • Logic Apps playbook fundamentals
Agent Foskett Microsoft Sentinel incident response playbook lesson
What you will learn

Build, authorize and validate your first Sentinel playbook.

✓ Logic Apps and Sentinel triggers
✓ Managed identity and permissions
✓ Safe incident comment action
✓ Run history and troubleshooting

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

TEST INCIDENT CREATED IN SENTINEL ↓ AUTOMATION RULE (NARROW MATCH) ↓ RUN PLAYBOOK ACTION ↓ LOGIC APPS INCIDENT TRIGGER ↓ ADD INCIDENT COMMENT ↓ CHECK RUN HISTORY + INCIDENT EVIDENCE

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

OptionTeaching consideration
Logic Apps ConsumptionCommon straightforward choice for a small event-driven lab; check regional availability and connector charges.
Logic Apps StandardUseful 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

  1. Open the relevant Microsoft Sentinel workspace and find the Automation / Playbooks experience, or create a Logic App through Azure.
  2. Create a clearly named lab playbook, for example AF-LAB-Incident-Comment.
  3. Select the correct subscription, resource group, region and Logic Apps plan.
  4. Open the workflow designer and add the Microsoft Sentinel incident trigger supported by your connector.
  5. 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

  1. Prefer a dedicated managed identity where the selected connector and action support it.
  2. 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.
  3. Review whether the connector action uses the managed identity or a separate connection identity.
  4. Ensure Sentinel is authorized to run the playbook resource through the required resource-group playbook permissions.
  5. 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

  1. After the incident trigger, add the Microsoft Sentinel connector action for adding a comment to an incident (the exact label may vary).
  2. Populate the incident reference using the trigger’s incident resource identifier or the fields requested by the connector.
  3. Set the comment to Agent Foskett lab: playbook executed. Analyst validation required.
  4. 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.

Agent Foskett lab playbook Action: Incident comment added Outcome: Automated note only Next step: Analyst reviews evidence

Step 8 — Create a narrow automation rule

  1. In Sentinel, open the automation-rule configuration.
  2. Choose an incident created trigger appropriate to the incident source.
  3. Add a precise lab condition, such as a dedicated incident title prefix or other reliable test-only attribute available in your environment.
  4. Add the action Run playbook and select your saved playbook.
  5. 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

  1. Generate or use an approved lab incident that matches the rule conditions.
  2. Record the incident identifier and creation time.
  3. Confirm the automation rule was evaluated and the playbook was invoked.
  4. Open Logic Apps Run history and inspect the latest execution.
  5. Return to the incident and verify the expected comment is present.
  6. Test a second incident that should not match and confirm there is no execution.

Step 11 — Read the run history

StageEvidence to inspect
TriggerDid Sentinel invoke the expected incident workflow?
ConnectionWas authentication accepted for the incident action?
ActionDid the comment step succeed or fail?
IncidentIs 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

SymptomCheck
No playbook runIncident source, automation-rule conditions, rule status and ordering
Playbook missing from pickerTrigger type, playbook access and resource-group permissions
401 or 403 errorConnection authentication, identity and Sentinel workspace role assignments
Incident not foundIncident resource ID and workspace context
Duplicate commentsMultiple matching rules, retries or duplicate trigger invocations
Run succeeds, no visible commentTarget 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

Review latest known incident snapshots
  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. 6
  7. 7
  8. 8
SecurityIncident
| where TimeGenerated > ago(7d)
| summarize arg_max(TimeGenerated, *)
    by IncidentNumber
| project IncidentNumber, Title, Status,
          Severity, TimeGenerated
| order by TimeGenerated desc

This 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

  1. Record the playbook name, resource group, identity, connection, action and intended matching condition.
  2. Document how to disable the automation rule immediately.
  3. Retain the Logic App run history and test results according to organizational policy.
  4. Remove temporary lab permissions and resources when testing is complete.
  5. 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

  1. Create a named lab playbook with a supported Sentinel incident trigger.
  2. Add a single comment action using the correct incident reference.
  3. Configure the required identity and playbook access.
  4. Create a narrow automation rule that invokes the playbook.
  5. Prove a matching test incident receives exactly the intended comment.
  6. Prove a non-matching incident does not run the playbook.
  7. 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.

Lesson 54 complete — your first incident response playbook!
You can now create a controlled Logic Apps playbook, connect it to Sentinel, test the trigger and validate its incident action.
Sentinel Academy Home

Related Agent Foskett learning

Review the automation-rule and playbook foundations behind this exercise.