L3.3 β€” Security Operations 🟑

πŸ“ Level 3 Β· Secure Β· Chapter 3 of 4 Β Β·Β  Previous: L3.2 β€” Workload Protection Β Β·Β  Next: L3.4 β€” Enterprise Security Architecture


Goal: get the alerts L3.2 can now raise out of the portal and into the places people actually work. Continuous export into the Level 2 workspace, and a playbook that runs on every alert without a human watching.

The IaC lesson: automation is code too β€” the Logic App playbook is declared in Bicep, so the response workflow is reviewable, diffable and redeployable instead of a pile of boxes dragged together in the portal.


Who this is for Time You need first Cost while it runs
Chapter 3 of Level 3 · everyone ~25 min L3.2, plus L2.1 and L2.3 🟑 ~$0.03/hr added · ~$1.98/hr running total

[!IMPORTANT] This is the chapter where SecurityAlert stops being empty. From here on, security findings are queryable next to the firewall logs that might explain them.


What you’re building

One continuous-export automation with two destinations. Every alert Defender raises flows both into the Level 2 workspace β€” where it lands next to the logs that might explain it β€” and into a Logic App playbook that triages it without anyone watching. The export is scoped to this resource group on purpose, and the dotted line shows why the work pays off again in Level 5.

flowchart LR
  DEF["Defender for Cloud<br/>alerts from L3.2"]
  EXP["continuous export<br/>scoped to THIS resource group"]
  WS["log-iacdemo-l3<br/>SecurityAlert fills up"]
  PB["logic-iacdemo-alert-triage<br/>HTTP trigger, no connectors"]
  L5["Level 5 Β· Sentinel<br/>SecurityAlert = free connector"]

  DEF --> EXP
  EXP -->|"action 1: Workspace"| WS
  EXP -->|"action 2: LogicApp"| PB
  WS -.->|"already collected"| L5

  classDef src fill:#fff9e6,stroke:#c9a227,color:#1a1a1a
  classDef act fill:#eefaf0,stroke:#3a9d5d,color:#1a1a1a
  classDef fwd fill:#fff4e5,stroke:#d97706,color:#1a1a1a
  class DEF,EXP src
  class WS,PB act
  class L5 fwd

Text description of this diagram</summary>

One continuous-export automation with two destinations. Defender for Cloud alerts β€” the ones L3.2’s protections can now raise β€” flow into the export, which sends each finding both to the Level 2 Log Analytics workspace and to a Logic App playbook.

The export is scoped to this resource group, not the subscription. That is a cost control as much as a permission one: a subscription-wide export bills for every finding in the subscription, and needs Security Admin to create.

The dotted line forward is the payoff. SecurityAlert is a free data source in Microsoft Sentinel, so everything this chapter exports arrives in Level 5 with no additional analysis charge.

</details>

Source: curriculum/L3.3-security-operations/main.bicep Β· main.bicepparam


πŸ” Going deeper β€” why the playbook has no Teams or email action</summary>


A Logic App that posts to Teams, sends mail or opens a ticket needs an API connection, and an API connection needs an interactive OAuth consent that no deployment can perform for you. Shipped that way, this chapter would deploy green and fail on first run β€” the worst possible lesson. This playbook is HTTP-triggered and self-contained: it parses the alert and returns a triage summary, so the wiring is real and works the first time. Adding a connector afterwards is a deliberate, consented step, and the permissions block below says who can grant it.

</details>

πŸ” Going deeper β€” why exporting now pays off in Level 5</summary>


L3.1’s workbook had to query Azure Resource Graph precisely because nothing was exporting yet. From this chapter on, security findings are queryable next to the firewall logs that might explain them β€” and Level 5 inherits a workspace that already has them, at no extra ingestion cost, because SecurityAlert is a free Sentinel data source.

</details>

πŸ” Going deeper β€” the permissions this needs</summary>

Azure RBAC β€” the minimum this chapter needs

Contributor on the lab resource group, covering both Microsoft.Security/automations and the Logic App.
Why: the export automation and the playbook are both ordinary resources, and reading the playbook's trigger URL uses listCallbackUrl, an action Contributor holds. Exporting at subscription scope instead would need Security Admin β€” and would bill for every finding in the subscription, so the scope limit is a cost control as much as a permission one.
Microsoft Entra ID roles

None β€” because the playbook has no connectors.
This is the first place the directory would get involved in a real build. A playbook that posts to Teams, sends mail or opens a ticket needs an API connection, and an API connection needs an interactive OAuth consent that no deployment can perform for you. Who may grant it is a directory decision: users can consent for themselves only if the tenant allows it, otherwise a Cloud Application Administrator or Global Administrator has to.

