Skip to content

Lab 02: Measure flow, quality, security, and delivery

Previous: Lab 01 · Catalog · Next: Lab 03

Scenario, role, and outcome

The team reports activity counts but cannot explain slow delivery or unstable releases. Derive flow and quality measures from a small transparent dataset.

Learner role: Engineering lead. Outcome: Measure flow, quality, security, and delivery.

Item Value
Time 120 minutes
Domain process
Platforms local, github
Cost none — review current pricing and cleanup before cloud execution
Exam blueprint July 27, 2026; sources reviewed October 16, 2026
Verification status offline-tested
Verification scope All five checkpoint commands, final validators and named fault/repair executed in CourseSecurityTelemetry.Tests.ps1 with fail-closed provider doubles. Local calculations, permission/reference/secure-file fixtures and .NET trace behavior are real; live provider calls, federation and telemetry export have not run.

Completion requires all five checkpoints, the break/fix repair, successful independent validation, and a passing residual-resource audit. An unavailable external prerequisite is a visible gate; it does not become a passing result.

Architecture and service topology

Lab 02 service architecture: Delivery observations and the metric review

The collector reads the sandbox Actions run inventory while the exercise computes flow and quality measures from an explicitly synthetic JSON dataset. PowerShell produces a Markdown review with denominators and sample-size limits. The engineering decision follows the measurements; no synthetic value is presented as production telemetry.

The editable Mermaid source and accessible SVG render the same authored components and relationships. Dashed connections show separately gated integrations. Read every boundary before executing commands. Cloud changes stay inside the exact disposable GitHub repository, Azure DevOps project, and Azure resource group recorded for this run. Child objects inherit that cleanup boundary. Account creation, external integrations, and privileged organization settings belong to one-time bootstrap.

Objectives and checkpoints

Coverage levels describe the intended learning evidence: explained means reasoned understanding, practiced means an observable isolated skill, and integrated means skills connected across a delivery boundary. These labels are curriculum claims, not execution status. Verification above records what authors actually ran.

Official objective topic IDs: D1.2.1, D1.2.2, D1.2.3, D1.2.4, D1.2.5, D1.2.6, D1.2.7

Checkpoint Measurable behavior
CP1 Normalize delivery observations
CP2 Calculate flow and recovery measures
CP3 Report testing and security independently
CP4 Inspect workflow durations from the sandbox
CP5 Publish a decision-oriented metric review

The objective map traces every official topic to labs. The Microsoft study guide controls authoritative objective wording and domain weighting.

Inputs, permissions, and read-only preflight

Use PowerShell 7.4+, .NET 10, Git, GitHub CLI, Azure CLI with the Azure DevOps extension, and the pinned repository validation dependencies. Read the permissions matrix and evidence policy. Supply only the accounts needed by this lab. Never put a token, connection string, or private key into a command log, committed YAML, or progress export.

The examples run from the repository root. Choose a fresh lowercase run ID; demo01 is an example, not a reusable shared sandbox. Set bootstrap environment variables for the approved GitHub owner, DevOps organization, subscription, and region. Do not run both guided and automated lanes with the same run ID.

$lab = './labs/02-devops-metrics/scripts/cli'
& "$lab/Preflight.ps1" -RunId 'demo01'
& "$lab/Setup.ps1" -RunId 'demo01' -ProvisionOnly
# After reviewing context, permissions, cost, and cleanup:
& "$lab/Setup.ps1" -RunId 'demo01' -ProvisionOnly -Execute -AcknowledgeCost -AcknowledgeTenantChange
. "$lab/Context.ps1" -RunId 'demo01'

Preflight performs reads only. Provisioning creates fresh run-owned top-level sandboxes and records their exact IDs. Context establishes $RepoRoot, $LabRoot, $WorkRoot, $RunId, $GhRepo, $AdoOrganization, $AdoProject, $SubscriptionId, $Location, and $ResourceGroup. A missing prerequisite or ownership mismatch must stop execution. Local build commands may restore packages and write ignored build output.

Concept primer and design decisions

Lead time includes waiting; cycle time covers active work. Recovery time, change-failure rate, test failures, and security findings have different denominators.

