Skip to content

Infrastructure Provisioning Pipeline

The provision-infra.stage.yml stage template applies Bicep infrastructure changes without rebuilding or redeploying container images. It is used when scaling rules, VNet configuration, Key Vault RBAC, or other infrastructure settings change independently of application code.


When to Use This Pipeline

Change TypeEnable provisionInfrastructure?
VNet subnet CIDR changeYes
Redis SKU upgradeYes
Add new Key Vault secret slotYes
NSG rule modificationYes
ACR SKU upgradeYes
Add a new container app (new service)Yes (then also run full deploy)
Application code change onlyNo — run without infra provisioning
Combined infra + code changeYes — enable provisionInfrastructure: true

Pipeline Location

The infrastructure provisioning stage is a reusable template invoked by the full deployment pipelines:

Devops/azure/templates/stages/provision-infra.stage.yml

It is also used directly by pipelines/container-backend/infrastructure-pipeline.yml when provisionInfrastructure: true is passed as a parameter.


Stage Parameters

yaml
parameters:
  - name: environment
    displayName: Target Environment
    type: string
    default: dev
    values:
      - dev
      - stage
      - preprod
      - uat
      - production

  - name: whatIfOnly
    displayName: What-If Preview Only (no actual deploy)
    type: boolean
    default: false

  - name: skipApproval
    displayName: Skip Manual Approval Gate
    type: boolean
    default: false

Controlled via Pipeline Parameter

Infrastructure provisioning is controlled by the provisionInfrastructure parameter on the pipeline entry point (e.g., infrastructure-pipeline.yml). Set it to true to include the provision-infra.stage.yml in the pipeline run.


Pipeline Stages



Build-BicepParams.ps1 Deep Dive

See Bicep Modules for full script details. In brief:

  1. Reads Devops/azure/config/container-backend/services-config.json
  2. Extracts environment-specific scaling, SKU, and networking config
  3. Generates infra.bicepparam with all parameters for main.bicep
  4. The generated file is published as a pipeline artifact for use in later stages

Environment Selection Matrix

The following service connections and resource scopes are used per environment:

environment paramADO Service ConnectionSubscription Scope
devfontEndPrincipalConnectionMicrotec ERP Dev subscription
stagefontEndPrincipalConnectionMicrotec ERP Non-Prod subscription
preprodfontEndPrincipalConnectionMicrotec ERP Non-Prod subscription
uatfontEndPrincipalConnectionMicrotec ERP Non-Prod subscription
productionfontEndPrincipalConnectionMicrotec ERP Prod subscription

Troubleshooting

SymptomLikely CauseResolution
What-if shows unexpected deletionsBicep mode is Complete instead of IncrementalVerify --mode Incremental in deploy command; Complete mode deletes unlisted resources
Deployment fails: ResourceGroupNotFoundFirst-time deployment — RG doesn't exist yetRun resource-groups.bicep module first; or run the full deploy pipeline with provisionInfrastructure: true
Parameters file not generatedservices-config.json parse errorCheck JSON validity; run Build-BicepParams.ps1 locally and inspect output
whatIfOnly default not preventing deployPipeline variable overriding parameterCheck variable groups for whatIfOnly override

Internal Documentation — Microtec Platform Team