Skip to content
Visual explainer 5h to learn 5 steps

Capstone: operate, recover and clean up

Show telemetry, diagnose a failure, restore or roll back, clean up and write the Well-Architected review.

By Invicly Tech, , in Microsoft Azure Cloud Engineering. About 13 minutes to read.

Topic 33 of 33

In short

The last milestone proves you can run what you built. You show health and log evidence, inject a failure and find its cause with a KQL query, roll back or restore, then delete everything and prove it is gone. You finish with a short Well-Architected design review that compares what happened with what you planned.

Explained simply

Building something is half the job. Running it is the other half. In this final milestone you show that you can see what the system is doing, notice when it breaks, find out why, fix it, and then remove everything cleanly. You also write a short review of your own design.

First you collect health evidence. Call the API's health endpoint, upload a test image and check that a thumbnail appears. Then look at the logs and metrics in Azure Monitor. Take screenshots or save command output with timestamps. This is your baseline: what normal looks like.

Next you break something on purpose, in a way you can undo. For example, remove the worker's permission to read the queue, or deploy an image that returns errors. Then act as the on-call engineer: use a KQL query to spot the problem, read the error, and restore service by rolling back or putting the permission back.

Then you practise recovery of data. Delete a test upload and get it back from soft delete. Time how long it takes and compare it with the RPO and RTO you wrote in the design. If you added PostgreSQL, you can also restore it to a point in time, which creates a new server.

Finally you clean up and prove it. Delete the resource group, then check the items that live outside it. Write a one-page review using the five Well-Architected pillars. Note also that Microsoft certifications such as AZ-900, AZ-104 and AZ-305 are optional next steps if you want a formal credential.

Press Play on a diagram to walk through it one step at a time.

CycleThe operate loop you demonstrate
  1. 1
    Observe

    Health endpoint, metrics and request logs look normal

  2. 2
    Break

    Remove the worker's queue role or ship a bad image

  3. 3
    Diagnose

    KQL shows failures, the trace shows a 403

  4. 4
    Recover

    Roll back the revision or restore the blob

  5. 5
    Review

    Record timings against RPO, RTO and the design

  6. Back to step 1
SequenceRolling back a bad API revision
Engineer
Azure CLI
Container Apps
Application Insights
  1. 1Alert: failure rate above 5% on ca-api
    Application Insights to Engineer: Alert: failure rate above 5% on ca-api
  2. 2az containerapp revision list
    Engineer to Azure CLI: az containerapp revision list
  3. 3Read revisions and traffic weights
    Azure CLI to Container Apps: Read revisions and traffic weights
  4. 4Traffic set: previous revision 100%
    Engineer to Azure CLI: Traffic set: previous revision 100%
  5. 5Apply new traffic weights
    Azure CLI to Container Apps: Apply new traffic weights
  6. 6Failure rate back to 0% within minutes
    Application Insights to Engineer: Failure rate back to 0% within minutes

In depth

Show health and log evidence

Good evidence answers three questions: is it up, is it working, and how do you know. Up: curl the /healthz endpoint and record the status and time. Working: upload a synthetic image and list the results container to show the thumbnail. How you know: open Application Insights and show request counts and failures, and show the container apps' console logs in Log Analytics.

Store the commands and outputs in docs/evidence.md. Useful commands include az containerapp revision list to show the active revision, az containerapp logs show with --follow to stream logs, and az monitor app-insights query or the Logs page in the Portal for KQL. Note the Log Analytics table names you see, because Container Apps can send console logs to either a legacy custom table or a diagnostic-settings table depending on how the environment was configured.

  • Up: /healthz returns 200
  • Working: thumbnail appears in results
  • Telemetry: AppRequests and AppDependencies show traffic
  • Logs: console output from both apps
  • Every item timestamped

Diagnose an injected failure

Pick a fault that teaches something and is easy to undo. A strong choice is to remove the worker's Storage Queue Data Message Processor assignment. Uploads still succeed, so the API looks healthy, but thumbnails stop appearing. That mirrors real incidents where the front end is green and the back end is quietly stuck.

Work like an on-call engineer. Start with symptoms: queue length grows, results stop. Check the worker's logs: the SDK reports 403 with error code AuthorizationPermissionMismatch. Check AppDependencies in KQL for failed calls to the queue. Form a hypothesis, then confirm with az role assignment list for the worker's principal. Fix by redeploying Bicep, which restores the assignment, rather than adding it by hand. Record detection time, diagnosis time and fix time.