Fix a measurement window and denominator before comparing teams. Deployment frequency counts deployments per interval; change-failure rate counts failed changes divided by changes, while restoration time measures the recovery interval. Lead and cycle time answer different queueing questions.

The supplied observations are synthetic so the calculations are reproducible. They support testing/security/operations conversations without claiming a live enterprise dashboard. Test pass rate can improve while escaped defects worsen, and a shrinking security count can hide ageing critical findings. Use the review to choose one action and one follow-up measure.

Task 1 — Normalize delivery observations

Checkpoint: CP1

Objective Evidence level Observation and limits
D1.2.2 explained Normalize three synthetic completed-change observations; planning/throughput denominator choices are discussed rather than measured from a backlog.
$events=@(
 [pscustomobject]@{change='a';leadMinutes=120;cycleMinutes=70;recoveryMinutes=0;failed=$false;tests=50;failedTests=0;criticalFindings=0},
 [pscustomobject]@{change='b';leadMinutes=240;cycleMinutes=100;recoveryMinutes=30;failed=$true;tests=60;failedTests=1;criticalFindings=2},
 [pscustomobject]@{change='c';leadMinutes=90;cycleMinutes=40;recoveryMinutes=0;failed=$false;tests=55;failedTests=0;criticalFindings=0})
 $events|ConvertTo-Json|Set-Content (Join-Path $WorkRoot 'observations.json')

Expected state: Three explicitly fictional observations separate flow, tests, and findings.

Positive validation:

$e=@(Get-Content (Join-Path $WorkRoot 'observations.json') -Raw|ConvertFrom-Json)
 if ($e.Count -ne 3 -or ($e|Measure-Object leadMinutes -Minimum).Minimum -lt 0) { throw 'Invalid observation data.' }

Negative validation:

$e=@(Get-Content (Join-Path $WorkRoot 'observations.json') -Raw|ConvertFrom-Json)
 if (@($e|Where-Object { $_.cycleMinutes -gt $_.leadMinutes }).Count) { throw 'Cycle time exceeds lead time.' }

Evidence to retain: observations.json marked synthetic.

Common failure and safe retry: Use one time unit and keep observation windows consistent.

Cleanup dependency: retain this checkpoint's evidence until final validation; remove run-owned children before their recorded parent boundary.

Task 2 — Calculate flow and recovery measures

Checkpoint: CP2

Objective Evidence level Observation and limits
D1.2.3 practiced Calculate mean lead and cycle minutes from explicit synthetic duration fields; event timestamps are not supplied.
D1.2.6 practiced Calculate change-failure rate and mean recovery minutes for the failed synthetic change; deployment frequency is not calculated.
$e=@(Get-Content (Join-Path $WorkRoot 'observations.json') -Raw|ConvertFrom-Json)
 $m=[ordered]@{meanLeadMinutes=($e|Measure-Object leadMinutes -Average).Average;meanCycleMinutes=($e|Measure-Object cycleMinutes -Average).Average;changeFailureRate=@($e|Where-Object failed).Count/$e.Count;meanRecoveryMinutes=($e|Where-Object failed|Measure-Object recoveryMinutes -Average).Average}
 $m|ConvertTo-Json|Set-Content (Join-Path $WorkRoot 'flow.json')

Expected state: Mean lead time150min, cycle70min, failure rate1/3, recovery30min.

Positive validation:

$m=Get-Content (Join-Path $WorkRoot 'flow.json') -Raw|ConvertFrom-Json
 if ($m.meanLeadMinutes -ne 150 -or $m.meanRecoveryMinutes -ne 30) { throw 'Flow aggregation incorrect.' }

Negative validation:

$m=Get-Content (Join-Path $WorkRoot 'flow.json') -Raw|ConvertFrom-Json
 if ($m.changeFailureRate -lt 0 -or $m.changeFailureRate -gt 1) { throw 'Failure rate outside fraction range.' }

Evidence to retain: flow.json with the denominator and observation window.

Common failure and safe retry: Count failed deployments, not failed unit tests, in the change-failure numerator.

Cleanup dependency: retain this checkpoint's evidence until final validation; remove run-owned children before their recorded parent boundary.

Task 3 — Report testing and security independently

Checkpoint: CP3

