PLATFORM DECISION
DevSecOps and delivery: Every change reviewed, scanned and promoted by pipeline.
Code, infrastructure and policy reach production only through pipelines: scanned before merge, proven in lower environments, approved for release and watched continuously.
- Four environments, one artifact
- Production needs approval
- Federated Azure credentials
The decision
Nothing reaches production except through a pipeline, and nothing is trusted just because it passed once. Application code, infrastructure, policy, alert rules and dashboards are all code. Each change is a pull request tied to a work item. It is scanned and tested before merge, built once, proven in dev, test and staging as the same artifact, and released to prod from a release tag after designated reviewers approve it. Scanning does not stop at merge: it continues daily.
- Infrastructure as code
- Build once, promote
- Shift-left security
- Workload identity federation
Rationale
For you, the decision shows up like this.
- Every change is traceable
A change is a pull request linked to a work item, and a release maps back to a merged, labelled pull request. Each deployment is recorded per environment, so you can follow a change from request to production.
- What you run was proven first
The artifact that runs in prod is the one that was built once and exercised in dev, test and staging. Nothing is rebuilt on the way, so what was tested is what is released.
- Weaknesses caught early
Secrets, code, dependencies, open-source licenses and infrastructure definitions are checked on the pull request, and again every day where it applies, so a new finding does not wait for the next release to be noticed.
- No stored Azure credentials
Pipelines sign in with short-lived federated identity, separate for each environment. There is no Azure credential to leak, rotate or reuse.
- Production is deliberate
Production deploys only from a release tag, after approval by designated reviewers. Engineers hold read-only permissions on production data, so changes arrive through the pipeline, where they are reviewed and recorded.
Boundaries: GITHUB [System Boundary]; AZURE: ONE SUBSCRIPTION PER ENVIRONMENT [Subscription].
Entities:
- Engineers [User]: Propose every change as code
- Federated identity [Identity]: One per environment; no stored credentials
- Pull request gate [Service]: GitHub Actions Work item, linters, scans and tests
- Build once [Service]: One versioned artifact, tested once
- Continuous assurance [Service]: Daily scans; serious findings become tracked work
- Designated reviewers [User]: Approve every production release
- Dev [System]: Every pull request is deployed here first
- Test [System]: Receives the merged build
- Staging [System]: The same artifact, promoted
- Prod [System]: Release tag only; read-only data access for engineers
Relationships:
- Engineers to Pull request gate: Opens pull request · work item linked
- Pull request gate to Build once: Merges · checks passed
- Pull request gate to Dev: Validates in dev · plan, then apply
- Continuous assurance to Build once: Scans code and artifacts · daily
- Build once to Test: Deploys the build · same artifact
- Test to Staging: Promotes · no rebuild
- Staging to Prod: Deploys release tag · same artifact
- Designated reviewers to Prod: Approves release · production gate
- Federated identity to Dev: Authenticates deploys · federated token
Shift-left security
The same risk is checked at more than one stage, so no single control is the only line of defense. Shift left means moving checks to where a fix is cheapest: on the dev machine first, on the pull request next, and every day after merge. Secrets, code, dependencies, licenses, infrastructure and the built artifact each get their own checks. Each check is marked by how strongly it applies: a Gate fails the pull request’s checks, an Advisory check reports findings that are tracked as work, and a Local hook is a recommended practice on the dev machine and is not enforced.
Boundaries: 1 · DEV MACHINE [System Boundary]; 2 · PULL REQUEST [System Boundary]; 3 · AFTER MERGE [System Boundary].
Entities:
- Engineer [User]: Commits code, infrastructure and policy
- Pre-commit hooks [Local]: Recommended, not enforced: secrets, lint, Terraform
- Build and tests [Gate]: Linters, schema checks, unit and integration tests
- Secret check [Gate]: Fails while secret alerts are open in changed files
- Dependency review [Gate]: Fails on critical vulnerabilities
- Licence check [Gate]: Fails on licences outside the approved list
- Infrastructure scan [Gate]: Security scan of changed Terraform; deploy to dev
- Code scanning [Gate]: CodeQL Fails the pull request on findings
- Artifact scan [Advisory]: Software composition scan of the build
- Daily scans [Advisory]: Dependencies, code, artifacts, secrets and drift
- Tracked work [Work items]: Serious findings are owned and followed up
Relationships:
- Engineer to Pre-commit hooks: Commits · hooks run first
- Engineer to Build and tests: Opens pull request · work item
- Licence check to Daily scans: Merges · scans continue daily
- Daily scans to Tracked work: Raises work items · serious findings
- Artifact scan to Tracked work: Reports findings · tracked as work
- GateFails the pull request's checks when it finds a problem
- AdvisoryReports findings, tracked as work; does not stop a change on its own
- LocalDev-machine hook: a recommended practice, not enforced
Open a card to climb the ladder: dev machine, then pull request, then after merge. Hooks on the dev machine are a recommended practice, set up from shared configuration files, and are not enforced.
SecretsA leaked credential is caught before it is shared, and watched afterwards.Security
- Dev machineLocalRecommended hooks look for secrets before a commit is made
- Secret detection on the staged changes
- Private-key detection
- Pull requestGateThe secret check fails while secret-scanning alerts are open in the files the change touches
- After mergeAdvisoryOpen secret-scanning alerts are collected daily and tracked as work
CodeTests decide first; analysis adds a second opinion.SecurityOperational Excellence
- Dev machineLocalRecommended hooks lint and format the files being committed
- Python lint and format
- Shell script lint
- Front-end file formatting (scripts, styles, HTML, JSON, Markdown and YAML)
- Markdown lint, with automatic fixes
- OpenAPI definition lint
- Gherkin feature file lint
- YAML and TOML syntax checks
- Python requirements files kept sorted
- Pull requestGateLinters, schema validation, build, and unit and integration tests, with a coverage reportGateCodeQL scans the changed code and fails the pull request when it finds a problemAdvisoryStatic code inspection of C# reports findings on the pull request
- After mergeAdvisoryCodeQL also runs on its own daily schedule, independent of any pull request
DependenciesPackages with known vulnerabilities are stopped on the pull request, and new findings are watched afterwards.Security
- Dev machineNo check at this stage
- Pull requestGateDependency review fails the pull request when a change adds a dependency with a critical vulnerability
- After mergeAdvisoryDependency alerts are collected daily. Dependabot raises security-update pull requests only, because automated version bumps can change behavior, and each one passes the same checks as any other change
LicensesOpen-source license obligations are settled before a dependency is adopted, not after it ships.Security
- Dev machineNo check at this stage
- Pull requestGateEvery dependency a change adds is checked against an approved list of open-source licenses, and the pull request fails on any license outside itGateThe approved list is configuration kept in the repository, so a change to it is visible in version control like any other change
- After mergeNo check at this stage
InfrastructureInfrastructure is checked as code, and what runs is compared with what was reviewed.SecurityOperational Excellence
- Dev machineLocalRecommended hooks check infrastructure and pipeline definitions
- Terraform format, validate and lint
- GitHub Actions workflow lint
- Pull requestGateAn infrastructure-as-code security scan of the Terraform that changedGatePlan, apply and deploy to dev, so the change is exercised in a real environment before merge
- After mergeAdvisoryA daily drift scan compares deployed alert definitions with the code, and Azure Policy enforces diagnostic settings
Built artifactWhat is shipped is scanned, not only what is written.Security
- Dev machineNo check at this stage
- Pull requestAdvisoryA software composition scan of the built artifact reports findings to reviewers and does not stop a change on its own
- After mergeAdvisoryArtifact scan results are collected daily and tracked as work
Change controlEvery change traces to a work item and has an owner.Operational ExcellenceSecurity
- Dev machineLocalRecommended hooks keep a commit clean and on a branch
- Direct commits to the main branch are rejected
- Unresolved merge-conflict markers are caught
- Oversized files are caught
- Pull requestGateA conventional title and a work-item reference, validated against the work-item system, and a label that links the change to its serviceAdvisoryCode owners, defined for every path, are asked to review changes to it
- After mergeAdvisoryA daily check flags merged changes that have not been released
File types with linters
Linters run on the files a pull request changes. The marker on each type shows how strongly its check applies.
Application code
- Go(Gate)
- Python(Gate)
- JavaScript and TypeScriptfront-end services(Gate)
- C#static code inspection(Advisory)
Infrastructure
- Terraform(Gate)
Pipelines and configuration
- GitHub Actions workflows(Gate)
- YAML(Gate)
- XML(Gate)
- Service definition filesschema validation(Gate)
Web and API definitions
- HTML(Gate)
- OpenAPI(Gate)
Data and tests
- SQL(Gate)
- Gherkin feature filestest specifications(Gate)
Scripts
- Shell(Gate)
Documentation
- Markdown(Gate)
Local hooks only
- TOML(Local)
Types under "Local hooks only" are checked on the dev machine and are not part of the pull request's checks.
High and critical findings from the daily scans become tracked work items with due dates, so a finding is owned, not just reported.
How it fares across the Well-Architected pillars
Operational ExcellenceEverything as code, traceable end to end, with drift and unreleased changes watched.
- Infrastructure and applications by pipeline. Infrastructure, policy, alert rules and dashboards are code, reviewed and deployed by pipeline. No environment takes manual portal changes.
- Traceable. Pull request titles follow a convention and reference a work item, validated against the work-item system. A release needs a labelled, merged pull request, and the start and end of each deployment are recorded per environment.
- Repeatable. Infrastructure is planned and applied in separate steps, and the apply uses the plan that was reviewed. Deployment order is always the same: infrastructure, then database schema, then applications.
- Ownership is explicit. Code owners are defined for every path and are asked to review changes to it.
- Nothing sits unreleased unnoticed. A daily check flags merged changes that have not been released and notifies a team channel.
- Drift is watched. A daily scan compares deployed alert definitions with the code, and Azure Policy enforces diagnostic settings, so what runs is what was reviewed.
- Recovery is a redeploy. The way back is to redeploy the last known good version and rerun affected incidents.
SecurityChecks shift left, identity is federated, and production needs approval.
- Shift left. Secrets, code, dependencies, licenses, infrastructure and the built artifact are checked on the dev machine, on the pull request and daily after merge, and each check is marked Gate, Advisory or Local. See Shift-left security.
- Federated Azure credentials. Pipelines sign in with workload identity federation, using a separate identity and subscription for each environment. No Azure credentials are stored.
- Approval for production. Production deployments require explicit approval from designated reviewers and run only from a release tag. One approval covers the whole deployment: infrastructure, database and applications.
- Least privilege in production. Engineers hold read-only permissions on production data. Changes to data and infrastructure are delivered by the pipeline.
- Continuous vulnerability management. Findings from the daily scans are collected, and high and critical ones become tracked work items with due dates.
ReliabilityChanges are proven in lower environments and deployed in a fixed order.
- Proven before prod. Each pull request is deployed to dev before merge. After merge the build goes to test, is promoted to staging, and only then can be released to prod.
- Same artifact, no rebuild. Promotion moves the tested artifact, so a result in a lower environment says something about prod.
- Isolated environments. Each environment has its own subscriptions, identity and dedicated deployment runners, so the environments stay separate.
- Release is controlled. A release tag must map to a commit with a merged pull request, and artifacts come from the build run that was already tested.
- A known way back. Because every release is a versioned artifact, recovery is a redeploy of the last known good version.
Stage by stage
Each stage adds a control that the next one relies on. Open a card for the detail.
On the dev machineEarly feedback before a commit is made.SecurityOperational Excellence
- Pre-commit hooks catch secrets, private keys and oversized files, reject direct commits to the main branch, and format and lint infrastructure code, scripts, documents, API definitions and feature files
- A recommended practice, set up from shared configuration files, and not enforced: the pipeline runs the same kinds of checks again. See Shift-left security for the full list
The pull request gateEvery change carries a work item, security checks and passing tests.SecurityOperational Excellence
- Traceability: a conventional title and a work-item reference, validated against the work-item system; a label links the pull request to its service
- Security checks: secrets, code, dependencies, licenses, infrastructure and the built artifact, each marked Gate or Advisory. See Shift-left security
- Tests: build, unit tests with a coverage report, and integration tests
- Deployment to dev: every pull request is planned, applied and deployed to dev, so a change is exercised in a real environment before merge
- Ownership: code owners are asked to review changes to their paths
After merge: build once, promoteOne versioned artifact moves through dev, test and staging.Operational ExcellenceReliability
- The build is tested once and versioned by date and commit, then published to an artifact repository
- It is deployed to test, promoted to a staging repository, and deployed to staging. The same artifact is promoted, never rebuilt
- Each environment is deployed in the same order: infrastructure, database schema, then applications
- Infrastructure is planned in one job and applied in another, using the saved plan
- The start and end of each deployment are recorded per environment
The production releaseApproved by designated reviewers and released only from a tag.SecurityOperational Excellence
- Releases are triggered by a release tag, which must map to a commit with a merged, labelled pull request
- The artifacts come from the build run that was already tested
- The production environment requires explicit approval from designated reviewers, and deploys only from a release tag
- A single approval covers the infrastructure, database and application deployment
- Deployment jobs run on runners dedicated to each environment
- A daily check flags merged changes that have not yet been released
Identity in the pipelineShort-lived federated tokens, separate for each environment.Security
- Pipelines sign in to Azure with workload identity federation (OpenID Connect), so no Azure credentials are stored
- Each environment has its own federated identity and its own subscription, so access in one environment grants nothing in another
- Tokens are short-lived and issued per run
Continuous assuranceScanning continues after merge, every day.SecurityOperational Excellence
- A daily run collects dependency alerts, code scanning results, artifact scan results and secret-scanning alerts
- High and critical findings become tracked work items with due dates, so a finding is owned, not just reported
- Dependabot raises security-update pull requests only. Version updates are off, so there is no routine churn
- A daily drift scan compares deployed alert definitions with the code
Production accessEngineers hold read-only permissions on production data.Security
- Changes to data and infrastructure are delivered by the pipeline, where they are reviewed, approved and recorded
- Infrastructure is changed through code, not through the portal
Trade-off
Related
Observability and operations · Security and identity · Resiliency and DR · Incident event store