L1.3 β€” Multi-Service Application Architecture 🟠

πŸ“ Level 1 Β· Deploy Β· Chapter 3 of 4 Β Β·Β  Previous: L1.2 β€” Architecture Expansion Β Β·Β  Next: L1.4 β€” Production-Ready Platform


Goal: modernize the app tier β€” Azure Container Apps instead of VMs, an Azure SQL backend, Key Vault and a managed identity for secrets, and Log Analytics / Application Insights monitoring with an email alert. This is where private networking arrives: SQL and Key Vault have public access disabled and are reachable only through private endpoints.

Who this is for Time You need first Cost while it runs
Lab 3 of 4 · everyone ~20 min L1.1 deployed. L1.2 is not required. 🟠 ~$1.73/hr running total

[!IMPORTANT] L1.1 must already be deployed β€” L1.3 peers a new spoke to L1.1’s hub. It also uses a SQL admin password, and that’s automatic: the SQL_ADMIN_PASSWORD secret on your fork, or a random one generated for the run when that secret is not set. Set the secret before L1.3 if you want L1.4’s second server to share the same password. (Self-hosted: the SQL_ADMIN_PASSWORD you set in lab-settings.csv back in L1.1.)

What you’re building

flowchart LR
  YOU(["You"])
  HUB["vnet-iacdemo-hub<br/>from L1.1"]

  subgraph SPOKE2["vnet-iacdemo-spoke2 Β· 10.2.0.0/16 Β· NEW in L1.3"]
    subgraph ACA["snet-aca 10.2.0.0/23 Β· delegated to Microsoft.App"]
      APP["ca-iacdemo-web<br/>cae-iacdemo-l3<br/>public ingress<br/>managed identity"]
    end
    subgraph PE["snet-private-endpoints 10.2.2.0/24"]
      PESQL["private endpoint<br/>to SQL"]
      PEKV["private endpoint<br/>to Key Vault"]
    end
  end

  SQL["sql-iacdemo-xxxxxx<br/>Azure SQL Basic<br/>public access DISABLED"]
  KV["kv-iacdemo-xxxxxx<br/>Key Vault, RBAC<br/>public access DISABLED"]
  DNS["private DNS zones<br/>linked to spoke2 only"]
  MON["log-iacdemo-l3 + appi-iacdemo-l3<br/>alert: replicas >= 2 for 15 min"]

  SPOKE2 <-->|"VNet peering to L1.1's hub"| HUB
  YOU -->|"HTTPS, public ingress<br/>does NOT pass through the firewall"| APP
  APP --> PESQL --> SQL
  APP --> PEKV --> KV
  DNS -.->|"resolves privatelink names<br/>for workloads inside spoke2"| PE
  APP --> MON
  YOU -. "BLOCKED, public access disabled" .-> SQL

  classDef net fill:#eef4ff,stroke:#4472c4,color:#1a1a1a
  classDef compute fill:#eefaf0,stroke:#3a9d5d,color:#1a1a1a
  classDef data fill:#f5eefc,stroke:#7c4dbe,color:#1a1a1a
  classDef blocked fill:#fdecea,stroke:#c0392b,color:#1a1a1a
  class PESQL,PEKV,DNS,HUB net
  class APP,MON compute
  class SQL,KV data

Text description of this diagram</summary>

L1.3 creates a second spoke β€” vnet-iacdemo-spoke2 (10.2.0.0/16) β€” and peers it to L1.1’s hub. It does not reuse L1.1’s spoke, and it does not route through L1.2’s firewall: this stack branches off the hub on its own. L1.2 is not a prerequisite.

The spoke holds two subnets. snet-aca (10.2.0.0/23) is delegated to Microsoft.App/environments and runs the Container Apps environment and the web app. snet-private-endpoints (10.2.2.0/24) holds one private endpoint for SQL and one for Key Vault.

Both data services have public network access disabled, so a connection from your laptop fails. The app reaches them over private endpoints using its managed identity. The private DNS zones are what make that work β€” they resolve the privatelink hostnames to private addresses, and they are linked to spoke2 only, so the name resolves privately from inside that VNet and nowhere else.

One thing worth being explicit about: the container app itself is publicly reachable (ingressExternal: true). β€œPrivate networking” here applies to the data tier, not the front door.

</details>

Source: curriculum/L1.3-multi-service-application/main.bicep Β· curriculum/L1.3-multi-service-application/main.bicepparam

[!NOTE] Why a second spoke instead of reusing L1.1’s? Because these workloads have different needs. The Container Apps environment requires a subnet delegated to Microsoft.App/environments β€” Azure hands that subnet over and you can’t put anything else in it β€” and the private endpoints want their own space. Giving L1.3 its own spoke off the same hub is the standard pattern: shared services in the hub, each workload in its own spoke, none of them entangled.

It also means L1.3 doesn’t depend on L2. If you tore the firewall down to save money, this lab still works.


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

All three deploy the same template and give the same result.



1 Β· Bicep CLI
Copy-paste in the terminal


2 Β· GitHub Actions
One button in the browser


3 Β· GitHub Copilot
Ask AI in plain English



[!NOTE] 🏫 Classroom: use Option 2 (GitHub Actions). Your Azure account holds Reader, so the local az deployment commands in Options 1 and 3 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.

