# 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 `dockerRegistryServiceConnection` variable - Subscription: Your Azure subscription - Registry: Your ACR ### 2. Azure Resource Manager Connection **Purpose**: Deploy to App Services **Setup**: - Type: Azure Resource Manager - Name: Match `azureSubscription` variable - 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)` and `latest` ### 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 `main` branch - Git tags starting with `v*` (e.g., `v1.0.0`) **Manual trigger:** - Go to Pipelines → Your pipeline → Run pipeline ## 📝 Common Commands ### Check Pipeline Status ```bash # View in Azure DevOps Portal # Or use Azure CLI (if configured) az pipelines runs list --organization --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) ```yaml deployToProduction: true useDeploymentSlots: false ``` → Direct deployment to production ### Zero-Downtime Deployment ```yaml deployToProduction: true useDeploymentSlots: true ``` → Deploy to staging, then swap to production ### Build Only (No Deployment) ```yaml 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 guide - **`docs/AZURE-NEW-SUBSCRIPTION-SETUP.md`** - Initial Azure setup ## ✅ Checklist - [ ] Service connections created - [ ] Pipeline variables configured - [ ] Environment `production` created - [ ] 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!