Study guide
12.3 Artifact & Build Retention Governance
Microsoft Certified: Azure DevOps Engineer Expert AZ-400
Track your progress as you read
Finished sections get a check mark.
1 Chapter 1: Flow of Work, Traceability & Work Tracking
1.1 Flow of Work, GitHub Flow & Feedback Cycles 1.2 Work Tracking with Azure Boards & GitHub Projects 1.3 End-to-End DevOps Traceability & Quality Tracking
2 Chapter 2: DevOps Metrics, Dashboards & Team Collaboration
2.1 DORA Metrics, Flow Metrics & Dashboard Design 2.2 Lifecycle Metrics Across the Six DevOps Phases 2.3 Work Item Queries, WIQL Charts & Analytics 2.4 Project Documentation: Wikis, Mermaid Diagrams & Release Notes 2.5 Webhooks, Service Hooks & Microsoft Teams ChatOps
3 Chapter 3: Git Branching Strategies & Pull Request Workflows
3.1 Git Branching Models & Strategy Design 3.2 Pull Request Workflows & Merge Strategies 3.3 Branch Policies, Quality Gates & Compliance Restrictions
4 Chapter 4: Repository Management, Optimization & Git Data Operations
4.1 Git LFS Architecture & .gitattributes Tracking 4.2 LFS History Migration, git-fat & File Locking 4.3 Git Repository Scaling, Scalar & Monorepo Governance 4.4 Repository Permissions & Git Tag Governance 4.5 Git Data Recovery & Sensitive-Data Scrubbing
5 Chapter 5: Package Management & Dependency Versioning
5.1 Selecting Package Tools: Azure Artifacts vs. GitHub Packages 5.2 Feed Scoping, Upstream Sources & Pipeline Authentication 5.3 Package Views, Immutability & Quality Promotion 5.4 Dependency Versioning: SemVer, CalVer & Automated Versioning 5.5 Pipeline Artifact Versioning & Artifact Storage Strategy
6 Chapter 6: Pipeline Infrastructure, Agents & Integration
6.1 Selecting a CI/CD Solution: Azure Pipelines vs. GitHub Actions 6.2 GitHub-Azure Pipelines Integration & Hybrid Migration 6.3 Hosted vs. Self-Hosted Agents & Runners 6.4 VMSS Elastic Pools, Container Jobs & Agent Governance 6.5 Pipeline Triggers, Filters & Concurrency Management
7 Chapter 7: YAML Pipeline Architecture & Reusable Elements
7.1 YAML Pipeline Anatomy: Stages, Jobs, Steps & Workspaces 7.2 Job Execution Order: DAG Dependencies, Parallelism & Conditions 7.3 Reusable Elements: Templates, Parameters & Variables 7.4 Variable Groups, Secret Variables & Key Vault Linking 7.5 YAML Environments, Checks & Deployment Approvals
8 Chapter 8: Testing Strategy, Quality Gates & Code Coverage
8.1 Test Strategy Design: Local, Unit & Integration Testing 8.2 Load, Stress & Performance Testing in Pipelines 8.3 Test Execution Tasks, Agents & Results Integration 8.4 Code Coverage Analysis & SonarQube Integration 8.5 Quality Gates, Release Gates & Governance Checks
9 Chapter 9: Modern Deployment Strategies & Zero-Downtime Delivery
9.1 Progressive Delivery: Blue-Green, Canary & Ring Deployments 9.2 Minimizing Downtime: Deployment Slots & Rolling Updates 9.3 Feature Flags with Azure App Configuration & Feature Manager 9.4 Designing the High-Priority Hotfix Path 9.5 Ordered Dependency Deployments, Resiliency & Rollback
10 Chapter 10: Artifact Deployment & Database DevOps
10.1 Containerized Application Delivery: ACR, AKS & Container Apps 10.2 Binary, Web App, Function & Scripted Deployments 10.3 Database DevOps: State-Based & Migration-Based Strategies
11 Chapter 11: Infrastructure as Code (IaC) & Azure Deployment Environments
11.1 Infrastructure as Code Strategy: Bicep, ARM & Terraform 11.2 Desired State Configuration & Azure Machine Configuration 11.3 Azure Deployment Environments (ADE) & Developer Self-Service
12 Chapter 12: Pipeline Maintenance, Health & Modernization
12.1 Pipeline Health, Flaky Tests & Reliability Engineering 12.2 Pipeline Optimization: Caching, Slicing & Concurrency 12.3 Artifact & Build Retention Governance 12.4 Modernizing CI/CD: Classic to YAML Migration
13 Chapter 13: Authentication, Authorization & Identity Governance
13.1 Microsoft Entra Service Principals & Managed Identities 13.2 Service Connections, Workload Identity & Personal Access Tokens 13.3 Azure DevOps Projects, Teams & Permission Evaluation 13.4 Access Levels, GitHub Roles & Outside Collaborators
14 Chapter 14: Secrets Management, Sensitive Data & DevSecOps Scanning
14.1 Azure Key Vault, Secret Variables & Secretless CI/CD 14.2 Security Scanning Strategy, GHAS & Secret Scanning 14.3 CodeQL SAST in Pipelines and Containers 14.4 Software Supply Chain, Container Scanning & Cloud Defender
15 Chapter 15: Telemetry Collection, Azure Monitor & Alerting
15.1 Azure Monitor Architecture, AMA & Data Collection Rules 15.2 Application Insights & Specialized Azure Monitor Insights 15.3 Alerting Rules, Action Groups & GitHub Repository Insights
16 Chapter 16: Telemetry Analysis, Distributed Tracing & SRE Practices
16.1 Distributed Tracing, Application Map & Exception Triage 16.2 KQL Log Analytics, SRE Observability & Error Budgets
12.3 Artifact & Build Retention Governance
Key Takeaways Explain This Topic AI
Project-level pipeline retention sets days to keep runs, with a default of 30 days and a configurable range of 1 to 730 days.
Artifacts, test results and symbols can be retained for shorter periods than the run record itself, keeping history without keeping payloads.
A retention lease pins a specific run beyond the policy, which is how a compliance hold or a currently deployed release is protected from cleanup.
Runs deployed to an environment can be retained automatically so the artifact behind a live deployment always remains available for rollback.
A seven-year regulatory obligation is 2,555 days, which exceeds the 730-day policy maximum and therefore requires a lease or an external archive.
Last updated: September 2026
12.3 Artifact & Build Retention Governance
Optimization decides how fast a pipeline runs; retention decides how long its output survives. Retention policy is where storage cost meets audit obligation, and Azure DevOps separates the run record, the artifacts, the test results and the symbols so each can be kept for a different period.
1. Artifact and Build Retention Governance
Continuous delivery produces massive quantities of pipeline execution logs, published drop artifacts, symbols, and test attachments. Without automated retention governance, storage consumption escalates costs and exposes organizations to compliance risks.
The Modern Project-Level Retention Model
In modern Azure DevOps, retention policies are managed at the Project Settings level rather than configured individually on each pipeline:
Navigate to Project Settings → Pipelines → Settings .
Days to keep runs : Specifies how many days pipeline run history, logs, and test results are retained (Default: 30 days; Range: 1 to 730 days).
Minimum runs to keep per pipeline : Guarantees that at least N N N successful runs are preserved regardless of age, ensuring low-frequency pipelines do not lose their baseline history.
Days to keep pull request runs : Typically configured for a shorter period (e.g., 7 to 10 days) since PR branches are short-lived.
Artifacts vs. Test Results vs. Symbols Retention ┌─────────────────────────────────────────────────────────────────────────────────┐
- │ RETENTION CATEGORIES IN AZURE PIPELINES │
- ├──────────────────────┬──────────────────────────────────────────────────────────┤
- │ Data Category │ Retention Mechanics & Governance │
- ├──────────────────────┼──────────────────────────────────────────────────────────┤
- │ Pipeline Artifacts │ Dropped zips/binaries published via PublishPipelineArtifact│
- │ (Build Drops) │ Deleted when the pipeline run expires. Can set specific │
- │ │ retention per artifact or inherit run lifecycle. │
- ├──────────────────────┼──────────────────────────────────────────────────────────┤
- │ Test Results & TRX │ Stored in Azure Test Plans analytics data store. │
- │ Files │ Governed by project retention settings; aggregated data │
- │ │ preserved for long-term reporting. │
- ├──────────────────────┼──────────────────────────────────────────────────────────┤
- │ Symbol Files (PDBs) │ Published via IndexSourcesAndPublishSymbols@2 to Azure │
- │ │ DevOps Symbol Server. Configured with an independent │
- │ │ expiration window to support post-mortem debugging. │
- ├──────────────────────┼──────────────────────────────────────────────────────────┤
- │ Azure Artifacts │ NuGet, npm, Maven feeds governed by Feed Retention │
- │ (Package Feeds) │ Policies: maximum versions per package (e.g., retain 10).│
- └──────────────────────┴──────────────────────────────────────────────────────────┘
- Pipeline Retention Leases
What happens when a build is deployed to Production and must be retained for 7 years to satisfy regulatory audits (e.g., SOX, HIPAA, or PCI-DSS)? [Pipeline Run #4128 Executes]
- │
- ▼
- [Deploys to Environment: 'Production']
- │
- ▼
- [Azure Pipelines Creates Automated RETENTION LEASE]
- │
- ┌─────────┴─────────┐
- ▼ ▼
- [30-Day Project [Retention Lease ACTIVE]
- Retention Policy] • Prevents automated deletion
- Attempts Cleanup • Retains build run, logs, and drop artifacts
- Preserved until lease is explicitly removed
Automated Retention Leases on Environments : When a pipeline executes a deployment job targeting an Azure DevOps Environment (e.g., environment: 'Production' ), Azure Pipelines automatically attaches a retention lease to that specific pipeline run.
Lease Protection : A pipeline run protected by an active retention lease will never be deleted by the automated retention cleanup , even if it exceeds the 30-day project retention setting.
Manual & REST API Leases : Compliance officers or automation scripts can programmatically create retention leases via the Azure DevOps REST API: POST https://dev.azure.com/{organization}/{project}/_apis/build/retention/leases?api-version=7.1-preview.1
Content-Type: application/json
- [
- {
- "buildId": 4128,
- "daysValid": 2555,
- "definitionId": 12,
- "ownerId": "ComplianceAuditOfficer",
- "protectPipeline": true
- }
- ]
- 2. Comprehensive Optimization Techniques Comparison Table
Technique Primary Mechanism Best Applied To Storage Impact
Pipeline Caching ( Cache@2 ) Tarball stored in Azure DevOps blob store restored via key hash npm, NuGet, pip dependencies, compiler cache (ccache) Deduplicated cloud storage; 10 GB limit per cache
Pipeline Artifacts ( PublishPipelineArtifact@1 ) Optimized chunked file deduplication service Passing build outputs between stages Counted against project pipeline artifact storage
Custom VMSS Golden Images Pre-baking tools and packages into OS VHD via Packer Huge toolsets, static libraries, runtime SDKs Managed disk storage in Azure subscription
Parallel Test Slicing Dividing test assemblies across N N N parallel agent jobs Large integration and UI test suites (> 30 min) No extra storage; consumes concurrent parallel jobs
Shallow Clone ( fetchDepth: 1 ) Fetching only HEAD commit from Git Large monorepos with extensive git history Reduces agent disk space and network bandwidth
- 3. Realistic Exam Scenario & Common Traps
- Scenario: Global Healthcare SaaS Compliance & Speed Optimization
Context : MedTech Cloud builds a HIPAA-compliant healthcare portal. The multi-stage pipeline currently takes 55 minutes to execute:
Dependency installation ( npm ci and dotnet restore ) takes 12 minutes on every run.
The 3,500 integration tests take 35 minutes running sequentially on a single Linux agent.
HIPAA regulations mandate that every build artifact and test execution log deployed to the Production-HIPAA environment must be retained for exactly 7 years (2,555 days).
Routine feature branch validation builds must be deleted after 14 days to prevent storage cost escalation.
DevOps Solution :
Optimization : Implement the Cache@2 task for both npm ( package-lock.json key) and NuGet ( packages.lock.json key), reducing dependency resolution from 12 minutes to 45 seconds.
Parallelization : Configure strategy: parallel: 5 on the test job and configure VSTest@2 test slicing, reducing the 35-minute test phase to approximately 7 minutes.
Retention Governance : Configure Project Settings pipeline retention to 14 days for standard runs. Configure the deployment stage using a deployment: job targeting the Production-HIPAA environment. Azure Pipelines automatically creates an environment retention lease, and an automated REST call or environment retention policy sets the lease duration to 2,555 days.
Common Exam Traps to Avoid
Trap: Caching Dynamic or Volatile Output Folders : Caching folders containing build timestamps or volatile binaries without hashing their inputs results in stale, unrepeatable builds.
Trap: Believing Cache@2 Saves on Failure : The cache upload occurs in a post-job step that runs only if the job succeeds. If tests fail, the cache is not saved, ensuring that corrupted states are not cached.
Trap: Confusing Project Retention with Azure Artifacts Feed Retention : Project retention settings govern pipeline runs, logs, and pipeline artifacts. Package feeds in Azure Artifacts (NuGet/npm feeds) have their own independent Feed Retention Policies governing package versions.