Skip to main content
Version: 2604 (Preview)

Task 04: Create Environments

Runbook GitHub GitLab Azure DevOps

DOCUMENT CATEGORY: Runbook Step
SCOPE: Deployment environment creation
PURPOSE: Create deployment environments for infrastructure automation MASTER REFERENCE: Azure Pipelines Environments

Status: Active


Objective​

Create deployment environments to manage infrastructure using IaC and automation. Environments provide deployment targets with optional protection rules and approval gates.


Prerequisites​

  • Project settings configured (Task 03)
  • Admin / Maintainer role on the project

Environment Naming Convention​

Use consistent naming across all platforms:

Cloud/ServiceExample Names
Azure Productionazr-prod-us, azr-prod-eu
Azure Developmentazr-dev-us
Azure Stagingazr-staging

Procedure​

Create Environments​

  1. Navigate to Settings → Environments
  2. Click New environment
  3. Enter the environment name (e.g., azr-prod-us)
  4. Click Configure environment

Configure Protection Rules​

For production environments, add protection rules:

SettingValue
Required reviewers✅ Add 1–2 required reviewers
Wait timerOptional — add delay before deployment (minutes)
Deployment branchesmain only (select Selected branches → add main)

Repeat for each environment in the naming convention table above.

tip

GitHub Environments integrate with GitHub Actions via the environment: key in workflow YAML. Protection rules automatically gate deployments.

References: GitHub — Using environments for deployment


Verification​

  • Environment created for each deployment target
  • Environment names follow naming convention
  • Production environments have protection rules / approval gates configured

Next Steps​

Configure Environment Variables


References​


Variables from variables.yml​

VariableConfig PathExample
Environment Namescicd.environments[].namedev, staging, production
Approval Requiredcicd.environments[].approval_requiredtrue
Approverscicd.environments[].approversplatform-team@contoso.com

Toolkit Reference

Scripts for this task are located in the azurelocal-toolkit repository under scripts/deploy/ in the appropriate task folder.


Alternatives​

The procedures in this task use the scripted methods shown in the tabs above. Additional deployment methods including Azure CLI and Bash scripts are available in the azurelocal-toolkit repository under scripts/deploy/.

MethodDescription
Azure CLIPowerShell-based Azure CLI scripts for Azure resource operations
BashLinux/macOS compatible shell scripts for pipeline environments
PreviousUpNext
← Task 03: Configure Project SettingsPhase 01: CI/CD SetupTask 05: Configure Environment Variables ->

Troubleshooting​

IssueCauseResolution
Environment creation failsInsufficient permissionsVerify user has environment creation rights
Approval gates not configuringEnvironment policy restrictionsCheck organization-level environment policies

Version Control​

VersionDateAuthorChanges
1.0.02025-03-25Azure Local CloudInitial release