L2.2 β€” Operational Visibility πŸ”΅

πŸ“ Level 2 Β· Monitor Β· Chapter 2 of 4 Β Β·Β  Previous: L2.1 β€” Monitoring Fundamentals Β Β·Β  Next: L2.3 β€” Proactive Operations


Goal: turn the data L2.1 started collecting into answers β€” a query library saved into the workspace, a workbook that puts the whole estate on one page, and (optionally) an availability test against L1.4’s Front Door endpoint.

The IaC lesson: dashboards as code. The workbook is a Bicep object, so β€œsomeone changed the dashboard” is a reviewable diff with an author β€” not a mystery portal edit.


Who this is for Time You need first Cost while it runs
Chapter 2 of Level 2 Β· everyone ~15 min L2.1, plus L1.3 (its workspace + App Insights) πŸ”΅ ~$0.02/hr added Β· ~$1.92/hr running total

[!IMPORTANT] L2.1 must already be deployed. There is nothing to query otherwise β€” the workbook would render five empty tiles. This chapter also hard-requires L1.3: the saved searches and workbook land in its workspace, and the availability test binds to its Application Insights. The availability test additionally needs L1.4’s Front Door β€” which is why it now ships off by default (workflow input availability_test); turn it on only while L1.4 is standing.


What you’re building

Queries, workbooks and saved searches are free β€” in the Analytics tier you pay on the way in, not to look. The availability test is the only meter in this chapter, and its frequency is the whole bill.

flowchart LR
  WS["log-iacdemo-l3<br/>filled by L2.1"]
  SS["5 saved searches<br/>FREE"]
  WB["workbook<br/>'estate health'<br/>FREE"]
  AI["appi-iacdemo-l3<br/>from L1.3"]
  WT["availability test<br/>2 locations Β· every 15 min<br/>$0.0005 per execution"]
  FD["Front Door endpoint<br/>from L1.4"]

  WS --> SS
  WS --> WB
  WT -->|"GET, expect 200"| FD
  WT -->|"results"| AI
  AI -->|"same workspace"| WS

  classDef free fill:#eefaf0,stroke:#3a9d5d,color:#1a1a1a
  classDef paid fill:#fdecea,stroke:#c0392b,color:#1a1a1a
  classDef src fill:#eef4ff,stroke:#4472c4,color:#1a1a1a
  class SS,WB free
  class WT paid
  class WS,AI,FD src

Text description of this diagram</summary>

Two halves, split by whether they cost anything.

On the free side, the workspace that L2.1 filled gets five saved searches (VM heartbeat, VM CPU, syslog errors, firewall verdicts, and ingestion cost by table) and a workbook that renders four of them on one page.

On the paid side, a standard availability test issues a GET against the Front Door endpoint L1.4 created, from two Azure regions every fifteen minutes, expecting HTTP 200 and a certificate with at least a week left. Results flow into the Application Insights component from L1.3, which writes to the same workspace β€” so a failed probe is queryable next to the firewall logs that might explain it.

The red box is the only meter in the chapter: $0.0005 per execution.

</details>

Source: curriculum/L2.2-operational-visibility/main.bicep Β· main.bicepparam


πŸ” Going deeper β€” the arithmetic of a probe</summary>


The cost is (3600 Γ· frequency) Γ— locations Γ— $0.0005 per hour:

Cadence Locations Executions/hr Cost
15 min (this template) 2 8 ~$0.004/hr (~$2.90/mo)
5 min (portal default) 5 60 ~$0.03/hr (~$21.90/mo)

The portal default costs more per hour than every other thing Level 2 adds put together. It is the right answer for a revenue-bearing endpoint and the wrong one for a lab β€” knowing which you are looking at is the skill.

</details>

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

Azure RBAC

Contributor on the lab resource group.
Why: workbooks, saved searches and availability tests are all ordinary resources. Monitoring Contributor alone covers every one of them β€” the first chapter where the least-privilege role is genuinely enough.
Microsoft Entra ID roles

None.
Availability tests run from Microsoft-operated regions and need no identity of yours.

For more info β€” Azure built-in roles for monitoring

</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/L2.2-operational-visibility/main.bicepparam
az deployment group create  --resource-group $env:AZURE_RESOURCE_GROUP --parameters curriculum/L2.2-operational-visibility/main.bicepparam

