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

Lesson 56 — Automating Suspicious IP Investigations

Turn a suspicious IP address in a Sentinel incident into a repeatable, evidence-first investigation. Collect identity activity, compare approved context and produce an analyst-ready summary — without automatically blocking a legitimate service.

Module 6 — SOC Automation and Response • IP investigation workflows
Agent Foskett Microsoft Sentinel suspicious IP investigation automation
What you will learn

Build a controlled IP investigation playbook.

✓ Extract and validate IP entities
✓ Correlate sign-in evidence with KQL
✓ Check approved watchlist context
✓ Produce an auditable analyst handoff

The case — one IP, several possible explanations

A Microsoft Sentinel incident flags repeated sign-in failures from an unfamiliar IP address. Is it hostile infrastructure, a shared VPN gateway, a corporate proxy or simply an outdated reference entry? Agent Foskett's playbook gathers the available evidence, records its limits and asks an analyst to decide.

Learning objectives

  • Extract IP entities safely from an incident-triggered playbook.
  • Separate internal, private and public address handling.
  • Correlate the address with available Entra sign-in telemetry.
  • Compare the address against an approved Sentinel watchlist.
  • Produce a sourced investigation summary and preserve analyst approval for response.

Investigation flow

INCIDENT CREATED OR UPDATED ↓ EXTRACT IP ENTITIES → VALIDATE / DEDUPLICATE ↓ CLASSIFY ADDRESS → CHOOSE APPROVED SOURCES ↓ QUERY SIGN-IN ACTIVITY + WATCHLIST CONTEXT ↓ CHECK GAPS, ERRORS AND TIME WINDOW ↓ WRITE EVIDENCE SUMMARY TO INCIDENT ↓ ANALYST REVIEWS → DECIDES NEXT ACTION

Prerequisites and safe lab setup

  • Complete Lessons 53–55 or have equivalent Sentinel automation and Logic Apps experience.
  • Use a dedicated lab incident and approved test IP address.
  • Confirm Microsoft Sentinel connector, Logic Apps identity, Log Analytics query permissions and watchlist access.
  • Keep the workflow read-only except for an incident comment or approved tag.
  • Never automatically block an IP, disable an account or close an incident in this lab.

Step 1 — Define the investigation question

For each address, answer: Where did we observe it, when, for which identities, and what does our trusted context say? A reputation score by itself is not proof of compromise. Decide the lookback window, maximum number of entities and acceptable query latency before building.

Step 2 — Make a separate lab playbook

  1. Copy the tested enrichment playbook from Lesson 55 into a new lab Logic App.
  2. Name it AF-LAB-IP-Investigation.
  3. Retain a narrowly scoped Sentinel incident trigger and automation rule.
  4. Record its owner, managed identity, resource group and rollback procedure.
  5. Verify that a test incident can invoke the workflow once.

Step 3 — Extract incident IP entities

Use the Microsoft Sentinel connector's supported incident entity action or the trigger's documented entity payload. Inspect a test run before referencing fields. An incident can contain several IPs, duplicate values or none at all. Handle each case explicitly.

Step 4 — Validate and classify addresses

  • Trim whitespace, validate IPv4/IPv6 format and deduplicate exact values.
  • Identify loopback, link-local, private, reserved and public address ranges using a tested IP classification method.
  • Do not send internal addresses to an external reputation service by default.
  • Apply a per-incident processing cap and report skipped addresses.
  • Preserve the original address string for the audit record.

Step 5 — Define evidence boundaries

QuestionEvidence sourceImportant limitation
Which accounts used this address?Entra SigninLogs, where ingestedCoverage and retention vary
Was access successful?ResultType and sign-in detailsA successful sign-in is not automatically malicious
Is it a known organization address?Approved Sentinel watchlistReference data can be stale
What incident triggered the lookup?Sentinel incident and entitiesEntity association does not prove attribution

Step 6 — Choose a time window

For the lab, inspect the previous 24 hours. In production, prefer an explicit incident-relative window when the relevant alert activity occurred earlier. Label the window in every output, and distinguish event time from playbook execution time.

Step 7 — KQL: inspect sign-in activity for one IP

SigninLogs — investigation evidence
  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. 6
  7. 7
  8. 8
  9. 9
  10. 10
  11. 11
  12. 12
  13. 13
let TargetIP = "203.0.113.10";
let Lookback = 24h;
SigninLogs
| where TimeGenerated >= ago(Lookback)
| where IPAddress == TargetIP
| summarize Attempts = count(),
            Successful = countif(ResultType == "0"),
            Failed = countif(ResultType != "0"),
            FirstSeen = min(TimeGenerated),
            LastSeen = max(TimeGenerated)
    by UserPrincipalName, AppDisplayName
| order by Attempts desc

Replace the documentation-only address with your approved lab IP. This query runs in the workspace Logs experience; do not assume a Logic Apps action can execute it until its connector, permissions and parameter handling are configured.

Step 8 — Read the query results correctly

Attempts is the number of matching sign-in records, not the number of attackers. Successful and Failed describe sign-in outcomes, not whether activity was authorized. Review account type, application, conditional access details and corroborating evidence before drawing conclusions.

Step 9 — KQL: inspect the timeline

SigninLogs — chronological view
  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. 6
  7. 7
  8. 8
  9. 9
  10. 10
  11. 11
let TargetIP = "203.0.113.10";
SigninLogs
| where TimeGenerated >= ago(24h)
| where IPAddress == TargetIP
| project TimeGenerated, UserPrincipalName,
          AppDisplayName, ResultType,
          ResultDescription, ConditionalAccessStatus,
          CorrelationId
