Skip to content

C5: Deploy the CoE archetype with APEX

  • Day 1
  • Member challenge
  • 90 min

The modernized app needs somewhere to run. The CoE archetype is that place: App Service, a container registry, SQL Managed Instance, Blob, Service Bus, Key Vault and Application Insights, built to the landing zone’s policies. In C5 you adapt it to your spoke with the APEX skill and deploy it with azd.

Business context. Priya, the head of IT operations, wants every environment built the same way, from code, so nobody rebuilds one by hand again. C5 deploys the platform the app will run on.

Business outcome. Repeatable provisioning. The platform is deployed from the repo and documented as built, and every data service is private.

Objective. Be able to adapt and deploy a reference platform into a governed spoke, and check that it is private and policy-compliant.

Time and scope. Day 1, 13:15 demo (13:45 hands-on), 90 min (30 min demo + 60 min hands-on), Member. C6 starts at 14:45. The 60 minutes are your hands-on time. The waits aren’t: azd provision takes about 20 minutes (22 min 59 s on 2026-10-08 and 20 min 2 s on 2026-10-20 in the build tenant) and As-Built about 30 minutes (17:11 to 17:41 UTC on 2026-10-08). Use both waits to start C6.

Starting point. The spoke your team lead vended for you at Step 4 (T-1), with your Entra object ID (C2 tested its policy guardrails and connectivity). C4’s target-state decisions. Your own repo (C:\src\<your-repo> on main on vm-dev01).

Fixed by the kit. The archetype’s shape and its Bicep template in infra/bicep/university/. The deployment uses azd (the Azure Developer CLI, preinstalled on vm-dev01).

You decide. Nothing about the shape. You review the preview before you deploy.

The highlighted parts are what C5 adds to the spoke that vending created at T-1: the resources in rg-university-<suffix>, their private endpoints in snet-pe, the web app’s VNet integration and the SQL Managed Instance in snet-sqlmi.