You should see: savedQueryCount of 5. With the availability test on, also availabilityTestExecutionsPerHour of 8 β€” multiply that by $0.0005; the template prints the number so you never have to guess.

Have L1.4’s Front Door standing and want the availability test? It is off by default β€” turn it on explicitly:

$env:CURRICULUM_AVAILABILITY_TEST = "true"



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

Actions β†’ β€œCurriculum L2 - Operations & Monitoring” β†’ Run workflow, then pick L2.2 - Operational Visibility. Tick availability_test only if L1.4’s Front Door is standing β€” it defaults to off.

You should see: Lint β†’ What-if β†’ Deploy, then a run summary carrying the execution count and its cost basis.



Β  Option 3 Β· GitHub Copilot (plain English)

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

Deploy curriculum/L2.2-operational-visibility/main.bicep to my lab resource group ($env:AZURE_RESOURCE_GROUP) with az deployment group create.

Add your own query to the library:

In curriculum/L2.2-operational-visibility/main.bicep, add a saved search to savedQueries that lists the top 10 denied firewall flows by destination in the last hour, add a matching tile to the workbook, run az bicep build, then deploy.

The workbook is a Bicep object serialised with string(), not a pasted JSON blob β€” which is exactly why Copilot can edit it and you can read the diff.



βœ… Verify it

  1. The query library is there β€” this is what a colleague inherits:

    az monitor log-analytics workspace saved-search list `
      -g $env:AZURE_RESOURCE_GROUP -n "log-$env:AZURE_PREFIX-l3" `
      --query "[?category=='L2.2 Operational Visibility'].displayName" -o table
    

    You should see: five names. Find them in the portal under Log Analytics β†’ Logs β†’ Queries.

  2. The workbook renders β€” open Azure Monitor β†’ Workbooks β†’ L2.2 β€” <prefix> estate health.

    You should see: heartbeat and CPU tiles populated from L2.1’s agent data, a firewall verdict chart, and a cost tile. An empty firewall chart means no traffic has crossed the firewall since L2.1 β€” not a broken deployment.

  3. The availability test is bound to Application Insights (only if you turned the test on) β€” the binding is a tag, and getting it wrong is the classic failure:

    az monitor app-insights web-test list -g $env:AZURE_RESOURCE_GROUP -o table
    

    You should see: webtest-<prefix>-frontdoor, enabled. Results appear under Application Insights β†’ Availability within about 15 minutes. If the test exists but the portal shows nothing, the hidden-link tag is missing.

  4. Break it on purpose β€” the only way to know a probe works is to fail one:

    az afd endpoint update -g $env:AZURE_RESOURCE_GROUP `
      --profile-name "afd-$env:AZURE_PREFIX-$(az afd profile list -g $env:AZURE_RESOURCE_GROUP --query '[0].name' -o tsv | ForEach-Object { $_.Split('-')[-1] })" `
      --endpoint-name "fde-$env:AZURE_PREFIX" --enabled-state Disabled
    

    You should see: the availability chart drop to 0% within two probe intervals, from both locations at once β€” which is how you tell a real outage from one bad network path. Re-enable it afterwards with --enabled-state Enabled.


GitHub feature spotlight Β· Dashboards that live in git

You just used it: the workbook is defined as a Bicep object and serialised at compile time, so β€œsomeone changed the dashboard” is a diff with an author and a reason, not a mystery. A workbook edited in the portal is invisible to everyone who was not watching. Find it: the workbookContent variable β€” the queries in it are the same strings as the saved searches, declared once. Beyond the lab: the same argument applies to alert rules, detections and policy. If it changes behaviour, it belongs in a pull request. Docs β†’



➑️ What carries forward

L2.3 turns the queries you just saved into alert rules. The queries that make good dashboard tiles and the ones that make good alerts are not the same set β€” that is the argument the next chapter opens with.


🧭 Where next?

Your situation Go to
Ready to keep going β€” stop having to look L2.3 β€” Proactive Operations
β¬… Back to the main path πŸ—ΊοΈ Curriculum Map
Want the big picture of this level Level 2 Β· Monitor overview
Done for the day β€” the estate bills while idle Cleanup & Reset
Something didn’t work Troubleshooting