Define the Minimal Service and Its Cost Boundary
A capstone is a delivery with a reviewer, not a longer tutorial. You will build one private request path, split it across three ownership scopes, prove it with positive and negative cases, promote one reviewed plan with one immutable package, break it once on purpose, and hand over the evidence. The result is a small working service plus the record that it behaves as designed.
Keep the required path small enough to finish. One region, one Linux App Service plan, one app, one user-assigned identity, one storage account with one container, one Key Vault, and three private endpoints: the app, the blob service and the vault. The deployment hostname rides the app endpoint as a second record in the same zone, not as another endpoint. A second region, a database and an edge layer are decisions you record and defer, not requirements.
Private means two separate claims, not one. Inbound, the app hostname resolves only inside the virtual network. Outbound, the app reaches blob and vault through private endpoints from its integration subnet. A closed front door says nothing about the back one, so each claim gets its own proof later.
Identity is the only credential on the path. The app presents a user-assigned identity, requests a short-lived token for each service audience, and keeps nothing in its settings except the identity's client id. A stored key would make the entire private network an expensive way to protect a secret that already sits in state.
The public path is closed on purpose, and that closure is a deliverable. Disabling public access on the app turns the default hostname into a name that resolves publicly, connects to a front end, and is refused with a 403. That refusal is the evidence that the private endpoint is the only way in, and it is tested from outside the network rather than assumed.
Prerequisites are account facts, and they fail before Terraform does. A missing provider registration, a regional quota, or an identity that cannot write role assignments will reject a plan that looks correct. Check them in this order, because each one costs more to discover later than the one above it.
| Prerequisite | Why the build stops without it | How to confirm |
|---|---|---|
| Resource providers for Web, Storage, KeyVault, Network, ManagedIdentity | the resource type cannot be created in the subscription | provider list shows each one as registered |
| App Service quota for the chosen SKU in the region | the plan is rejected or silently capped | quota view for the subscription and region |
| Owner or User Access Administrator at the workload scope | resources apply, then every role assignment fails | effective role check before the first plan |
| Authority to create private DNS zones and VNet links | private endpoints come up but nothing resolves | platform-scope permission check |
| A deployment path into the VNet | a closed SCM endpoint rejects the last mile of the release | runner subnet, plus the SCM record in the app zone |
| A budget and an alert owner | cost overrun is discovered after the fact | budget at the subscription or group scope |
Three implementation paths exist, and only one is the reference. Linux App Service on a B1 plan gives a stable private endpoint story and a predictable bill, but no deployment slots. A slot starts at S1, which moves the plan line up and should raise the ceiling with it. Functions Flex Consumption is a valid substitute with a different package path, and Container Apps is out of scope because it adds a cluster, an environment and a second ingress model. If you substitute, record the swap in D1 and adjust the proof set; do not change paths halfway through the build.
A capstone is accepted against deliverables, not intentions. Each row below becomes one artifact in the evidence pack, and the review is a matter of checking that the artifact exists and says what it claims.
| ID | Deliverable | Accepted when |
|---|---|---|
| D1 | Scope and cost record | One region, one hostname, one ceiling and one named owner |
| D2 | Ownership matrix | Every object has one root, one state key and one credential scope |
| D3 | Platform and workload roots | Both apply and destroy without console edits |
| D4 | Proof log | Positive and negative cases recorded with the failing layer named |
| D5 | Promotion record | Plan digest and package digest approved together and applied once |
| D6 | Recovery and cleanup report | One controlled failure recovered, three no-change plans, inventory closed |
Scope is a written boundary, and the exclusions are part of it. A project that says "the private application" cannot fail a test, because nothing is outside the sentence. Name what is in, name what is out, and attach the date of the decision.
| Surface | Included | Excluded |
|---|---|---|
| Inbound | One app hostname, private endpoint, public access disabled | Custom domains, Front Door, WAF |
| Outbound | One integration subnet, private endpoints for blob and vault | On-premises routing, firewall egress inspection |
| Identity | One user-assigned identity for the app, one federated identity for CI | Break-glass accounts, cross-tenant access |
| Data | One container, one secret, one recovery window | Database migration, analytics copies |
| Cost | One plan, three endpoints, three zones, capped logging | Multi-region, paid edge tiers, reserved capacity |
Figure 1 turns the scope into a decision path. The required branch is a private app with private data access; the public branch is a different project with its own approval, because it changes what the negative test is allowed to expect.
%%{init: {'theme':'base','themeCSS':'.edgeLabel .label text, .edgeLabel text, .edgeLabel span { fill:#132440 !important; color:#132440 !important; }','themeVariables': {'primaryColor':'#16476A','primaryTextColor':'#ffffff','primaryBorderColor':'#132440','secondaryColor':'#3B9797','secondaryTextColor':'#ffffff','secondaryBorderColor':'#132440','tertiaryColor':'#c4873b','tertiaryTextColor':'#132440','tertiaryBorderColor':'#132440','lineColor':'#5a6e82','textColor':'#132440','titleColor':'#132440','mainBkg':'#16476A','nodeBorder':'#132440','clusterBkg':'#eef3f7','clusterBorder':'#132440','edgeLabelBackground':'#ffffff','actorBkg':'#16476A','actorTextColor':'#ffffff','actorBorder':'#132440','activationBkgColor':'#3B9797','activationBorderColor':'#132440','signalColor':'#5a6e82','signalTextColor':'#132440','noteBkgColor':'#c4873b','noteTextColor':'#132440','noteBorderColor':'#132440','labelBoxBkgColor':'#a8dede','labelBoxBorderColor':'#132440','labelTextColor':'#132440','loopTextColor':'#132440','altBackground':'#f8f9fa','fontFamily':'DM Sans, sans-serif'}}}%%
flowchart TD
S["Scope record
one region · one hostname · one ceiling"] --> P["Platform root
VNet · subnets · DNS zones"]
P --> A["App Service B1
private inbound only"]
A --> I["User-assigned identity
one per app"]
I --> B["Blob container
private endpoint"]
I --> V["Key Vault secret
private endpoint"]
A --> C{"Public path
still required?"}
C -->|"no"| X["Closed by design
403 recorded from outside"]
C -->|"yes"| R["Separate project
new approval and proof"]
B --> OK["Acceptance review
positive and negative evidence"]
V --> OK
X --> OK
CO["Budget alert at eighty percent
daily cap on logs"] -.-> OK
classDef primary fill:#132440,color:#ffffff,stroke:#0b172b;
classDef secondary fill:#16476A,color:#ffffff,stroke:#0f314a;
classDef ok fill:#3B9797,color:#ffffff,stroke:#2a6f6f;
classDef danger fill:#BF092F,color:#ffffff,stroke:#7a0420;
classDef warn fill:#c4873b,color:#132440,stroke:#8a5a1f;
class S,P,A primary;
class I,B,V secondary;
class C,CO warn;
class OK,X ok;
class R danger;
The cost boundary is two numbers and a list. Set a monthly ceiling in the scope record, an alert at eighty percent of it, and a daily cap on log ingestion, because telemetry is the line item that grows without anyone approving a resource. The list of drivers explains which line moves first when the ceiling is reached.
| Driver | What scales it | Treatment inside the ceiling |
|---|---|---|
| App Service plan | always-on hours for the chosen SKU | one B1 plan, no autoscale |
| Private endpoints | one per endpoint per hour, plus data processed | three endpoints, no per-environment duplicates |
| Private DNS zones | zones, links and query volume | three zones, one link per zone |
| Storage | stored bytes plus operations | one container, soft delete for one week |
| Key Vault | data-plane operations on a standard vault | one secret, no HSM, no key operations |
| Logs and metrics | ingested volume per day | daily cap, short retention, sampled traces |
A ceiling without an owner is a wish. Name the person who receives the alert and the action they take: stop the plan, delete the lab, or approve an increase in writing. For this capstone the reference ceiling is one hundred US dollars per month in one region at list price, and the alert is the control that keeps it honest rather than a forecast.
Naming is part of the boundary. Choose a short project prefix and use it everywhere: resource group, plan, app, storage account, vault, zones, state container and artifact prefix. A name that encodes the environment and the owner makes a resource list readable, and a resource list is what you will reconcile at the end.
Figure 2 is the map the rest of the project tests. Read it from the outside in: the public name stops at the front end, the integration subnet carries outbound traffic, the endpoint subnet holds the private addresses, and the zone strip is what makes the private names resolve at all. Every arrow is a handoff with an owner.
Write the one-sentence contract before the first plan. "A client inside the VNet calls the app over TLS, the app writes one blob and reads one secret as its own identity, and a client outside the VNet gets nothing." If the sentence needs a second "and" for a second data source, the scope grew and the cost table is already wrong.
Partition Identity, State, Artifacts and Data Ownership
Three scopes, three lifetimes. The ops scope holds state and release artifacts and outlives everything. The platform scope holds the network and the DNS zones. The workload scope holds the app, its identity, its data and the grants on that data. A resource that appears in two scopes has two destroy paths, and the faster one wins during an incident.
The state backend must survive the workload it describes. Keep the state account and its containers in the ops scope, with versioning, soft delete and a retention window that covers your rollback window. If the state lives in the resource group you are about to destroy, the destroy plan succeeds and the record of what it removed disappears with it.
State access is a data-plane grant too. Authenticate the backend with Entra rather than an account key, and give the Terraform identity a blob data role on the state container only. An account key in a backend configuration is a secret in a file that every pipeline step can read, and it authorizes every container in the account.
A grant belongs where its target lives. The app identity is created in the workload scope because the app is, and the roles on the blob container and the vault are declared in that same scope because that is where the objects are. The deploy identity is owned by the platform team, so its read grant on the artifact container is declared in the ops scope. Reviewers then find every permission in the root that owns the thing being protected.
One identity per app, and a different identity for Terraform. The app identity cannot read state, cannot assign roles and cannot delete the network. The CI identity authenticates through a federated credential, so there is no client secret to rotate, and its write scope is the two workload roots. A shared identity collapses the review into "whoever can apply can do anything".
Data ownership is a namespace and a retention rule, not a bucket. Name the container for the product and the environment, decide who may delete objects, and set soft delete to a window you can afford to wait out. The application writes; the platform team does not browse; the recovery owner is named in the data record.
| Surface | Owner | Scope and root | State key | Credential | Destroy rule |
|---|---|---|---|---|---|
| State account and containers | platform | ops | ops/bootstrap | Entra data role on the state container | prevent_destroy, retained |
| Release artifacts | build | ops | ops/bootstrap | write on the artifact container | retained for the rollback window |
| VNet, subnets, NSGs | network | platform | platform/prod | network contributor | destroyed last |
| Private DNS zones and links | network | platform | platform/prod | zone contributor | destroyed with the platform |
| App plan and app | application | workload | workload/prod | website contributor | destroyed first |
| User-assigned identity | application | workload | workload/prod | managed identity operator | after its grants are gone |
| Blob container and vault | data | workload | workload/prod | data-plane roles | after the app is gone |
| Role assignments on data | data | workload | workload/prod | user access administrator | before the objects |
The backend is configured in two halves. Put the non-secret values in the backend block and pass the environment-specific ones at init time, so one root can serve a lab and a review without editing files. The state key is the part that must never be shared: two roots on one key produce two reviewers, one lock and alternating plans.
Artifacts are not state and must not share a container. A state container holds the current and historical truth of the infrastructure; an artifact container holds release bytes that must never change. Separate containers mean separate role assignments, separate retention rules and a blast radius that stops at the boundary you drew.
Reading another root's state is a boundary leak. Publish zone ids and subnet ids as outputs, consume them as variables, and let the pipeline pass them between jobs. A remote state data source makes one root depend on the internal shape of another, so a refactor in the platform becomes an outage in the workload.
A duplicate object is worse than a missing one. A missing record fails once and loudly; a duplicated record passes both reviews and then reverts on alternate applies, which looks like provider drift and teaches the team to ignore the plan. If two roots both want to own a DNS record, one of them is wrong.
Figure 3 assigns one owner to every object and turns each cross-scope dependency into a named artifact. The dashed lines are state access, the solid line is a published variable, and the artifact arrow carries bytes rather than permissions.
The mechanics matter more than the picture, because the failures are mechanical. Figure 4 follows the pair from plan to no-change plan and keeps the four usual mistakes on the page: a shared key, a grant in the wrong root, a remote state read, and a destroy order that removes the state before the workload.
%%{init: {'theme':'base','themeCSS':'.edgeLabel .label text, .edgeLabel text, .edgeLabel span { fill:#132440 !important; color:#132440 !important; }','themeVariables': {'primaryColor':'#16476A','primaryTextColor':'#ffffff','primaryBorderColor':'#132440','secondaryColor':'#3B9797','secondaryTextColor':'#ffffff','secondaryBorderColor':'#132440','tertiaryColor':'#c4873b','tertiaryTextColor':'#132440','tertiaryBorderColor':'#132440','lineColor':'#5a6e82','textColor':'#132440','titleColor':'#132440','mainBkg':'#16476A','nodeBorder':'#132440','clusterBkg':'#eef3f7','clusterBorder':'#132440','edgeLabelBackground':'#ffffff','actorBkg':'#16476A','actorTextColor':'#ffffff','actorBorder':'#132440','activationBkgColor':'#3B9797','activationBorderColor':'#132440','signalColor':'#5a6e82','signalTextColor':'#132440','noteBkgColor':'#c4873b','noteTextColor':'#132440','noteBorderColor':'#132440','labelBoxBkgColor':'#a8dede','labelBoxBorderColor':'#132440','labelTextColor':'#132440','loopTextColor':'#132440','altBackground':'#f8f9fa','fontFamily':'DM Sans, sans-serif'}}}%%
flowchart TD
O["Ops scope
state and artifact containers"] --> ST["Backend over Entra
versioning and soft delete"]
PL["Platform plan
VNet · zones · links"] --> Z["Zone ids as outputs
not remote state"]
Z --> W["Workload plan
app · identity · endpoints · grants"]
W --> G{"Grant declared in
the target scope?"}
G -->|"no"| X1["Grant in the identity root
review cannot see it"]
G -->|"yes"| AP["Apply platform first
then the workload"]
AP --> D{"Destroy workload
before ops?"}
D -->|"no"| X2["State removed before
the thing it describes"]
D -->|"yes"| OK["Three no-change plans
exit code 0"]
ST -.->|"one key for two roots"| X3["Alternating plans
one lock, two owners"]
W -.->|"remote state read"| X4["Boundary leak
unreviewable change"]
X3 --> F["Split the key
then re-plan both"]
X4 --> F
classDef primary fill:#132440,color:#ffffff,stroke:#0b172b;
classDef secondary fill:#16476A,color:#ffffff,stroke:#0f314a;
classDef ok fill:#3B9797,color:#ffffff,stroke:#2a6f6f;
classDef danger fill:#BF092F,color:#ffffff,stroke:#7a0420;
classDef warn fill:#c4873b,color:#132440,stroke:#8a5a1f;
class O,PL,W primary;
class ST,Z,AP secondary;
class G,D warn;
class OK ok;
class X1,X2,X3,X4 danger;
class F warn;
A state key is a review boundary. If two people can run apply against the same key at the same time, the lock decides who wins and the plan nobody read becomes the change. Separate keys per scope turn that race into a merge conflict you can discuss.
The identity's name is not its authorization. A principal id that appears in the app's settings proves the identity exists; only the assignment at the target proves the app can read the blob. Record both, side by side, because the first is visible in the plan and the second is the one that fails at runtime.
Promote a Reviewed Plan and Immutable Application Artifact
Promotion is one decision with two digests. The infrastructure plan and the application package travel through the same approval, and the approval names the hash of each. A plan approved against one package digest and applied with another is an unreviewed deployment with a reviewed file name.
Pin the producer, not just the product. Terraform 1.17.1, hashicorp/azurerm 5.13.0 and hashicorp/azuread 3.10.0 belong in the version constraints, in the lock file and in the workflow that runs them. A different CLI or provider produces a different plan from the same configuration, so the record has to name all three.
Modules are pinned the same way. If you reuse one, reference a tag and record the commit it resolves to, because a tag that moves changes the graph without changing your file. The reference build keeps both roots flat, which removes one supply-chain input but not the habit.
| Field | What it records | Why the review needs it |
|---|---|---|
| Commit and tree | the exact configuration reviewed | a branch that moved invalidates the plan |
| Toolchain | CLI and both providers with versions | a different producer makes a different plan |
| Module references | tag or commit for every module | a moved tag changes the graph silently |
| Plan digest | hash of the saved plan file | the applied bytes match the approved bytes |
| Package digest | hash of the normalized zip | the code under test is the code promoted |
| Approver and expiry | a named person and a deadline | approval is for a change, not a season |
| State keys | one key per scope | a shared key erases the boundary |
A saved plan is the only thing you may apply. Run the plan with an output file, hash the file, store it encrypted and short-lived, and apply that exact file after approval. A re-plan after approval is a new change, even when the diff looks identical, because the identity and the data underneath it may not be.
The package is identified by its bytes. Build once in a fixed image, normalize timestamps and file modes, hash the zip, and store it under a name that contains the app, the release, the commit and the digest. Assets that are rebuilt during an apply produce a digest that no longer matches the review, which is the quietest way to ship something nobody approved.
Deployment crosses the same private boundary as traffic. With public access disabled, the deployment hostname is private too, so the pipeline needs a runner inside the VNet and a DNS record for the SCM name in the app zone. A pipeline that plans and applies from a hosted agent will fail at the last step, after a green infrastructure apply.
The app must answer with its version. One route returning the release id and the package digest turns every later test into a comparison instead of an opinion. It also gives the rollback decision a value to check, rather than a deployment status to trust.
Schema and data changes are a separate change. Terraform owns the container and the vault; it does not own the rows or the object layout inside them. A migration is a versioned, backwards-compatible step with its own approval, run once and recorded, not a script that runs on every apply because it happens to live in a provisioner.
Rollback is a digest, not a rebuild. Keep the last few packages and their digests for the rollback window, and make a rollback the act of deploying a known digest. Rebuilding the previous commit during an incident tests the build system at the worst possible moment.
Figure 5 shows the two lanes converging on one approval and one apply. The rejected strip below it is the path most teams drift into: approve a plan, re-plan at apply time, and discover the difference only when the version route reports a digest nobody recognises.
A promotion record is written before the apply and completed after it. The approver, expiry and both digests go in first; the observed version response and the timestamp go in last. A record reconstructed from memory is a story about a deployment, not evidence of one.
The plan artifact is a secret-adjacent file. It can contain variable values in clear text, so encrypt it, restrict its readers, delete it on a schedule and never attach it to a ticket. Treat it the way you treat the state file, because a plan is a snapshot of the same configuration.
Prove the Service Through Positive and Negative Cases
Evidence is a matrix with one variable per row. A positive case proves the service works; a negative case proves the control that is supposed to stop it does. Add the rows before you run them, because a case invented after a failure is a negotiation with the result.
Read the layer from the signal, not from the symptom. A refusal at the front end, a name that resolves publicly, a port that never answers and a data-plane denial all look like "the app is broken" from a laptop. They fail at four different layers, and each one has a different next check.
| ID | Case | Action | Expected | Evidence |
|---|---|---|---|---|
| P1 | Version route | request the health route from inside the VNet | 200 with release id and digest | response body and app log entry |
| P2 | Blob write and read | write one object, read it back | both succeed, same bytes | object name and operation ids |
| P3 | Secret read | app reads the configured secret | value returned, no key in settings | vault audit entry for the identity |
| P4 | Private resolution | resolve app, blob and vault names in the VNet | CNAME into privatelink, RFC 1918 address | resolver output per name |
| N1 | Public app path | request the app hostname from outside | 403 from the front end, no app trace | status code and source network |
| N2 | Public blob path | request the blob endpoint from outside | 403, no data returned | status and error code |
| N3 | Public vault path | request the vault endpoint from outside | 403, firewall refusal | status and error code |
| N4 | Role removed | remove the blob data role, then write | 403 from the data plane | error code and the plan that restores it |
| N5 | Zone link removed | unlink the blob zone, then resolve and write | public address, then a 403 from the public endpoint | resolution, status and app dependency log |
| N6 | Wrong audience | request a token for the wrong resource | 401 before any data call | status and token audience |
Order the probes: name, port, permission, behaviour. A resolver answer proves the name, a completed TLS handshake proves the path, a data-plane call proves the grant, and the version route proves the app. Running them out of order turns a DNS fault into a role investigation, which is how a private application acquires permissions it never needed.
Test the public path from outside and the private path from inside, and never let one stand in for the other. A laptop on a home network can prove the refusal, but it cannot prove the private endpoint; a request from the integration subnet can prove the private path, but it cannot prove the closure. Two source networks, two claims.
Use a resolver, not an application error, to prove DNS. A private name returns a CNAME into the privatelink zone and an address from your VNet range. A public address in the answer means the zone is missing, unlinked, or the client is using a resolver that never sees it, and no role change will fix that.
A refused connection and a refused request are different evidence. A timeout or a reset points at the network path: subnet delegation, an NSG rule or a missing route. A public address followed by a 403 is a DNS fault wearing a firewall's clothes, and a 403 with a permission error points at the data-plane grant. Record which one you observed, because "it failed" collapses the only distinction that matters.
The negative case for permissions must start from a working positive case. Remove the blob role, repeat the exact write that succeeded a minute earlier, and capture the data-plane error. That sequence proves the role was the variable; removing a role on a service that never worked proves nothing.
Telemetry has to show the denial, not hide it. The dependency record should carry the target name, the status code and the identity, so a denied call appears as a dependency failure rather than a generic server error. If the handler turns a 403 into a 500 with no dependency entry, the service is not observable, and the next person will debug the handler instead of the grant.
Propagation is part of the test window. A new data-plane role can take up to ten minutes to become effective, and a 403 inside that window is expected. Put the wait in the test, record the time the assignment was created, and never add a retry loop inside the handler to paper over it.
Figure 6 places the three gates on the path and gives each one a different failure signature. The point of the diagram is the bottom row: the signal tells you which gate to inspect, and inspecting the wrong gate is how a DNS fault becomes an over-broad role.
The evidence flow has one loop, and it is deliberate. Figure 7 runs the positives first, stops if the baseline is broken, runs the negatives, and only then reads the signals. A negative case run against a broken baseline produces a failure that cannot be attributed.
%%{init: {'theme':'base','themeCSS':'.edgeLabel .label text, .edgeLabel text, .edgeLabel span { fill:#132440 !important; color:#132440 !important; }','themeVariables': {'primaryColor':'#16476A','primaryTextColor':'#ffffff','primaryBorderColor':'#132440','secondaryColor':'#3B9797','secondaryTextColor':'#ffffff','secondaryBorderColor':'#132440','tertiaryColor':'#c4873b','tertiaryTextColor':'#132440','tertiaryBorderColor':'#132440','lineColor':'#5a6e82','textColor':'#132440','titleColor':'#132440','mainBkg':'#16476A','nodeBorder':'#132440','clusterBkg':'#eef3f7','clusterBorder':'#132440','edgeLabelBackground':'#ffffff','actorBkg':'#16476A','actorTextColor':'#ffffff','actorBorder':'#132440','activationBkgColor':'#3B9797','activationBorderColor':'#132440','signalColor':'#5a6e82','signalTextColor':'#132440','noteBkgColor':'#c4873b','noteTextColor':'#132440','noteBorderColor':'#132440','labelBoxBkgColor':'#a8dede','labelBoxBorderColor':'#132440','labelTextColor':'#132440','loopTextColor':'#132440','altBackground':'#f8f9fa','fontFamily':'DM Sans, sans-serif'}}}%%
flowchart TD
B["Baseline
in-VNet client and public client"] --> P["Positive cases
version · write · secret read"]
P --> Q{"All positives
pass?"}
Q -->|"no"| X1["Stop
a broken baseline hides the denial"]
Q -->|"yes"| N["Negative cases
public path · zone link · role"]
N --> S{"Signal names
one gate?"}
S -->|"401"| X2["Token audience
or tenant"]
S -->|"403 permission"| X3["Data-plane role
at the wrong scope"]
S -->|"403 firewall or timeout"| X4["DNS, NSG
or zone link"]
S -->|"yes"| E["Evidence pack
one row per case"]
E --> R["Acceptance review
and promotion record"]
X1 --> F["Repair the baseline
then rerun every row"]
classDef primary fill:#132440,color:#ffffff,stroke:#0b172b;
classDef secondary fill:#16476A,color:#ffffff,stroke:#0f314a;
classDef ok fill:#3B9797,color:#ffffff,stroke:#2a6f6f;
classDef danger fill:#BF092F,color:#ffffff,stroke:#7a0420;
classDef warn fill:#c4873b,color:#132440,stroke:#8a5a1f;
class B,P,N primary;
class Q,S warn;
class E,R ok;
class X1,X2,X3,X4 danger;
class F warn;
A test that only checks the happy path is a demo. The negative rows are the product here: they show the closure of the public path, the grant at the target scope, and the difference between a network refusal and an authorization refusal. Keep them in the regression set after the capstone is accepted.
Record the source network with every row. The same URL returns a different answer inside and outside the VNet, so a result without a source is not reproducible. Note the client subnet or the runner name beside the status code, and the next reader can repeat the test instead of trusting the screenshot.
Recover a Controlled Failure and Submit the Evidence
Choose a failure with one owner and one repair. Delete the blob zone link from the platform scope in the portal, which is exactly the kind of drift a busy week produces. The app is unchanged, the role is unchanged, and the name stops resolving to the private address, so the failure cannot be confused with a permission change.
Write the hypothesis before you break anything. Expected: resolution for the storage name returns a public address instead of the private one, the app's write path fails while its health route still answers, the platform plan shows exactly one link to add, and the workload plan shows nothing. A prediction that cannot be wrong is not a test.
| Time | Observer | Layer | Signal to record |
|---|---|---|---|
| t0 | platform | change | zone link deleted in the portal |
| t1 | client in VNet | DNS | storage name resolves to a public address |
| t2 | application | data plane | write fails, dependency record shows the refusal |
| t3 | workload root | plan | no changes, so the app is not the cause |
| t4 | platform root | plan | one link to add |
Recovery is applying the declared state, then proving the path. Apply the platform root, wait for the link and the records, resolve the name again, and repeat the exact write that failed. Then run a no-change plan in every scope: exit code 0 means the drift is gone, and exit code 2 means something still differs from the declaration.
Rollback and recovery are different words. A rollback restores the previous release because the new one is wrong. A recovery restores the intended infrastructure because something changed outside the declaration. Here you performed a recovery, and the record should say so, with the drift named and the change that removed it.
The data recovery decision is separate from the infrastructure fix. The link repair restores reachability, not lost objects. Decide from the data record whether soft delete covers the window, whether a restore is required, and who signs for the loss if it is not. A repair that restores the path and silently accepts data loss is an incomplete recovery.
Cleanup is an inventory, not a destroy. Every row below is checked after the destroy, because a resource group that looks empty in the portal can still hold role assignments, private DNS records, soft-deleted vaults or an artifact container you meant to keep.
| Object | Owner | Action | Check after destroy |
|---|---|---|---|
| App and plan | workload | destroy first | app hostname no longer resolves |
| Private endpoints | workload | destroyed with their targets | endpoint count is zero |
| Role assignments | workload | removed with the objects | no orphan principal grants |
| Storage container | workload | destroyed after the app | account can be deleted |
| Vault and secret | workload | deleted, purge protection decision recorded | name is free or deliberately reserved |
| Zone records and links | platform | destroyed after the workload | zones hold no records |
| VNet and subnets | platform | destroyed last | no peerings or delegations remain |
| State and artifacts | ops | retained until the window closes | versions and digests still readable |
Three nuances decide whether the cleanup is really clean. A soft-deleted vault keeps its globally unique name, so a lab that enables purge protection cannot reuse the name until the window ends. A private DNS zone keeps records after an endpoint is deleted if the zone group was managed by hand. An artifact container with a retention policy refuses deletion until the policy allows it, which is the policy doing its job.
Acceptance is a table a reviewer can close. Every row names the evidence, and the evidence lives in the pack rather than in a chat message. If a row cannot be closed, the project is not failed; it is unfinished, and the row says what is missing.
| ID | Acceptance criterion | Evidence that closes it |
|---|---|---|
| A1 | Public path is closed | 403 from outside the VNet, with the source network recorded |
| A2 | Private name resolves inside | CNAME and private address for app, blob and vault |
| A3 | Identity is scoped | role assignments at container and vault scope, no subscription-wide grant |
| A4 | Data plane works only through the grant | positive write, then a 403 after the role is removed |
| A5 | Integrity of the release | version route reports the digest in the promotion record |
| A6 | Plan is reproducible | applied plan digest matches the approved digest |
| A7 | Failure recovered | timeline, one-link diff, then a no-change plan |
| A8 | Cleanup is complete | inventory checked, retained objects listed with an owner |
Recover a Controlled Failure and Submit the Evidence
Status: design-only. No Azure subscription or credential was used to produce this capstone, and none of these steps were executed here. Versions: Terraform CLI 1.17.1, hashicorp/azurerm 5.13.0, hashicorp/azuread 3.10.0, verified 6 November 2026. Every name, id and address below is something you supply in your own sandbox; nothing here is a recorded output.
Prerequisites. A sandbox subscription, one region, permission to create role assignments, a Linux App Service plan at B1 or above, a storage account with one container, a standard Key Vault, a VNet with an integration subnet delegated to App Service, a separate endpoint subnet and a small runner subnet, plus the three private DNS zones. The app package is a health route and one write route, nothing more.
Setup. Two roots, one state account, one package. The platform root owns the VNet, the zones and the links. The workload root owns the plan, app, identity, storage, vault, endpoints and grants, and consumes the zone ids as variables. Keep the ops scope out of both, because it has to survive them.
| Stage | Action | Pass condition |
|---|---|---|
| Preflight | check providers, quota, role permission and budget | every prerequisite row has a yes |
| Platform apply | create network, zones and links | zones resolve nothing yet, as expected |
| Workload apply | create app, identity, data, endpoints and grants | app reports a version, no public address in use |
| Positive proof | run P1 to P4 from the runner | version, write, secret and resolution all pass |
| Negative proof | run N1 to N6 from the two networks | each signal names the intended gate |
| Promotion | approve both digests, apply the saved plan once | version route matches the record |
| Failure and recovery | break the zone link, observe, restore, reconcile | one-link plan, then no-change plans |
The runbook, in order. Each step leaves an artifact; if a step produces nothing you can attach, it did not happen.
- Record the baseline. Capture the provider versions, the region, the plan SKU, the ceiling and the names you will use. Confirm the provider registrations and the quota before the first plan.
- Apply the platform root. Create the VNet, the three subnets, the three zones and one link per zone. Delegate the integration subnet to App Service, and leave the endpoint subnet with no delegation.
- Apply the workload root. Create the plan and app with public access disabled, attach the identity, create the storage account with public access disabled, create the container, create the vault with RBAC authorization, then add the endpoints and the zone groups.
- Grant and wait. Add the blob data role on the container and the secrets role on the vault, then wait for propagation before the first data call. Record the assignment time, because the wait is part of the test.
- Prove the positives. From the runner, resolve the three names, call the version route, write and read one object, and read the secret. Keep the resolver output and the operation ids.
- Prove the public refusal. From outside the VNet, request the app hostname, the blob endpoint and the vault endpoint. Expect three refusals with different bodies, and record the source network for each.
- Prove the permission boundary. Remove the blob data role, repeat the exact write, and capture the permission error. Restore the role, wait, and repeat the write.
- Prove the DNS boundary. Remove the blob zone link in configuration, apply, then resolve and attempt a write. Record the public address and the refusal from the public endpoint, then restore the link and repeat until resolution is private again.
- Promote. Build the package once, hash it, store it under an immutable name, save the plan, hash the plan, approve both, apply the saved plan, and deploy the same digest. Confirm the version route reports it.
- Break, recover, reconcile, clean. Delete the zone link in the portal as the controlled failure, so the drift is undeclared, follow the timeline, apply the platform root to restore it, then run a no-change plan in all three scopes. Finish with the cleanup inventory.
Expected observation. A sequence, not a duration: three private names resolving inside, three refusals outside, one successful write that turns into a permission error when the role is removed, a public address and a refusal when the link is removed, a version route that matches the approved digest, and a platform plan with exactly one link to add before recovery.
Failure checks. The review fails if the app is reachable from the internet, if the public refusal is a timeout rather than a documented refusal, if the write still succeeds after the role is removed, if the plan digest changes between approval and apply, if the version route reports a digest the record does not contain, if the workload plan changes during the DNS incident, or if any scope still shows a diff at the end.
Cost boundary. One B1 plan, three private endpoints, three zones and links, one storage account with one container, one standard vault and capped log ingestion, against a ceiling of one hundred US dollars per month in one region at list price. The runner exists only for the test window. Confirm current pricing in your region and currency before the apply; the ceiling is a decision, and the alert at eighty percent is how it is enforced.
Cleanup order. Destroy the workload root first, then the platform root, and leave the ops scope until the rollback window closes. Check the endpoint count, the role assignments, the zone records and the soft-deleted vault name, then remove the artifact and state containers and the budget alert. Keep the plan and package digests after the infrastructure is gone.
Evidence to keep. D1 to D6, the provider versions, both plan digests, the package digest, the three resolver outputs, the refusals with their source networks, the permission error, the DNS timeline, the three final no-change plans, the cleanup inventory and the cost actual against the ceiling. Keep the evidence; delete the credentials.
References (verified 6 November 2026):
azurerm_linux_web_app: https://registry.terraform.io/providers/hashicorp/azurerm/5.13.0/docs/resources/linux_web_appazurerm_private_endpoint: https://registry.terraform.io/providers/hashicorp/azurerm/5.13.0/docs/resources/private_endpoint- App Service private endpoints: https://learn.microsoft.com/en-us/azure/app-service/networking/private-endpoint
- Private endpoint DNS zones: https://learn.microsoft.com/en-us/azure/private-link/private-endpoint-dns
- Storage private endpoints: https://learn.microsoft.com/en-us/azure/storage/common/storage-private-endpoints
- Key Vault RBAC: https://learn.microsoft.com/en-us/azure/key-vault/general/rbac-guide
A private application is a set of owned objects with proof at each gate. The project passes when a reviewer can name the owner of every object, see the evidence for every acceptance row, replay the promotion from its two digests, and watch one controlled failure recover without a role change. That is a stronger result than a green apply, and it is the result this capstone asks you to deliver.