Skip to content

Delivery Model: How Each Tier Is Changed

Every Azure and Entra setting lives in code. Tier 1 and Tier 2 changes are applied by CI on merge. Tier 0 changes are declared in code, compared with live state by a read-only pipeline, and executed by a PIM-elevated person running a reviewed tool. No pipeline identity ever holds Tier 0 access, and no person ever runs Terraform. This replaces the earlier Lane A and Lane B model.

Status: agreed 2026-12-02, not yet built

In place: Tier 1 and Tier 2 CI apply; the read-only plan identities; the tier0-grants jobs in ci-templates (manual-grants.yml), which already compare planned Graph consent and Entra directory roles with live Entra and print the commands a person runs.

Planned: the tier0/ plan-only layout, the Sync-Tier0 tool, the nightly drift check and its issue rotation, and moving each Tier 0 project across. Until a project moves, it is delivered the way described in Until a project migrates.


The rules

  1. CI is Tier 1 at most. No pipeline identity holds an Entra directory role, a RoleManagement.* or tenant-wide Graph write permission, or unconditioned Owner / User Access Administrator / Role Based Access Control Administrator at the Tenant Root Group or mg-intermediate-root. Not standing, and not for a time-boxed window either.
  2. Only CI runs Terraform. Plan, apply, import and state changes all happen in CI, from a merged MR. No person runs terraform against a live environment.
  3. People execute Tier 0 changes with az or Microsoft Graph PowerShell only, after PIM activation, signed in with a Tier 0 admin account, from a privileged access workstation.
  4. Everything is in code. A Tier 0 setting that isn't declared in a repository is drift, whoever made it.

Why no pipeline holds Tier 0

Under the Enterprise Access Model, anything that can control a Tier 0 asset is Tier 0 itself. A pipeline with Tier 0 write access, even for 30 minutes, makes GitLab, its runners, its CI templates and everyone who can merge part of the control plane. GitLab can't be hardened and isolated to that standard, so the pipeline must not hold the access.

What breaks if it did:

Standard What fails
EAM plane isolation A lower-trust system (a CI runner triggered by a merge) would control a higher-trust one (the identity control plane).
NIST AC-6(5) Privileged Accounts Privileged access must be limited to named people for a stated purpose. A CI identity is shared and its purpose is "someone merged".
NIST AC-5 Separation of Duties Merge-to-apply turns "is this code correct?" and "should this privilege go live now?" into one decision.
NIST AC-2(6) Dynamic Privilege Management A standing grant to CI is the opposite of just-in-time. A time-boxed grant still hands the window to whatever controls the runner.
MCSB PA-1 / PA-2 Highly privileged access is limited and has no standing assignment.

CAF permits a privileged pipeline only if it is governed like a human holding the same privilege and can't escalate its own access. This tenant goes further for Tier 0: a person, not a pipeline, executes the change.


How a change flows

flowchart LR
    subgraph Code["GitLab: one estate repo"]
        T12["tier1/ and tier2/<br/>Terraform"]
        T0["tier0/<br/>Terraform, plan only"]
    end
    T12 -->|MR plan, merge| CIAPPLY["CI apply<br/>scoped OIDC, Tier 1 max"]
    T0 -->|MR plan, merge| CIPLAN["CI plan + compare<br/>read-only identity"]
    CIPLAN -->|opens issue: Tier 0 change pending| ISSUE["GitLab issue<br/>assigned to rotation"]
    ISSUE --> HUMAN["Engineer: PIM activate,<br/>Sync-Tier0 -Estate X"]
    HUMAN -->|fixed az / Graph calls| LIVE["Entra and Azure<br/>control plane"]
    CIAPPLY --> LIVE2["Tier 1 and 2 resources"]
    LIVE -.->|nightly drift check| CIPLAN
    CIPLAN -.->|in step: import blocks adopt new objects| T0

