- Add separate deployment pipeline (azure-pipelines-deploy.yml) for App Service deployment - Add advanced pipeline with deployment slots (azure-pipelines-slots.yml) - Restore azure-pipelines.yml to build-only (no deployment) - Add comprehensive Azure setup documentation: - AZURE-NEW-SUBSCRIPTION-SETUP.md: Complete step-by-step Azure resource setup - AZURE-RESOURCES-OVERVIEW.md: Quick reference for all Azure resources - AZURE-ACR-SHARED-SETUP.md: Guide for shared Container Registry - AZURE-ACR-NAMING-RECOMMENDATION.md: Naming recommendations for Zuyderland - AZURE-PIPELINE-DEPLOYMENT.md: Automated deployment setup guide - AZURE-PIPELINE-QUICK-REFERENCE.md: Quick reference for pipeline variables - AZURE-PIPELINES-USAGE.md: Guide for using build and deployment pipelines - Add setup script (scripts/setup-azure-resources.sh) for automated resource creation - Support for shared ACR across multiple applications
4.1 KiB
4.1 KiB
Azure Pipeline Quick Reference
Quick reference for configuring and using the automated deployment pipeline.
📋 Pipeline Variables
Update these in azure-pipelines.yml:
| Variable | Description | Example |
|---|---|---|
acrName |
Azure Container Registry name | cmdbinsightacr |
repositoryName |
Docker repository name | cmdb-insight |
dockerRegistryServiceConnection |
ACR service connection name | zuyderland-cmdb-acr-connection |
resourceGroup |
Azure resource group | rg-cmdb-insight-prod |
backendAppName |
Backend App Service name | cmdb-backend-prod |
frontendAppName |
Frontend App Service name | cmdb-frontend-prod |
azureSubscription |
Azure service connection for deployment | zuyderland-cmdb-subscription |
deployToProduction |
Enable/disable deployment | true or false |
useDeploymentSlots |
Use staging slots for zero-downtime | true or false |
🔧 Required Service Connections
1. Docker Registry Connection
Purpose: Push Docker images to ACR
Setup:
- Type: Docker Registry → Azure Container Registry
- Name: Match
dockerRegistryServiceConnectionvariable - Subscription: Your Azure subscription
- Registry: Your ACR
2. Azure Resource Manager Connection
Purpose: Deploy to App Services
Setup:
- Type: Azure Resource Manager
- Name: Match
azureSubscriptionvariable - Subscription: Your Azure subscription
- Authentication: Managed Identity (recommended) or Service Principal
🚀 Pipeline Stages
1. Build Stage
- Builds backend Docker image
- Builds frontend Docker image
- Pushes both to ACR with tags:
$(Build.BuildId)andlatest
2. Deploy Stage
- Deploys backend to App Service
- Deploys frontend to App Service
- Restarts both services
- Verifies deployment
3. Verify Stage
- Health check on backend (
/api/health) - Accessibility check on frontend
- Reports status
🎯 Triggers
Automatic triggers:
- Push to
mainbranch - Git tags starting with
v*(e.g.,v1.0.0)
Manual trigger:
- Go to Pipelines → Your pipeline → Run pipeline
📝 Common Commands
Check Pipeline Status
# View in Azure DevOps Portal
# Or use Azure CLI (if configured)
az pipelines runs list --organization <org> --project <project>
View Pipeline Logs
- Go to Azure DevOps → Pipelines → Select run → View logs
Cancel Running Pipeline
- Go to Azure DevOps → Pipelines → Select run → Cancel
🔄 Deployment Flow
Code Push → Build Images → Push to ACR → Deploy to App Services → Verify
With Slots:
Code Push → Build Images → Push to ACR → Deploy to Staging → Swap to Production → Verify
⚙️ Configuration Examples
Basic Deployment (Current)
deployToProduction: true
useDeploymentSlots: false
→ Direct deployment to production
Zero-Downtime Deployment
deployToProduction: true
useDeploymentSlots: true
→ Deploy to staging, then swap to production
Build Only (No Deployment)
deployToProduction: false
→ Only build and push images, don't deploy
🛠️ Troubleshooting
Pipeline Fails: "Service connection not found"
- Check service connection name matches variable
- Verify connection exists in Project Settings
Deployment Fails: "App Service not found"
- Verify app names match your Azure resources
- Check resource group name is correct
Images Not Updating
- Check ACR has new images
- Verify App Service container settings
- Check Managed Identity has ACR pull permissions
📚 Related Files
azure-pipelines.yml- Main pipeline (basic deployment)azure-pipelines-slots.yml- Advanced pipeline (with slots)docs/AZURE-PIPELINE-DEPLOYMENT.md- Complete setup guidedocs/AZURE-NEW-SUBSCRIPTION-SETUP.md- Initial Azure setup
✅ Checklist
- Service connections created
- Pipeline variables configured
- Environment
productioncreated - App Services exist in Azure
- Pipeline tested successfully
- Deployment verified
- Health checks passing
Quick Start: Update variables in azure-pipelines.yml and push to main branch!