| order by TimeGenerated asc
| take 200

The row cap keeps the lab view manageable. State when results are truncated; a timeline of 200 rows is not necessarily the complete history.

Step 10 — KQL: check approved watchlist context

Organization IP reference data
  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. 6
let TargetIP = "203.0.113.10";
_GetWatchlist("SOC-IP-Context")
| where SearchKey == TargetIP
| project SearchKey, TimeGenerated
| take 20

Replace the watchlist alias with the one configured in your workspace. Inspect additional columns before using them; watchlist fields are organization-defined. A match is context, not a benign verdict.

Step 11 — Query from Logic Apps safely

  1. Choose a supported Azure Monitor Logs / Log Analytics query action available in your environment.
  2. Configure the intended workspace and least-privilege identity.
  3. Pass the validated IP through the supported query input or safe parameterization mechanism.
  4. Use a bounded time window and reasonable result cap.
  5. Inspect the action's actual output schema before parsing rows.

Do not concatenate unvalidated incident text into KQL. Confirm connector authentication and query permissions with a controlled test.

Step 12 — Handle no-data results

If SigninLogs returns zero rows, write “No matching sign-in records found in the queried workspace and time window”, not “IP is safe.” If the table is unavailable, report a coverage gap rather than a negative finding.

Step 13 — Preserve lookup provenance

Record the workspace, table, query time, event window, watchlist alias, result count and any connector errors. If you use approved external threat intelligence, include the provider and observation timestamp, and avoid forwarding sensitive incident data without authorization.

Step 14 — Build a structured investigation summary

AUTOMATED IP INVESTIGATION — LAB Incident: [incident identifier] IP: [validated address] Window: [UTC start → UTC end] SigninLogs: [record count / unavailable] Accounts: [distinct observed identities] Outcomes: [success / failure counts] Watchlist: [matched / not matched / unavailable] Data gaps: [sources or permissions missing] Conclusion: CONTEXT ONLY — analyst review required Run ID: [Logic Apps execution identifier]

Use dynamic content from successful, validated actions. Never print access tokens, secret values or unredacted sensitive details in broadly visible comments.

Step 15 — Add a comment, not a verdict

Use the supported Sentinel incident comment action to attach the summary. Clearly mark it as automated context. Do not change severity, owner, status or classification based solely on an IP lookup.

Step 16 — Avoid duplicate comments

Automation can run again when an incident changes. Define a repeat-run strategy: record a workflow version and execution marker, compare an existing marker when feasible, or use a controlled trigger condition. Avoid creating an endless update → automation → comment cycle.

Step 17 — Design failure paths

FailureSafe behaviour
No IP entitySkip lookup; record why
Malformed or reserved addressUse local-only context or skip
Query permission deniedReport unavailable evidence
Rate limit or timeoutBound retries; flag incomplete result
Watchlist missingDo not infer trust
Multiple IPsDeduplicate, cap and disclose limit

Step 18 — Test with controlled scenarios

  1. Incident with one valid public test IP.
  2. Incident with two duplicate IP entities.
  3. Incident with a private address.
  4. Incident with no IP entity.
  5. Incident with an IP that has no matching sign-in records.
  6. Simulated query failure or missing watchlist.
  7. Repeated invocation against the same incident.

For each test, inspect Logic Apps run history and the final Sentinel incident comment.

Step 19 — Review permissions and privacy

Keep read access scoped to the required workspace and write access limited to the intended incident action. Verify the playbook's identity and connector permissions separately. Limit retention of execution inputs/outputs that contain identifiers and follow your organization's privacy policy.

Step 20 — Performance and cost controls

Use narrow query windows, bounded row counts, capped entity loops and controlled retry policies. Query execution, Logic Apps actions and external lookups can have cost and throttling implications. Monitor failed runs and processing time before broad deployment.

Agent Foskett case file — The trusted address

The watchlist labels the address “Trusted VPN”. The automated summary also finds failed sign-ins against several accounts and one successful sign-in. A rushed workflow might close the incident as harmless. Agent Foskett checks the reference entry's owner and age, then reviews the actual identity evidence.

Finding: a trusted infrastructure label does not establish that every activity originating from it is authorized.

Hands-on challenge

  1. Copy your Lesson 55 enrichment playbook.
  2. Extract and validate an IP entity.
  3. Query a 24-hour sign-in window in the lab.
  4. Compare against your approved watchlist.
  5. Build an evidence summary with source and time details.
  6. Post a comment to the test incident.
  7. Test the missing-data and repeated-run cases.
  8. Write the analyst's next two investigation pivots.

Publishing and operational checklist

  • Inputs validated; internal and reserved addresses handled appropriately.
  • KQL outputs verified against source records.
  • Lookback window, row caps and missing data disclosed.
  • Least-privilege connector identities confirmed.
  • Comment text identifies automated context, not a verdict.
  • Repeat runs and failure paths tested.
  • No automatic blocking, account changes or incident closure.
  • Rollback and ownership documented.

Agent Foskett takeaway

Automate the collection of evidence, not the assumption of guilt. A suspicious IP is a starting point. Good automation tells an analyst what was observed, what remains unknown and where to investigate next.

The logs already knew. Agent Foskett checked the context.

Lesson 56 complete — suspicious IP investigations with evidence!
You can now design and validate an auditable IP investigation playbook with KQL, approved context and human review.
Sentinel Academy Home

Related Agent Foskett learning

Build on the incident enrichment and playbook skills from earlier lessons.