A simple web application demonstrating environment-specific infrastructure and "build once, deploy everywhere" CI/CD pipeline using Azure Developer CLI and GitHub Actions.
The pipeline implements true "build once, deploy everywhere":
- Package Application: Build and package the app to
./dist/app-package.zip - Deploy to Dev: Deploy the package to development environment (public storage)
- Validate: Run tests and validation checks on dev deployment
- Promote to Prod: Deploy the same package to production environment (private networking)
📦 Package → 🚀 Deploy Dev → 🔍 Validate → 🚀 Promote to Prod (same package)
Key Benefits:
- ✅ Same exact package deployed to both environments
- ✅ No rebuilding during promotion
- ✅ Faster production deployments
- ✅ Reduces build-related deployment issues
Smart Environment Naming: myapp-dev automatically becomes myapp-prod
Two environment configurations using Azure Bicep:
| Component | Development | Production |
|---|---|---|
| App Service | B2 plan, public access | S1 plan, VNet integrated |
| Storage | Public access enabled | Private endpoints only |
| Networking | Standard | VNet + Private DNS |
| Security | Managed identity | Enhanced network isolation |
main.bicep- Main orchestrationapp.bicep- App Service hostingshared.bicep- Storage with environment-specific accessnetwork.bicep- VNet infrastructure (prod only)monitoring.bicep- Observability stack
- Azure subscription
azd init -t https://github.com/puicchan/azd-dev-prod-appservice-storageThis downloads the complete implementation with all Bicep templates and enhanced GitHub Actions workflow.
azd upWhen prompted for the environment name, use myproj-dev (or your preferred naming pattern with -dev suffix).
Note: The default envType is dev, so you don't need to set the AZURE_ENV_TYPE environment variable for development. The infrastructure will automatically provision with public access and cost-optimized resources.
Create and configure the production environment:
# Create new production environment
azd env new myproj-prod
# Set environment type to production
azd env set AZURE_ENV_TYPE prod
# Deploy production environment
azd upThis provisions production infrastructure with VNet integration, private endpoints, and enhanced security.
azd env select myproj-devYou're now ready to develop and test in the development environment.
Edit your application code (e.g., modify app/templates/index.html or app.py) to test the promotion workflow.
azd pipeline configThis enhances the generated GitHub Actions workflow with dev-to-prod promotion logic. The pipeline will:
- Deploy and validate in development (
myproj-dev) - Automatically promote to production (
myproj-prod) using the same package - Handle environment naming conversion automatically
Once configured, every push to the main branch will trigger the automated dev-to-prod promotion pipeline!
Development: Public storage, managed identity, HTTPS-only
Production: Private networking, VNet integration, zero public storage access