Tier 1 and Tier 2

  1. Open an MR. CI runs fmt, tflint, validate and checkov, then plan with the repository's scoped OIDC identity, and posts the plan to the MR.
  2. A peer reviews the plan. Read it for destroys you didn't intend: a renamed module or resource without a moved block is the usual cause.
  3. Merge. The main pipeline applies with the same identity. Apply jobs are when: manual.

Each identity holds rights only on its own management group or subscription, signs in with a federated credential (no secrets), and writes only to its own state container. The full requirements are in Access Tiering Model: pipeline requirements.

Tier 0

  1. Declare it. Tier 0 settings live in Terraform in the estate repo's tier0/ root module: Graph consent, Entra directory roles, Conditional Access, the management group hierarchy, root-scope RBAC, PIM settings, and the Tier 0 admin accounts themselves. Terraform is the declaration language and the comparison engine; it is never used to apply this folder.
  2. Review it. The MR shows the Terraform plan of tier0/ from a read-only identity. A second engineer approves.
  3. Compare. After merge, the main pipeline plans tier0/ again and turns the difference into a list of changes. If there is anything to do, it opens a GitLab issue, "Tier 0 change pending: estate X", assigned to the weekly rotation.
  4. Execute. The engineer on rotation, who must not be the MR author:
    1. activates the estate's Tier 0 PIM group (a second engineer approves the activation);
    2. signs in to that tenant with their t0- admin account from their privileged access workstation;
    3. runs Sync-Tier0 -Estate <name>.
  5. Adopt and verify. The next pipeline imports any object the person created (an import needs only read access, so the read-only identity can do it) and plans again. An empty plan closes the issue.
  6. Watch. The same compare runs nightly. Green means live matches code. Amber means a change is waiting or someone changed something by hand. Amber for more than 24 hours raises an alert.

Sync-Tier0

A versioned PowerShell module, pinned by release tag and reviewed like any other code. It is the only Tier 0 tool anyone needs to learn. It:

  • refuses to run unless the estate's Tier 0 PIM group is active for the signed-in account, the account is a t0- account in that tenant, and the user isn't the MR author;
  • reads the reviewed plan from main for the estate as data, never as command text;
  • accepts only an allow-list of resource types, each mapped to a fixed az or Graph call written in the module;
  • shows each change in plain English and asks for confirmation;
  • executes, re-reads live state, and posts the result to the issue.

Because the commands live in the reviewed module and not in pipeline output, a compromised pipeline can't hand the engineer something to paste. That keeps the lower-trust system (CI) from controlling the higher-trust action (EAM clean source).

Microsoft Graph PowerShell is used where the Azure CLI can't get the Graph scope it needs, as manual-grants.yml already does for Entra directory roles.


Why there is no state to reconcile

Tier 0 objects are adopted into tier0/ state by import blocks, which CI runs with its read-only identity. Nothing in tier0/ is ever applied, so the plan identity can't change Entra or Azure even if someone tries: it has no write rights. Live Azure is the source of what exists; code is the source of what should exist; the plan is the difference.


Who may execute Tier 0 changes

Tier 0 PIM eligibility is held by a small, named set of approved role holders in each tenant, not by job title. NIST AC-6(5) restricts privileged accounts to specific people or roles, based on need. Each tenant should have enough holders for one to execute and another to approve, so that separation of duties holds (NIST AC-5).

Tier 0 Tier 1 and 2
Engineer Writes Tier 0 changes and reviews them. Not PIM-eligible. Full participation through MRs.
Approved Tier 0 role holder PIM-eligible in the tenants they're approved for; executes with Sync-Tier0 or approves another holder's activation. Same as any engineer.

Control coverage