FlowTriage of the stuck worker
  1. 1
    Symptom

    Uploads OK, no thumbnails, queue length rising

  2. 2
    Logs

    Worker shows 403 AuthorizationPermissionMismatch

  3. 3
    Telemetry

    AppDependencies: failed queue calls since 14:05

  4. 4
    Confirm

    Worker identity lacks the queue processor role

  5. 5
    Fix

    Redeploy Bicep; backlog drains within minutes

Restore or roll back

Code faults are fixed by rollback. In multiple revision mode, move 100 percent of traffic back to the previous healthy revision with az containerapp ingress traffic set, then deactivate the bad one. In single revision mode, run az containerapp update with the previous image tag. Either way, also revert the commit so the pipeline does not redeploy the bad image.

Data faults are fixed by restore. With blob soft delete on, a deleted blob can be undeleted within the retention period; with versioning on, you can promote an earlier version of an overwritten blob. Time both and compare with your RPO and RTO. If you added PostgreSQL, a point-in-time restore creates a new server; you then repoint the app's settings, which is part of your RTO.

  • Rollback: traffic to last good revision, then revert in Git
  • Restore: undelete blob or promote previous version
  • PostgreSQL restore makes a new server; update settings
  • Write down actual times next to targets

Verify cleanup

Delete rg-capstone-dev with az group delete and wait for it to finish. Then verify, do not assume. az group exists should print false. az resource list --tag project=capstone should return an empty list. Delete the deploy identity's resource group, the budget, and the GitHub environment and variables.

Check the soft-delete leftovers. A deleted Log Analytics workspace can be recovered for a period and can be permanently deleted with the force option if you need the name back. A Key Vault, if you added one, stays in a soft-deleted state and may need purging. Finally, check Cost Management a day later: charges should stop. Save the outputs of every check in the evidence file; this is the proof that the cleanup is complete.

Write the design review

Use the Azure Well-Architected Framework's five pillars as headings: reliability, security, cost optimisation, operational excellence and performance efficiency. Under each, write what you planned, what happened, and one change you would make next. Use your evidence, not memory: the measured RTO, the incident timeline, the actual spend.

Keep it to one or two pages. A reviewer should see trade-offs, such as accepting single-region LRS for a lab while naming zone-redundant storage and private endpoints for production. End with optional next steps. Microsoft's AZ-900 (Azure Fundamentals), AZ-104 (Azure Administrator Associate) and AZ-305 (Azure Solutions Architect Expert, which requires the Administrator certification) cover this ground. Exam objectives change, so read the current study guide on Microsoft Learn credentials before you book.

MapDesign review outline
Capstone review
  • Reliability
    • Measured RTO vs 2h target
    • Single region accepted for lab
  • Security
    • No keys or secrets
    • Role table matched deployed roles
  • Cost optimisation
    • Actual spend vs budget
    • Scale to zero for idle apps
  • Operational excellence
    • Pipeline, what-if, evidence
    • Incident timeline
  • Performance efficiency
    • p95 latency under load
    • Worker scale rule

Learn it in 5 short steps

About 1h each. Track them with a timer in your plan.

  1. 1
    Show health and log evidence~1h
  2. 2
    Diagnose an injected failure~1h
  3. 3
    Restore or roll back~1h
  4. 4
    Verify cleanup~1h
  5. 5
    Write the design review~1h

Key points

  • Evidence means screenshots or command output with timestamps, not a statement that it worked.
  • One KQL query over AppRequests should show the failure rate rise and fall.
  • Rollback for code is moving traffic to the last good revision; for data it is a restore.
  • Cleanup is only done when az group exists returns false and the non-group items are gone too.
  • The review covers all five Well-Architected pillars and lists what you would change next.

Key terms

Tap a card to flip it. 0/4 known

Examples

kusto
AppRequests
| where TimeGenerated > ago(2h)
| where AppRoleName == "ca-api"
| summarize total = count(), failed = countif(Success == false),
            p95_ms = percentile(DurationMs, 95) by bin(TimeGenerated, 5m)
| extend failure_pct = round(100.0 * failed / total, 1)
| order by TimeGenerated asc

Failure rate and latency in five-minute bins; the injected fault shows as a spike.

Injected failure, detection and fix with timings

Prerequisites: the stack is deployed and healthy, and you have captured a baseline. Steps: remove the worker's queue role, upload three synthetic images, wait, then diagnose. Evidence: the queue length grows, the worker logs show 403, and the KQL query below shows failed dependency calls. Fix: rerun the pipeline, which recreates the role assignment. Rollback if anything goes wrong: rerun the pipeline again; Bicep is the source of truth.