Objective Evidence level Observation and limits
D1.2.4 practiced Sum test and failed-test counts from the three observations; escaped defects and pass-rate trends are not in the dataset.
D1.2.5 practiced Sum critical finding counts from synthetic observations; finding age and reachability are not in this dataset.
$e=@(Get-Content (Join-Path $WorkRoot 'observations.json') -Raw|ConvertFrom-Json)
 $q=[ordered]@{tests=($e|Measure-Object tests -Sum).Sum;failedTests=($e|Measure-Object failedTests -Sum).Sum;criticalFindings=($e|Measure-Object criticalFindings -Sum).Sum}
 $q|ConvertTo-Json|Set-Content (Join-Path $WorkRoot 'quality.json')

Expected state: The quality report records165tests,1failed test,2critical findings.

Positive validation:

$q=Get-Content (Join-Path $WorkRoot 'quality.json') -Raw|ConvertFrom-Json
 if ($q.tests -ne 165 -or $q.failedTests -ne 1 -or $q.criticalFindings -ne 2) { throw 'Quality aggregation mismatch.' }

Negative validation:

$q=Get-Content (Join-Path $WorkRoot 'quality.json') -Raw|ConvertFrom-Json
 if ($q.failedTests -gt $q.tests) { throw 'Test failure count exceeds executed tests.' }

Evidence to retain: Separate test and security counters, without person rankings.

Common failure and safe retry: Avoid interpreting scan count as vulnerability count; deduplicate by stable alert identity.

Cleanup dependency: retain this checkpoint's evidence until final validation; remove run-owned children before their recorded parent boundary.

Task 4 — Inspect workflow durations from the sandbox

Checkpoint: CP4

Foundation/supporting task; no additional exam-objective coverage is claimed.

$runs=gh run list --repo $GhRepo --limit 20 --json databaseId,status,conclusion,createdAt,updatedAt,workflowName
 $runs|Set-Content (Join-Path $WorkRoot 'workflow-runs.json')
 $r=@($runs|ConvertFrom-Json);[pscustomobject]@{observedRuns=$r.Count;completed=@($r|Where-Object status -eq 'completed').Count}

Expected state: A real run inventory is collected; a new sandbox may correctly contain zero runs.

Positive validation:

$r=Get-Content (Join-Path $WorkRoot 'workflow-runs.json') -Raw|ConvertFrom-Json -NoEnumerate
 if ($null -eq $r) { throw 'Workflow API did not return a JSON collection.' }

Negative validation:

$r=@(Get-Content (Join-Path $WorkRoot 'workflow-runs.json') -Raw|ConvertFrom-Json)
 if (@($r|Where-Object { $_.status -eq 'completed' -and -not $_.conclusion }).Count) { throw 'Completed runs require conclusions.' }

Evidence to retain: Observed inventory and explicit zero-data status.

Common failure and safe retry: A zero-run sandbox is missing telemetry, not a successful pipeline.

Cleanup dependency: retain this checkpoint's evidence until final validation; remove run-owned children before their recorded parent boundary.

Task 5 — Publish a decision-oriented metric review

Checkpoint: CP5

Objective Evidence level Observation and limits
D1.2.1 explained Write a Markdown delivery review from flow.json; a live or queryable dashboard is not configured.
D1.2.7 explained Discuss why service operations/SLO evidence differs from this three-change review; no live operations signal is queried.
$flow=Get-Content (Join-Path $WorkRoot 'flow.json') -Raw|ConvertFrom-Json
 $review=@("# Synthetic delivery review","Mean lead time: $($flow.meanLeadMinutes) minutes","Observed change failure rate: $($flow.changeFailureRate)","Action: investigate change b; improve failing test and critical findings before increasing release frequency.","Limit: three synthetic changes; no production SLO claim.")
 $review|Set-Content (Join-Path $WorkRoot 'review.md')

Expected state: A review ties a metric to one concrete improvement and its sample-size limit.

Positive validation:

$r=Get-Content (Join-Path $WorkRoot 'review.md') -Raw
 if ($r -notmatch 'Action:' -or $r -notmatch 'Limit:') { throw 'Review lacks action or uncertainty.' }

Negative validation:

$r=Get-Content (Join-Path $WorkRoot 'review.md') -Raw
 if ($r -match '100% production reliability') { throw 'Unsupported reliability claim.' }