Β  Option 1 Β· Bicep from the terminal

Best if you like the command line (self-hosted only). Your values are already loaded from lab-settings.csv (set up in L1.1) β€” nothing to re-type.

az deployment group what-if --resource-group $env:AZURE_RESOURCE_GROUP --parameters curriculum/L1.3-multi-service-application/main.bicepparam
az deployment group create  --resource-group $env:AZURE_RESOURCE_GROUP --parameters curriculum/L1.3-multi-service-application/main.bicepparam

You should see: an appUrl output ending in .azurecontainerapps.io. The alert email goes to whatever you put in the ALERT_EMAIL column.



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

Best if you’d rather click a button. Classroom forks are pre-wired β€” nothing to set up; self-hosted needs the one-time Setup-Oidc.ps1 (Deployment Guide).

On GitHub: Actions β†’ β€œCurriculum L1.3 - Multi-Service Application” β†’ Run workflow (or gh workflow run curriculum-l1-3-multi-service-application.yml).

You should see: Lint β†’ What-if β†’ Deploy, then a final step printing the app URL.



Β  Option 3 Β· GitHub Copilot (plain English)

Best if you’d rather describe the change and have AI edit and deploy it. The deploy step is self-hosted only (classroom accounts hold Reader).

Copilot runs the deploy locally, so (self-hosted) load your values once first (same file as Option 1): ./scripts/Load-LabSettings.ps1.

Open Copilot Chat β†’ Agent mode:

Deploy curriculum/L1.3-multi-service-application/main.bicep to my lab resource group ($env:AZURE_RESOURCE_GROUP) with az deployment group create.

Want to scale it first? Ask:

In curriculum/L1.3-multi-service-application/main.bicep, raise maxReplicas to 5 and add an env var GREETING=Hello L1.3 to the container, run az bicep build, then deploy.

Copilot edits, verifies, and deploys β€” and fixes any error you paste back.



βœ… Verify it

  1. The app is up β€” open the appUrl from the deploy output, or fetch it:

    az containerapp show -g $env:AZURE_RESOURCE_GROUP -n "ca-$env:AZURE_PREFIX-web" `
      --query "properties.configuration.ingress.fqdn" -o tsv
    

    You should see: the Container Apps quickstart page. Note that this front end is deliberately public β€” the private networking in this lab protects the data tier, not the app.

  2. SQL is unreachable from outside β€” from your machine:

    $SQL = az sql server list -g $env:AZURE_RESOURCE_GROUP `
      --query "[?starts_with(name, 'sql-$env:AZURE_PREFIX-')].name | [0]" -o tsv
    nslookup "$SQL.database.windows.net"
    

    You should see: the name resolve to a public address, and any connection attempt refused β€” public network access is disabled. Resolution working while connection fails is the expected split.

  3. The same name resolves privately from inside the spoke β€” this is the half that proves private endpoints work, and it has to run inside the VNet, because the private DNS zones are linked to spoke2 only:

    az containerapp exec -g $env:AZURE_RESOURCE_GROUP -n "ca-$env:AZURE_PREFIX-web" `
      --command "getent hosts $SQL.database.windows.net"
    

    You should see: a 10.2.2.x address β€” inside snet-private-endpoints. Same hostname, different answer depending on where you ask. That is exactly what a private endpoint plus a private DNS zone does, and why running this from L1.1’s Bastion VM would fail: it sits in a different VNet with no link to those zones.

  4. Monitoring fires β€” scale up and wait for the alert:

    az containerapp update -g $env:AZURE_RESOURCE_GROUP -n "ca-$env:AZURE_PREFIX-web" --min-replicas 2
    

    You should see: a HighReplicaCount email at your ALERT_EMAIL within about 15 minutes β€” the rule evaluates over a 15-minute window. Scale back down afterwards with --min-replicas 1 so you stop paying for the second replica.

GitHub feature spotlight Β· OIDC federated credentials

You just used it: if you deployed with Option 2, GitHub deployed private networking into your Azure subscription and there is no cloud password stored anywhere β€” not in the repo, not in a secret, not on your machine. The workflow asked GitHub for a signed token describing itself, and Entra ID traded it for a short-lived Azure token. Find it: Settings β†’ Secrets and variables β†’ Actions on your fork β€” and find no Azure credential. At most there are the three IDs that name the deploy identity (they unlock nothing on their own) and any VM or SQL password you chose. What actually grants access is the federated trust between GitHub and Entra ID itself β€” which is a relationship, not a value anyone could read or leak. The missing password is the lesson. Beyond the lab: this is the modern answer to the oldest problem in CI. Nothing to leak, nothing to rotate, and a fork can’t use it β€” its token names a different repository, so the subject check fails. Docs β†’



➑️ What carries forward

L1.4 treats everything you just built as the primary region. It adds a second-region copy of the app, joins your SQL database to a failover group, and puts Azure Front Door in front of both β€” then asks whether the result would actually survive an outage.

🧭 Where next?

Your situation Go to
Ready to keep going β€” a second region and a global front door L1.4 β€” Production-Ready Platform
Want the big picture of Level 1 Level 1 Β· Deploy overview
β¬… Back to the main path πŸ—ΊοΈ Curriculum Map
Done for the day β€” the estate bills while idle Cleanup & Reset
Something didn’t work Troubleshooting