Lesson 55 — Automatically Enriching Sentinel Incidents
Turn a basic incident notification into an evidence-first enrichment workflow. Use approved context sources to help analysts decide what to investigate, without confusing a lookup result with proof of compromise.

What you will learn
Build a controlled, auditable incident enrichment workflow.
The case — the suspicious address
A Sentinel incident includes an unfamiliar IP address. An analyst needs to know whether it belongs to a trusted service, appears in an approved watchlist or has relevant reputation context. Agent Foskett builds a playbook that gathers context and records what it actually found — without automatically declaring the IP malicious.
What you will learn
- Distinguish incident enrichment from detection and response.
- Extract incident entities using supported Sentinel connector actions.
- Choose approved internal and external enrichment sources.
- Validate missing, ambiguous and stale lookup results.
- Add a readable incident comment with provenance and limitations.
- Test failure paths, duplicate runs and access permissions.
Where enrichment fits
Enrichment adds context to an investigation. It does not establish that an account, device or address is compromised.
Prerequisites and lab safety
- Complete Lessons 53 and 54 or have equivalent experience with automation rules and Logic Apps.
- Use a dedicated lab incident with a known test IP or other non-sensitive entity.
- Confirm Sentinel and Logic Apps permissions, connector identities and organizational approval for lookup sources.
- Do not send personal or sensitive incident data to external services without approval.
- Start with comment-only output; no account disablement, IP blocking or automatic closure.
Step 1 — Define the enrichment contract
| Input | Output | Guardrail |
|---|---|---|
| Incident resource and entities | Selected entity identifiers | Validate type and presence |
| Approved lookup source | Context and source timestamp | Record provenance and errors |
| Enrichment result | Analyst-facing incident comment | No unsupported verdict or response |
Step 2 — Choose a suitable entity
For the first lab, enrich a single IP address entity. Some incidents contain multiple IPs, none at all, or mixed account, host and URL entities. Define whether the workflow processes the first matching IP or iterates over all matching IPs, and document the limit.
Do not assume an IP address is an attacker: it may be a VPN egress address, proxy, internal resolver or shared service.
Step 3 — Create a copy of your playbook
- Open the tested Lesson 54 Logic App.
- Save or deploy a separate lab version named
AF-LAB-Incident-Enrichment. - Retain the Microsoft Sentinel incident trigger and a dedicated, narrow automation rule.
- Verify the workflow identity and permissions before changing actions.
- Record the resource group, owner and rollback steps.
Step 4 — Retrieve incident entities
Use the Microsoft Sentinel connector’s supported incident-entity action or the incident trigger’s documented entity data, depending on your workflow and connector version. Inspect dynamic content and a controlled test run to confirm the actual payload.
Prefer the designer’s typed dynamic content to hand-built JSON paths. An incident number, resource ID and entity identifier are not interchangeable.
Step 5 — Filter and normalize IP entities
- Inspect the returned entity array.
- Use a filter or condition for IP-type entities supported by your connector schema.
- Extract the address value and trim whitespace.
- Handle empty values, malformed strings and unexpected types.
- For the initial lab, cap the number of addresses processed and record any truncation.
Use sample run history to confirm field names; connector outputs can differ across versions.
Step 6 — Choose an approved context source
| Source | Useful context | Limitation |
|---|---|---|
| Internal asset inventory | Ownership and business role | May be outdated |
| Sentinel watchlist | Organization-maintained trusted or monitored addresses | Entry does not prove benign or malicious |
| Approved threat-intelligence feed | Indicator reputation and observed context | Can be stale, incomplete or false positive |
For this exercise, start with an approved internal reference source. External reputation lookups require privacy, licensing, egress and credential review.
Step 7 — Build a controlled lookup
- Add the approved connector action or authorized API call for your reference source.
- Pass only the validated IP address required by that source.
- Use managed identity where supported, otherwise store credentials in an approved secret mechanism.
- Capture lookup status, source name, retrieval time and returned classification or notes.
- Do not log secrets or raw authentication headers.
Watchlist data is often queried through Log Analytics/KQL; it is not automatically exposed as a one-click Logic Apps lookup action. Choose an integration method supported by your tenant.
Step 8 — KQL: inspect your approved watchlist
- 1
- 2
- 3
- 4
- 5
- 6
_GetWatchlist("SOC-IP-Context")
| project SearchKey, TimeGenerated,
Description = tostring(column_ifexists("Description", "")),
Classification = tostring(column_ifexists("Classification", ""))
| take 20Replace SOC-IP-Context with a watchlist alias that exists in your workspace. Watchlist columns are defined by the uploaded data; inspect the real schema first. SearchKey is the designated search key, not necessarily a validated IP address.
Step 9 — KQL: compare observed IP activity with context
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
let Context =
_GetWatchlist("SOC-IP-Context")
| project IPAddress = tostring(SearchKey),
Classification = tostring(column_ifexists("Classification", ""));
SigninLogs
| where TimeGenerated > ago(24h)
| where isnotempty(IPAddress)
| summarize SignIns = count(),
FailedSignIns = countif(ResultType != "0")
by IPAddress
| join kind=leftouter Context on IPAddress
| project IPAddress, SignIns, FailedSignIns, Classification
| order by FailedSignIns descThis query is an analyst validation example, not a claim that the playbook automatically executes KQL. If the workflow needs query results, configure and authorize a supported Log Analytics query action separately. The SigninLogs table requires appropriate ingestion and access.
Step 10 — Design honest result categories
| Result | Suggested note |
|---|---|
| Approved context found | “Reference entry found; analyst validation required.” |
| No match | “No match in this source at lookup time.” |
| Lookup failed | “Enrichment unavailable; source did not return a usable result.” |
| No supported IP entity | “IP enrichment skipped: no valid IP entity present.” |
“No match” does not mean “safe”. “Matched indicator” does not by itself mean “confirmed attack”.
Step 11 — Add a structured incident comment
Build the note using validated dynamic fields. Avoid dumping complete incident payloads into comments or including unnecessary personal data.
Step 12 — Handle empty and multiple results
Use conditions to skip unsupported entities and avoid passing null values to connectors. When more than one valid IP is present, use a bounded loop or an explicit single-IP lab scope. Keep the output readable and make the processed count visible.
Step 13 — Build an error path
- Group lookup actions in a Logic Apps Scope.
- Add a fallback Scope configured with run after for failure, timeout or skipped states as appropriate.
- Record a neutral “lookup unavailable” note without exposing secrets.
- Preserve the run ID and failed action for troubleshooting.
- Do not treat a failed lookup as a negative reputation result.
Step 14 — Prevent duplicate enrichment
Automation rules, connector retries and manual playbook runs can create repeated notes. Use an approved idempotency strategy, such as an incident/workflow/version marker in a durable state store, when required. A comment-only lab can demonstrate duplicates safely, but production workflows must define retry and deduplication behaviour explicitly.
Step 15 — Test with a matching incident
- Create or select an approved lab incident with a known IP entity.
- Confirm the automation rule matches only the intended test incident.
- Run the playbook and inspect trigger inputs and action outputs.
- Compare the incident comment with the original reference source.
- Verify that no severity, status, ownership or containment changes occurred.
Step 16 — Test non-matching and failure cases
- Incident with no IP entity.
- Valid IP with no context match.
- More than one IP entity.
- Lookup service timeout or denied permission.
- Incident that should not match the automation rule.
- Repeated execution of the same test incident.
Capture the expected and observed outcomes for each case.
Step 17 — Review permissions and data handling
Verify the Logic App identity can access only required resources. Confirm the lookup connector’s authentication, network egress, retention, logs and cost. Apply organizational rules for sensitive identifiers, external services and incident data. A workflow can succeed technically while violating a data-handling requirement.
Step 18 — Troubleshoot a missing enrichment note
| Symptom | Check first |
|---|---|
| No Logic App run | Automation rule trigger, condition and playbook authorization |
| Run fails on entity extraction | Actual payload schema and missing values |
| Lookup returns empty | Source scope, search key, normalization and permissions |
| Lookup succeeds but no comment | Incident reference and connector identity |
| Multiple comments | Retries, overlapping rules and duplicate executions |
Step 19 — Agent Foskett case file: The trusted address
The playbook marks an IP address as “trusted” because it appears on an internal watchlist. The SOC analyst is ready to close the case.
Agent Foskett checks the entry. It was added two years ago for a retired VPN gateway.
“Excellent,” he says. “We have successfully automated our historical assumptions.”
Lesson: reference data is context, not a verdict. Always check its owner, age and relevance.
Hands-on assessment
- Build a dedicated enrichment playbook with a narrow Sentinel automation rule.
- Extract and validate an IP entity from a controlled incident.
- Query one approved context source and preserve provenance.
- Add an honest, structured incident comment.
- Demonstrate the no-match and lookup-failure paths.
- Verify the playbook makes no disruptive security changes.
- Document permissions, retry behaviour, cost and rollback.
Publishing and operational checklist
- Incident and entity schema verified in a test run.
- Lookup source approved and documented.
- Inputs validated; empty and multiple entities handled.
- Comments identify source, timestamp and limitations.
- Failure does not masquerade as “clean”.
- Duplicate execution considered.
- Least-privilege access and data-handling rules checked.
- Test evidence and rollback instructions retained.
Agent Foskett takeaway
Enrichment should make an analyst better informed, not falsely certain. Gather context, show where it came from, explain what is missing and leave the investigation decision to the evidence.
The logs already knew. The lookup merely introduced itself.