Control How it is met
NIST AC-5 Executor isn't the MR author; PIM activation approved by a second person
NIST AC-6, AC-6(9) No Tier 0 in CI; just-in-time privilege; privileged actions logged
NIST CM-2, CM-3, CM-5 Code is the baseline; every change goes through an MR; only PIM-activated Tier 0 accounts can change Tier 0
NIST CM-6, AU-6 Nightly drift check; Entra audit log and Activity Log streamed to Log Analytics
MCSB PA-1, PA-2 Few holders, no standing access
Datum IAM-01, IAM-02, IAM-03, IAM-07 PIM-eligible groups, never people; Tier 0 groups controlled at Tier 0; every grant traceable to an MR and an activation

Trade-offs and open points

  • It relies on Tier 0 changes being rare. If several Tier 0 changes a week become normal across the estates, the alternative is a dedicated, hardened Tier 0 pipeline with approvals, treated as Tier 0 itself. The tier0/ layout keeps that switch cheap.
  • Sync-Tier0 is new code to maintain: one mapping per allowed resource type (about six). Keep the list short.
  • Separation of duties needs at least two holders per tenant. In a tenant with one holder, record it as an exception in the Exceptions Register.
  • Bootstrap. A new tenant's first CI identity can't create itself. That step becomes a one-off reviewed az script, run under PIM.
  • Emergency changes. A change made with a break-glass account shows as drift. It must be written back into code by MR within five working days.
  • Access packages. azure-privileged-access-packages is CI-applied today because the Azure CLI can't get the Graph scopes it needs (AADSTS65002, exception EX-002). Under this model it moves to tier0/ and Sync-Tier0 uses Graph PowerShell for it. Not yet tested.

Migration

Each Tier 0 project moves on its own. When it does, its own page is updated to describe the new flow.

Older material, such as project READMEs, may still use the retired terms: Lane A meant a Tier 0 project applied locally by a PIM-elevated engineer with ./apply.ps1 (see Until a project migrates); Lane B meant CI applies on merge.

Project Delivered today Moves to
azure-tenant-bootstrap Local apply-merged by a PIM-elevated engineer One-off reviewed az bootstrap script, then tier0/
t0-azure-service-principals Local ./apply.ps1 Tier 1 identity creates owned apps (Application.ReadWrite.OwnedBy); consent and roles in tier0/
azure-privileged-access-grants Local ./apply.ps1 tier0/
t0-azure-conditional-access Local ./apply.ps1 tier0/
azure-entra-diagnostics Local ./apply.ps1 tier0/
subscription-vending-platform Local ./apply.ps1 Tier 1 vending; root-scope grants in tier0/
t0-azure-management-groups CI apply after a 30-minute PIM grant to CI tier0/
azure-privileged-access-packages CI apply, restricted (EX-002) tier0/
subscription-vending-workload CI apply; Tier 0 routes still open (GAP-011) Tier 1 CI apply once those routes are closed

Tier 0 resources already in Terraform state leave the CI-applied projects through removed blocks with lifecycle { destroy = false }, applied by CI. Terraform stops tracking them without deleting anything, and the tier0/ folder imports them.

Until a project migrates

The projects marked "local ./apply.ps1" above are still applied the old way, and this is the only place it's described. It breaks rule 2 and goes away as each project moves.

  1. Merge the MR and wait for the main pipeline: its plan job saves the plan for the merged commit.
  2. Activate the project's operator group in PIM → My roles → Groups, with a justification.
  3. Sign in again so the token carries the activation: az account clear; az login.
  4. From the project folder: git checkout main; git pull, then ./apply.ps1. It checks your PIM activation, a clean up-to-date main, a merged MR and a saved plan for exactly that commit, then shows the plan and asks you to type apply. ./apply.ps1 -WhatIf only shows it. azure-tenant-bootstrap uses apply-merged from each step's folder instead, after preflight.ps1.
  5. Deactivate the PIM group, or let it expire.

If the script reports a stale plan, nothing was applied: re-run the main pipeline and try again. A 403 means the activation expired or the change needs a permission the group doesn't hold; fix that in code, don't elevate further.