For more info β€” Defender for Cloud permissions, and who may consent to a connector

</details>



[!NOTE] 🏫 Classroom: use the GitHub Actions option. Your Azure account holds Reader, so local az deployment commands will be refused β€” deploys go through your fork’s workflow, which uses the workshop deploy identity automatically. Compiling locally (az bicep build) works for everyone.

πŸš€ Deploy it β€” pick any one of three ways



1 Β· Bicep CLI
Copy-paste in the terminal


2 Β· GitHub Actions
One button in the browser


3 Β· GitHub Copilot
Ask AI in plain English



Β  Option 1 Β· Bicep from the terminal

az deployment group what-if --resource-group $env:AZURE_RESOURCE_GROUP --parameters curriculum/L3.3-security-operations/main.bicepparam
az deployment group create  --resource-group $env:AZURE_RESOURCE_GROUP --parameters curriculum/L3.3-security-operations/main.bicepparam

You should see: tablesThatWillFill naming SecurityAlert, and a sentinelNote explaining why exporting it now costs nothing extra later.

Want the compliance history too? Recommendations are much higher volume:

$env:CURRICULUM_EXPORT_RECOMMENDATIONS = "true"

Then check tomorrow’s Usage query from L2.4 and decide whether it earned it.



Β  Option 2 Β· GitHub Actions (push-button)

Actions β†’ β€œCurriculum L3 - Security & Defender for Cloud” β†’ Run workflow β†’ L3.3 - Security Operations.



Β  Option 3 Β· GitHub Copilot (plain English)

Load your values first: ./scripts/Load-LabSettings.ps1. Then in Copilot Chat β†’ Agent mode:

Deploy curriculum/L3.3-security-operations/main.bicep to my lab resource group ($env:AZURE_RESOURCE_GROUP) with az deployment group create.

Then ask for the thing that will bite you:

Add a Teams β€œpost a message” action to the playbook in curriculum/L3.3-security-operations/main.bicep.

Copilot will write a Microsoft.Web/connections resource and a Teams action, and it will compile. Deploy it and the connection lands in an unauthorised state β€” someone has to open it in the portal and consent interactively. That is not a Copilot failure; it is what a connector is. Knowing which resources carry an invisible manual step is the difference between a template that works and one that deploys.



βœ… Verify it

  1. The export exists and is scoped tightly:

    az security automation list -g $env:AZURE_RESOURCE_GROUP `
      --query "[].{name:name, enabled:isEnabled, scopes:scopes[].scopePath}" -o json
    

    You should see: one automation, enabled, scoped to your resource group β€” not the subscription.

  2. The playbook is wired to it:

    az rest --method get --url "https://management.azure.com$(az security automation list -g $env:AZURE_RESOURCE_GROUP --query '[0].id' -o tsv)?api-version=2019-01-01-preview" `
      --query "properties.actions[].actionType" -o tsv
    

    You should see: Workspace and LogicApp. Two destinations, one automation.

  3. Fire it end to end β€” repeat the failed-login test from L3.2 until Defender raises an alert, then:

    az monitor log-analytics query --workspace $WS `
      --analytics-query "SecurityAlert | project TimeGenerated, AlertName, AlertSeverity, CompromisedEntity | order by TimeGenerated desc | take 10" -o table
    

    You should see: rows in SecurityAlert β€” a table that was empty an hour ago. Then check the playbook’s run history in the portal: one run per exported alert, each returning a triage summary.

  4. Watch what it costs. Continuous export is free as a feature; what it exports is not. Tomorrow, re-run L2.4’s Usage query and look for SecurityAlert in the list. At ~0.25 GB/day and $2.76/GB this is about $0.69/day β€” and every gigabyte of it becomes free again in Level 5, because Sentinel does not charge analysis on SecurityAlert.


GitHub feature spotlight Β· Playbooks belong in the repository

You just used it: the Logic App definition is Bicep, so the response workflow is reviewable, diffable and redeployable. A playbook built by dragging boxes in the portal has no history and no reviewer. Find it: the definition block in this chapter’s template β€” the trigger schema and the triage summary are both readable text. Beyond the lab: when an incident review asks β€œwhy did the automation do that”, the answer should be a commit, not a screenshot. Docs β†’



➑️ What carries forward

L3.4 stops responding and starts designing: a web application firewall policy with real rules, priced and reviewable, and deliberately not attached to anything.


🧭 Where next?

Your situation Go to
Ready to keep going β€” design the target state and price it L3.4 β€” Enterprise Security Architecture
β¬… Back to the main path πŸ—ΊοΈ Curriculum Map
Want the big picture of this level first Level 3 Β· Secure overview
Done for the day β€” the estate bills while idle Cleanup & Reset
Something didn’t work Troubleshooting