bash
# Inject (14:05)
az role assignment delete --assignee $WORKER_PID --role "Storage Queue Data Message Processor" \
  --scope $QUEUE_SCOPE
# Observe
az storage message peek --account-name $ST --queue-name jobs --num-messages 5 --auth-mode login
az containerapp logs show -g rg-capstone-dev -n ca-worker --tail 20
# Confirm (KQL in Log Analytics):
#   AppDependencies | where AppRoleName == "ca-worker" and Success == false
#   | summarize count() by ResultCode, bin(TimeGenerated, 5m)
# Fix (14:19): rerun the pipeline
gh workflow run deploy.yml --ref main
az role assignment list --assignee $WORKER_PID --all -o table

Restore a deleted upload, then clean up and prove it

The first half shows data recovery within RPO: delete a blob, list deleted blobs, undelete it and time the restore. The second half is the verified cleanup. Expected evidence: the blob listed again, exists printing false, an empty resource list for the tag, and no leftover deploy identity group.

bash
az storage blob delete --account-name $ST -c uploads -n test-01.jpg --auth-mode login
az storage blob list --account-name $ST -c uploads --include d --auth-mode login -o table
az storage blob undelete --account-name $ST -c uploads -n test-01.jpg --auth-mode login
# with versioning on, instead copy the latest previous version over the blob

# Cleanup
az group delete -n rg-capstone-dev --yes
az group delete -n rg-capstone-cicd --yes
az group exists -n rg-capstone-dev            # expect: false
az resource list --tag project=capstone -o table  # expect: empty
az consumption budget list -o table              # remove the lab budget if listed

Quick reference

  • Baseline first: health 200, thumbnail created, request counts visible, all timestamped.
  • Rollback code: az containerapp ingress traffic set -n ca-api -g RG --revision-weight GOOD_REVISION=100
  • Restore data: az storage blob undelete within the soft-delete retention window.
  • 403 AuthorizationPermissionMismatch from Storage = missing data role, not a network fault.
  • Cleanup proof: az group exists prints false and az resource list --tag project=capstone is empty.
  • Review headings: reliability, security, cost optimisation, operational excellence, performance efficiency.
  • Optional credentials: AZ-900, AZ-104, then AZ-305 (needs Azure Administrator Associate).

Common mistakes

  • Injecting a failure you cannot undo, such as deleting the storage account without soft delete.
  • Deleting the resource group and forgetting the federated identity, budget and subscription-level deployments.
  • Writing the review from memory instead of from the timings and evidence you captured.

Quick quiz

Pick an answer to see if you're right and why.

Question 1

1Uploads succeed but thumbnails stop. The worker logs show 403 AuthorizationPermissionMismatch on the queue. What do you check first?

Question 2

2A new API image returns 500 errors. What is the fastest safe recovery?

Question 3

3Which result proves the main resource group is deleted?

Question 4

4What does a point-in-time restore of Azure Database for PostgreSQL flexible server create?

Question 5

5Which certification requires the Azure Administrator Associate certification first?

0/5 answered

Practice exercises

Try each one yourself first. Use the hint if you get stuck, then compare with the solution.

  1. Exercise 1easy

    Capture a health baseline: health status, one successful upload and thumbnail, the active revision, and request counts for the last hour.

  2. Exercise 2medium

    Inject a bad API image, detect it with the KQL query from this topic, roll back by revision, and record detection, diagnosis and recovery times.

  3. Exercise 3hard

    Finish the capstone: perform a timed blob restore, delete everything, verify every line of your teardown inventory, and write the five-pillar review with measured numbers.

Check yourself

Answer in your head, reveal, then be honest with yourself.

Feel confident about this topic?

Frequently asked questions

Do I need a certification after this path?
No. AZ-900, AZ-104 and AZ-305 are optional. They give a formal credential, and the capstone covers much of their ground, but check the current study guide on Microsoft Learn because objectives change.
Which certification should I take first?
AZ-900 is a beginner exam on cloud concepts and Azure basics. AZ-104 is the hands-on administrator exam. AZ-305 is the architect exam and requires the Azure Administrator Associate certification.
Is it safe to break things on purpose?
In your own lab subscription, yes, if each fault is reversible and the fix is a redeploy from code. Never inject faults into shared or production environments without an agreed plan.
Why do charges continue after I delete the resource group?
Usage is often reported with a delay of up to a day or more. If charges continue beyond that, look for resources outside the group or soft-deleted items with retained data.

Go deeper

ShareXLinkedInWhatsApp