Highlighted: what C5 deploys. n is your member index and the suffix is yours from settings.
Text version of the diagram
  • Management groups: mg-factory contains mg-factory-platform (the shared services subscription) and mg-factory-corp (every member's workload subscription and the core policies). C2 verifies them.
  • Shared services subscription, one per team (C2). Resource group rg-hub holdsvnet-hub (10.100.0.0/16) with Azure Firewall Standard afw-hub (10.100.0.4, DNS proxy, rules in afwp-hub), and the four central private DNS zones for Blob, Service Bus, ACR and Key Vault. Resource group rg-management holds the Log Analytics workspacelog-management and the identity id-sqlmi-directory, which every member's SQL Managed Instance uses.
  • Member workload subscription, one per member (n ≥ 1: 10.10.n.0/24 and 10.20.n.0/24 for n = 1 to 255, or 10.(127 + floor(n/256)).(n%256).0/24 in 10.128.0.0/10 and 10.(191 + floor(n/256)).(n%256).0/24 in 10.192.0.0/10 for n ≥ 256). Resource grouprg-datacenter (built in the readiness check) holds vnet-datacenter (10.10.n.0/24). Subnetsnet-servers (10.10.n.0/25) has vm-app01 (10.10.n.4, the legacy app and SQL Server) and vm-dev01 (10.10.n.5, your workstation). AzureBastionSubnet(10.10.n.192/26) has Bastion Standard bas-datacenter. A NAT gatewaynat-datacenter provides outbound internet.
  • Resource group rg-spoke (vended at T-1) holds vnet-spoke (10.20.n.0/24) withsnet-app (10.20.n.0/26, web app VNet integration), snet-pe (10.20.n.64/26, private endpoints) and snet-sqlmi (10.20.n.128/26, SQL Managed Instance).
  • Resource group rg-university-<suffix> (C5) holds the archetype: an App Service plan (P0v3) and web app with a public HTTPS front end, a container registry, a SQL Managed Instance, Blob Storage (container teaching-materials), Service Bus (queuenotifications), Key Vault, Application Insights and the web app's managed identity. Registry, storage, Service Bus and Key Vault are reached through private endpoints insnet-pe. Application Insights ingestion stays public, allowed by a firewall rule.
  • Network flows (C2): the datacenter and the spoke each peer with the hub and send traffic throughafw-hub by user-defined routes. Both VNets use afw-hub as DNS server.
  • C7: the MI link runs from vm-app01 through afw-hub tosnet-sqlmi on TCP 5022 and 11000–11999. The datacenter and the spoke aren't peered with each other.
  • C7 and C8: from vm-dev01 you reach the private endpoints (TCP 443 and 5671) and the SQL Managed Instance (TCP 1433 and 11000–11999) through afw-hub.
The CoE archetype uses the network that vending created. The spoke holds subnets for the app, private endpoints and SQL Managed Instance. The resource group rg-university holds the web app, container registry, Blob Storage, Service Bus, Key Vault, SQL Managed Instance, App Service plan, Application Insights and the app's managed identity.
Where the archetype's resources sit in your spoke. Open full size
  1. Watch the coach’s demo of the archetype’s shape and the /apex-adapt-archetype flow.

  2. Confirm the archetype is in your repo. vm-dev01 · C:\src\<your-repo> In C:\src\<your-repo> on vm-dev01, confirm agent-output/university/, infra/bicep/university/ and .github/skills/apex-adapt-archetype/ exist at the repo root. If they don’t, run ./factory/archetype/Import-Archetype.ps1 from C:\src\<your-repo>.

    Run git status --short -- infra/bicep/university before making C5 edits. It must print nothing: if C2’s insecure registry.bicep edit remains, restore that file with git restore --source=HEAD -- infra/bicep/university/modules/registry.bicep.

  3. Run the /apex-adapt-archetype skill on vm-dev01: vm-dev01 · C:\src\<your-repo> Copilot Chat (Agent)

    1. Sign in to azd first, in PowerShell 7 (pwsh): azd auth login --use-device-code. azd keeps its own sign-in, separate from az login, and the skill stops without it. Skip this only if azd already says you’re signed in.
    2. Open Copilot Chat, set the mode to Agent (the built-in one, not 01-Orchestrator) and type /apex-adapt-archetype. It reads your tenant ID, subscription ID and suffix from factory/.local/settings.json and asks you to confirm them. It checks that a spoke is already vended, runs a lightweight live governance check, creates an azd environment named after your suffix, and stops at azd provision --preview.

    Done when the skill shows the preview: its output ends with a list of the resources azd would create, and no error. Review the resource names for your suffix before deploying.

  4. Review the preview, then deploy for real. vm-dev01 · C:\src\<your-repo>\infra\bicep\university (pwsh) Review the preview the skill showed in Copilot Chat, then switch from chat to a PowerShell 7 (pwsh) terminal on vm-dev01.

    Before you deploy: SQL MI licence check. The template defaults to Azure Hybrid Benefit. If you do not have eligible SQL Server licences with Software Assurance or subscription rights, set var licenseType = 'LicenseIncluded' in the working infra/bicep/university/modules/sql-mi.bicep before preview/deployment. Read Azure Hybrid Benefit and the archetype README.

    Run on: PowerShell 7 on vm-dev01. Preflight exports process variables needed by azd. Keep this same shell open for any new preview and for deployment:

    vm-dev01 — C:\src<your-repo>\infra\bicep\university (pwsh)
    cd C:\src\<your-repo>\infra\bicep\university
    $s = Get-Content ..\..\..\factory\.local\settings.json | ConvertFrom-Json
    ./scripts/preflight.ps1 -TenantId $s.tenantId -SubscriptionId $s.subscriptionId -Suffix $s.suffix

    If it fails: Stop and resolve the preflight error before continuing. If inputs or templates changed since the skill’s preview (including the licence choice), rerun azd provision --preview in that same shell and review the new output. Otherwise use the skill’s reviewed preview; don’t repeat it.

    Run azd provision in that same shell only when you accept the reviewed changes. Provisioning waits until the SQL Managed Instance is created: about 20 minutes, so keep that terminal open. You can start C6 in another VS Code chat while it runs.

    Expected result: azd provision returns without an error and rg-university-<suffix> exists.

  5. Run As-Built. vm-dev01 · Copilot Chat (08-As-Built) When azd provision returns, in Copilot Chat in C:\src\<your-repo>, pick the 08-As-Built agent in the chat input area and send Document the deployed state of the university project. If azd’s output printed an apex-recall ... command to run first, run that line in the terminal where azd ran. It takes about 30 minutes: continue C6 meanwhile. Done when the agent-output/university/07-*.md As-Built suite exists (for example 07-documentation-index.md).

  6. Confirm the deployment and commit agent-output/university/, vm-dev01 · C:\src\<your-repo>\factory (pwsh) with your suffix:

    vm-dev01 — C:\src<your-repo>\factory (pwsh)
    cd C:\src\<your-repo>\factory
    $s = Get-Content .local/settings.json | ConvertFrom-Json
    az resource list -g rg-university-$($s.suffix) -o table
    az storage account show -g rg-university-$($s.suffix) -n stuniversity$($s.suffix) --query publicNetworkAccess -o tsv
    az keyvault show -n kv-university-$($s.suffix) --query properties.publicNetworkAccess -o tsv
    az servicebus namespace show -g rg-university-$($s.suffix) -n sbns-university-$($s.suffix) --query publicNetworkAccess -o tsv
    az acr show -n cruniversity$($s.suffix) --query publicNetworkAccess -o tsv
    $id = az identity show -g rg-university-$($s.suffix) -n id-university-$($s.suffix) --query principalId -o tsv
    az role assignment list --assignee $id --all -o table

    Commit the generated agent-output/university/06-deployment-summary.md and 07-*.md files (after redacting any raw subscription or tenant GUIDs) on main:

    vm-dev01 — C:\src<your-repo> (pwsh)
    cd C:\src\<your-repo>
    git pull --rebase
    git add agent-output/university
    git commit -m "docs: C5 archetype deployment summary and as-built"
    git push

    Done when there are no public endpoints other than the web app’s front end and Application Insights ingestion (the four publicNetworkAccess values are Disabled), every resource name follows the convention in the naming and IP plan, and the web app’s managed identity (id-university-<suffix>) holds six roles: AcrPull, Storage Blob Data Contributor, Azure Service Bus Data Sender, Azure Service Bus Data Receiver, Key Vault Secrets User and Monitoring Metrics Publisher.

To complete this challenge, check your work in C:\src\<your-repo> on main:

  • agent-output/university/06-deployment-summary.md and the agent-output/university/07-*.md As-Built suite committed on main (with any subscription, tenant and object IDs redacted).
  • az resource list -g rg-university-<suffix> -o table showing every expected resource with private endpoints and publicNetworkAccess set to Disabled on data backends.
  • Outcome check: show Priya that the platform came from the repo: the deployment summary and the As-Built record match what is in the resource group.

For technical blockers, check Troubleshooting before asking your coach.

/apex-adapt-archetype won’t find a vended spoke

It looks for rg-spoke, vnet-spoke, snet-app, snet-pe and snet-sqlmi by the naming convention in the naming and IP plan. Confirm Step 4: Vending and C2 requirement 3’s connectivity check passed before retrying. If the spoke is missing, your team lead runs the vending stage for you; members can’t.

Preflight says the managed identity “cannot be read” or lacks the assign permission

Your vending ran without your Entra object ID, so you don’t have Managed Identity Operator on id-sqlmi-directory. Only the team lead can fix it: ask them to rerun Step 4: Vending for you after checking the private roster. This message comes from the archetype’s own ./scripts/preflight.ps1, not the readiness check’s preflight.

Preflight says a SQL virtual cluster holds snet-sqlmi

A managed instance was deleted from your spoke earlier, and Azure releases its virtual cluster later (this can take hours). Wait and retry, and ask your coach before you delete anything.

azd provision --preview looks incomplete

The preview only lists resource types azd has display names for: it’s expected to omit the SQL Managed Instance, the managed identity, role assignments, diagnostic settings and the maintenance schedule even though they’re all in the template and will be created.

If you need to start over

To redeploy, run /apex-adapt-archetype and then azd provision again, as in requirements 3 and 4. The deploy.ps1 fallback works without the agent or azd: see the APEX guide.

Next: C6: Modernize with GitHub Copilot.