Evidence to retain: review.md and the raw synthetic observation set.

Common failure and safe retry: Report the sample size and distinguish delivery metrics from service SLO measurements.

Cleanup dependency: retain this checkpoint's evidence until final validation; remove run-owned children before their recorded parent boundary.

Deterministic break/fix

Run the journaled operation after all five checkpoints. It proves the healthy assertion, injects the named fault, requires its rejection, repairs it, and proves health again. Provider doubles used in author tests are not live enforcement evidence.

& './labs/02-devops-metrics/scripts/cli/BreakFix.ps1' -RunId 'demo01' -Execute

Expected rejection marker: AZ400-L02-FAULT. The assertion must catch the changed behavior, not merely an exception from an unavailable CLI.

Inspect the independent assertion:

$e=@(Get-Content (Join-Path $WorkRoot 'observations.json') -Raw|ConvertFrom-Json)
if(@($e|Where-Object {$_.cycleMinutes -gt $_.leadMinutes -or $_.cycleMinutes -lt 0}).Count){throw 'AZ400-L02-FAULT'}

Fault trigger (executed by BreakFix):

$e=Get-Content (Join-Path $WorkRoot 'observations.json') -Raw|ConvertFrom-Json;$e[0].cycleMinutes=999;$e|ConvertTo-Json|Set-Content (Join-Path $WorkRoot 'observations.json')

Diagnose the precise difference:

Get-Content (Join-Path $WorkRoot 'observations.json') -Raw|ConvertFrom-Json|Where-Object { $_.cycleMinutes -gt $_.leadMinutes }

Repair (executed by BreakFix):

$e=Get-Content (Join-Path $WorkRoot 'observations.json') -Raw|ConvertFrom-Json;$e[0].cycleMinutes=70;$e|ConvertTo-Json|Set-Content (Join-Path $WorkRoot 'observations.json')

Optional job-style challenge

Replace synthetic changes with a redacted dataset and preserve denominators, time zones, null values, and statistical limitations.

Final validation and result interpretation

& './labs/02-devops-metrics/scripts/cli/Validate.ps1' -RunId 'demo01'

A complete result requires five passing read-only checkpoint assertions, a journaled repaired fault, and any required integration evidence. Pending hosted runs, missing licensed features, and unexecuted integration lanes remain visible. Review validation.json; successful command exit alone does not establish the asserted behavior.

Troubleshooting

  • 401/403: inspect the explicit account/project/repository scope and required role; do not broaden a token reflexively.
  • Resource or artifact missing: confirm the exact run ID and prerequisite checkpoint; retry reads after eventual consistency.
  • Unsupported SKU/runtime/tool: consult the specific current source, record the gate, and obtain approval before changing cost or architecture.
  • Validation mismatch: inspect the positive and negative assertions separately, repair the named fault, and rerun validation.
  • Ownership refusal: stop; never edit a manifest to claim an unrelated resource.

Cleanup and residual checks

& './labs/02-devops-metrics/scripts/cli/Cleanup.ps1' -RunId 'demo01'
# Review the exact owned-object deletion plan first.
& './labs/02-devops-metrics/scripts/cli/Cleanup.ps1' -RunId 'demo01' -Execute

Cleanup must verify ownership, delete only recorded sandbox objects in dependency order, and prove parent/child absence. Retain run.json, validation.json, and cleanup.json locally until the audit passes. Soft-deleted or deliberately retained items must remain reported. Never purge a shared vault or delete an account, organization, or pre-existing service connection to finish a lab.

Exam debrief and assessment

Explain why each checkpoint's denied path matters, which scope authorizes it, what evidence proves it, and how it is reversed. Complete the 50-question assessment, then review rationales and repeat weak checkpoints.

Microsoft and platform sources

Lifecycle scripts and worked solution

Use scripts/cli/Preflight.ps1, Setup.ps1, BreakFix.ps1, Integration.ps1 (capstones), Validate.ps1, Cleanup.ps1, and Context.ps1 from this lab folder. Setup and cleanup preview until -Execute; -ProvisionOnly creates only fresh ownership-tracked containers. The worked solution lists expected results and repair reasoning.