1. DevOps Fundamentals
- DevOps = Development + Operations.
- Goal: Automate software delivery, improve collaboration and enhance efficiency.
1.1 Key Practices:
- CI/CD (Continuous Integration & Continuous Deployment).
- Infrastructure as Code (IaC).
- Monitoring & Logging.
- Security & Compliance.
- Collaboration & Agile Practices.
1.2 Azure DevOps Services
Service | Function |
Azure Repos | Version control using Git or TFVC |
Azure Pipelines | CI/CD for automated builds and deployments |
Azure Test Plans | Automated & manual testing |
Azure Artifacts | Package management (NuGet, npm, Maven) |
Azure Boards | Agile project management (Scrum, Kanban) |
2. Source Control with Azure Repos
2.1 Git vs. TFVC (Team Foundation Version Control)
Feature | Git | TFVC |
Distributed | Yes | No |
Branching | Lightweight | Heavy |
Offline Work | Yes | No |
Use Case | Small & large teams | Legacy projects |
2.2 Best Practices:
- Use feature branches and pull requests (PRs) for changes.
- Enforce branch policies (e.g., code review, CI checks).
- Use Git Hooks for automation.
2.3 Common Git Commands
git clone <repo-url> # Clone a repository
git branch <name> # Create a new branch
git checkout <name> # Switch branches
git add . # Stage changes
git commit -m "message" # Commit changes
git push origin <branch> # Push changes to remote
git pull origin <branch> # Pull latest changes
3. Continuous Integration (CI) with Azure Pipelines
3.1 CI/CD Pipeline Workflow
- Developer commits code to Azure Repos.
- Azure Pipelines triggers a build (compilation, tests).
- Build artifacts are generated and stored in Azure Artifacts.
- Release pipeline deploys to test/staging/production.
3.1.1 Azure Pipeline YAML Example
trigger:
branches:
include:
- main
- dev
pool:
vmImage: 'ubuntu-latest'
steps:
- task: UseNode@1
inputs:
version: '14.x'
- script: npm install
displayName: 'Install dependencies'
- script: npm test
displayName: 'Run tests'
- script: npm run build
displayName: 'Build application'
3.2 Best Practices for CI
- Run unit tests and enforce test coverage.
- Use secrets management (Azure Key Vault) instead of hardcoded credentials.
- Implement linting and static code analysis.
4. Continuous Deployment (CD) with Azure Pipelines
4.1 Release Pipeline Stages
- Dev → QA → Staging → Production
- Canary Releases, Blue-Green Deployments, Rolling Deployments
4.1.1 CD Pipeline Example (YAML)
stages:
- stage: Deploy
jobs:
- job: DeployApp
steps:
- task: AzureWebApp@1
inputs:
azureSubscription: 'MyAzureSubscription'
appName: 'my-web-app'
package: '$(Build.ArtifactStagingDirectory)/myapp.zip'
4.2 Best Practices for CD
- Automate rollback strategies in case of failure.
- Use feature flags to control feature releases.
- Validate infrastructure configuration before deploying.
5. Infrastructure as Code (IaC) & Configuration Management
5.1 IaC Tools
- ARM Templates (Azure Resource Manager)
- Terraform
- Bicep
- Ansible / Puppet / Chef
5.1.1 Terraform Example (Azure VM Deployment)
provider "azurerm" {
features {}
}
resource "azurerm_resource_group" "rg" {
name = "myResourceGroup"
location = "East US"
}
resource "azurerm_virtual_machine" "vm" {
name = "myVM"
resource_group_name = azurerm_resource_group.rg.name
location = azurerm_resource_group.rg.location
vm_size = "Standard_B1s"
}
5.2 Best Practices for IaC
- Use version control for infrastructure configurations.
- Enforce linting (e.g., terraform fmt).
- Implement immutable infrastructure principles.
6. Security & Compliance in DevOps
Security Practice | Description |
Azure Key Vault | Securely store secrets, certificates and encryption keys |
Secure DevOps Kit for Azure | Security best practices for DevOps |
Azure Security Center | Threat detection & security recommendations |
Microsoft Defender for Cloud | Compliance & security monitoring |
Azure Policy | Enforce compliance rules (e.g., only allow specific VM sizes) |
6.1 Best Practices for Security in DevOps
- Use Azure RBAC (Role-Based Access Control) to restrict permissions.
- Enable MFA for all user logins.
- Use encrypted storage for sensitive data.
- Perform container security scanning (if using Docker).
7. Monitoring & Logging
7.1 Key Azure Monitoring Tools
Service | Function |
Azure Monitor | Collects logs & metrics |
Application Insights | Tracks app performance |
Log Analytics | Queries logs in Azure Monitor |
Azure Sentinel | Security information & event management (SIEM) |
Kusto Query Language (KQL) | Query logs from Log Analytics |
Example KQL Query (Log Analytics)
AzureDiagnostics
| where ResourceType == "AzureFirewall"
| summarize count() by bin(TimeGenerated, 1h), ResourceId
7.2 Best Practices for Monitoring
- Set up alerts for high CPU/memory usage.
- Monitor failed deployments and rollbacks.
- Implement end-to-end tracing using Application Insights.
8. DevOps Culture & Agile Practices
8.1 Agile Frameworks in Azure DevOps
- Scrum (Sprints, Backlogs, Retrospectives)
- Kanban (Visualize work in progress)
- SAFe (Scaled Agile Framework) for large teams
8.1.1 Azure Boards Work Items
Work Item | Description |
Epics | Large user stories or projects |
Features | Group of related user stories |
User Stories | Small deliverables within a feature |
Tasks | Breakdown of user stories |
8.2 Best Practices for Agile Development
- Conduct Daily Stand-ups & Sprint Planning.
- Use Kanban boards for work visualization.
- Automate workflow rules in Azure Boards.
9. Cost Optimization in DevOps
9.1 Best Practices for Cost Optimization
- Use Auto-scaling for compute resources.
- Optimize Azure DevTest Labs for testing environments.
- Implement reserved instances for long-term savings.
- Enable budget alerts in Azure Cost Management.
10. Exam Tips & Study Guide
10.1 Key Topics to Focus On:
- CI/CD Pipelines in Azure Pipelines.
- Infrastructure as Code (IaC) with Terraform & ARM.
- Security best practices (Key Vault, RBAC, Policy).
- Monitoring & Logging with Azure Monitor & KQL.
- Git & Azure Repos version control best practices.
10.2 Recommended Learning Paths:
- Microsoft Docs for AZ-400.
- Hands-on Azure DevOps Labs.
- Practice Exam Questions & Mock Tests.