Hands-On LabAdvanced

Manage Sentinel Detection-as-Code with Terraform

Manage Sentinel analytics rules, an automation rule, and a watchlist as version-controlled Terraform, then make a drift-free change and re-apply.

70 minEstimated time
6Guided steps
AutoVerification
IsolatedSandbox
Manage Sentinel Detection-as-Code with Terraform

Lab overview

Security operations teams used to click through the Microsoft Sentinel portal to create and edit analytics rules, automation rules, and watchlists - an approach that quietly drifts out of sync, leaves no review trail, and cannot be promoted reliably from a test workspace to production. Detection-as-Code treats detection content as software: every analytics rule, automation rule, and watchlist is declared in version-controlled Terraform, reviewed in a pull request, and rolled out by terraform plan/apply so the deployed state always matches what is committed. The payoff is fleet-scale consistency - one parameterized definition can manage many rules - and controlled, auditable change, because Terraform shows you the exact diff before anything touches the live workspace.

In this lab, you will start from a baseline Sentinel workspace and manage its detection content entirely through Terraform. You will collapse multiple scheduled analytics rules into a single for_each block driven by a locals map, add a Sentinel automation rule and a watchlist as code, then change one rule's severity and threshold and re-apply - watching terraform plan produce a clean, targeted diff that updates only the intended rule.

Objectives

Upon completion of this advanced level lab, you will be able to:

  • Apply a provided Terraform baseline (workspace plus Sentinel onboarding) to get a managed workspace
  • Manage two to three scheduled analytics rules from a single for_each block driven by a locals map
  • Deploy a Sentinel automation rule and a watchlist as code so triage logic and reference data live in the same repo as the detections
  • Make a controlled change to one rule's severity and threshold, then run terraform plan for a clean targeted diff
  • Re-apply and verify the live rule reflects the update with no unintended drift

Who is this lab for?

This lab is designed for:

  • Detection engineers operating Sentinel content at scale
  • SOC platform engineers managing detections as code
  • Cloud security engineers comfortable with Sentinel rule types and basic terraform plan/apply

Verified against your live environment

An automated validation engine inspects your actual resources and configurations as you work. Completion means the task was performed, not multiple choice, real-world proficiency.

[CHECK] validation_activelive
Inspecting deployed resources...
Verifying configuration state...
✓ Step requirements satisfied

More labs like this

PremiumIncluded in Premium
Duration
70 min
Steps
6

Environment

Browser Code IDELive Cloud Environment

Every lab includes

  • Real environment, pre-credentialed
  • Automated checks on every step
  • Isolated sandbox, auto cleanup
  • AI-recommended next steps

Lab curriculum

  1. 01

    Logging into Azure CLI

  2. 02

    Apply the Provided Sentinel Baseline Workspace and Onboarding

    1 automated check

  3. 03

    Manage Multiple Scheduled Rules with a for_each Locals Map

    1 automated check

  4. 04

    Deploy a Sentinel Automation Rule and Watchlist as Code

    1 automated check

  5. 05

    Change a Rule Severity and Threshold and Plan a Clean Diff

    1 automated check

  6. 06

    Re-Apply the Change and Verify the Drift-Free Rule Update

    1 automated check

Not the lab you were looking for?

Browse 200+ hands-on labs across AWS, Azure, Kubernetes, Docker, and cloud security.

Explore the catalog