Deploy Microsoft Sentinel End-to-End with Terraform on Azure
Stand up a complete Microsoft Sentinel foundation as code - workspace, onboarding, threat intelligence indicator, scheduled rule, and automation rule - with Terraform.

Lab overview
Microsoft Sentinel is Azure's cloud-native SIEM and SOAR platform, built on top of a Log Analytics Workspace that ingests security signals, runs scheduled KQL detections, and drives automated incident response. In production SOC environments, clicking through the Azure portal to onboard Sentinel, import threat intelligence, and author analytics rules does not scale and leaves no auditable record of how the detection estate was assembled. Treating Sentinel as infrastructure-as-code (declaring the workspace, its onboarding state, threat intelligence indicators, analytics rules, and automation rules in Terraform) makes the entire security foundation versioned, reviewable, and reproducible across subscriptions and environments.
The catch is that Sentinel objects are not independent resources: a scheduled analytics rule, a threat intelligence indicator, and an automation rule are all children of a workspace that must first be onboarded to Sentinel, and the Terraform provider has a well-known ordering pitfall where these children silently bind to the wrong workspace if the dependency graph is not made explicit. In this lab, you will author Terraform from an in-browser IDE to deploy a complete Sentinel foundation end to end: a Log Analytics Workspace, the Sentinel onboarding resource, a workspace-scoped threat intelligence indicator, one scheduled KQL analytics rule, and one automation rule. You will use explicit depends_on relationships to guarantee the provider builds them in the correct order.
By completing this Intermediate lab, you will be able to:
- Author Terraform that provisions a Log Analytics Workspace and onboards it to Microsoft Sentinel using
azurerm_sentinel_log_analytics_workspace_onboarding - Deploy a workspace-scoped threat intelligence indicator with
azurerm_sentinel_threat_intelligence_indicatoras an indicator of compromise declared in code - Define a scheduled KQL analytics rule with
azurerm_sentinel_alert_rule_scheduled, setting severity, query frequency, and trigger threshold - Create an incident automation rule with
azurerm_sentinel_automation_rulethat acts on generated incidents - Apply explicit
depends_onordering so Sentinel children bind to the onboarded workspace and avoid the known provider race condition - Run the full
terraform init,plan, andapplyworkflow against a pre-provisioned resource group and confirm the deployed Sentinel foundation
Who is this lab for?
This lab is designed for:
- Cloud and Security engineers who want to manage Microsoft Sentinel as infrastructure-as-code rather than through the portal
- SOC engineers and detection-content authors moving toward versioned, reviewable security configuration
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.
More labs like this
Deploy a Full Azure Environment Using Bicep Infrastructure as Code
Write modular Bicep templates to deploy a VNet, App Service, SQL Database, and Key Vault, then deploy the full environment using Azure CLI.
Deploy Azure SQL Database with Terraform
Define and deploy an Azure SQL Server and database using Terraform with firewall rules, variables, and output values in this hands-on lab.
Implement Network Security Groups (NSGs) and Application Security Groups (ASGs) in Azure
Secure Azure VMs using Network Security Groups and Application Security Groups. Create rules, control traffic flow, and implement least privilege access.
Related reading
Environment
Every lab includes
- Real environment, pre-credentialed
- Automated checks on every step
- Isolated sandbox, auto cleanup
- AI-recommended next steps
Lab curriculum
- 01
Logging into Azure CLI
- 02
Authoring the Log Analytics Workspace and Sentinel Onboarding
1 automated check
- 03
Adding a Workspace-Scoped Threat Intelligence Indicator
1 automated check
- 04
Defining a Scheduled KQL Analytics Detection Rule
1 automated check
- 05
Creating an Incident Automation Rule for Triage
1 automated check
- 06
Enforcing Explicit Dependency Ordering and Verifying the Stack
1 automated check
Skills validated
Not the lab you were looking for?
Browse 150+ hands-on labs across AWS, Azure, Kubernetes, Docker, and cloud security.