AZ-401 Domain 3: Design and implement build and release pipelines
35–40% of the exam (AZ-400: 50–55%). 30 skills in 6 tasks, 1 of them new in AZ-401 and 4 reworded for AI tools. Study notes for each task below, then 15 free questions with answers.
112 Domain 3 questions in the bank, 15 free. Answer them one at a time with explanations.
Practice Domain 3- 3.1 Design and implement a package management strategy
- 3.2 Design and implement a testing strategy for Azure DevOps pipelines and GitHub Actions
- 3.3 Design and implement Azure DevOps pipelines and GitHub Actions
- 3.4 Design and implement deployments
- 3.5 Design and implement infrastructure as code (IaC)
- 3.6 Maintain Azure DevOps pipelines and GitHub Actions
- Free Domain 3 questions
Skill wording is quoted from the official study guide. Tags compare each skill with the AZ-400 guide.
3.1 Design and implement a package management strategy
Task 3.1 covers where packages live (Azure Artifacts or GitHub Packages), how feeds, views and upstream sources decide what a consumer restores, and how versions are numbered and constrained. Most questions hinge on which package types each service hosts, the feed search order and the exact version-range or run-number syntax.
- 3.1.1Recommend package management tools including Azure Artifacts and GitHub Packages 3 questions
- 3.1.2Design and implement package feeds and views for local and upstream sources 3 questions
- 3.1.3Design and implement a dependency versioning strategy for code assets and packages, including semantic versioning (SemVer) and date-based (CalVer) 3 questions
- 3.1.4Design and implement a versioning strategy for pipeline artifacts 3 questions
Should I use Azure Artifacts or GitHub Packages for our packages?
GITHUB_TOKEN and permissions: packages: write (plus contents: read for checkout), so no long-lived PAT is stored. id-token: write doesn't authenticate to GitHub Packages.Source: Introduction to GitHub Packages; About permissions for GitHub Packages
How do upstream sources and feed views decide which package version a consumer gets?
<clear /> in nuget.config); several feeds in one config make restores nondeterministic. You can't publish a version that already exists in an enabled upstream: disable the upstream, publish, re-enable it. Every feed starts with the views @Local (the default: everything published or saved), @Prerelease and @Release. You publish only to the base feed and then promote validated versions to a view to signal quality. Custom upstream sources are supported only for npm.Source: What are upstream sources?; What are feed views?
What access does a pipeline need to restore from a feed in another project or organization?
@Release and share only that view, so unvalidated builds in @Local stay hidden from those consumers.Source: Feed scopes: Project vs organization feeds; Manage permissions
How do SemVer ranges and CalVer versions behave in NuGet and Dependabot?
MAJOR.MINOR.PATCH signals breaking changes in the major segment, so a dependency range should stop below the next major version. In NuGet range notation [ is inclusive and ( is exclusive: [4.1.3,5.0) means 4.1.3 ≤ x < 5.0, which keeps a required fix as the floor. A floating 4.* accepts any 4.x.y, including versions older than the fix. NuGet normalizes versions by removing leading zeros, so 2026.03.07 becomes 2026.3.7. Dependabot reads every x.y.z as major.minor.patch and has no CalVer mode. A year change such as 2026.11.0 to 2027.1.0 is therefore a semver-major update and is dropped by an ignore rule with update-types: ["version-update:semver-major"], while month changes still arrive as minor updates. Calendar-versioned dependencies need their own ignore rules.Source: NuGet Package Version Reference; Dependabot options reference
How do I generate unique build versions in Azure Pipelines?
name:; the default is $(Date:yyyyMMdd).$(Rev:r). $(Rev:r) rises by one per completed run and resets to 1 when any other part of the number changes, such as the date or a version prefix: after 1.0.3, changing the format to 1.1.$(Rev:r) gives 1.1.1. If the run number becomes a NuGet version, use $(Month) and $(DayOfMonth), which have no leading zeros, and avoid MM, dd and $(Rev:rr), because NuGet strips leading zeros and the package version would no longer match the run. For semantic versions, counter(prefix, seed) keeps a separate sequence for each prefix value. A new prefix starts at the seed, and when an earlier prefix comes back its sequence resumes where it stopped instead of restarting.Source: Run and build numbers; Expressions
Where should build outputs be stored between jobs and for other teams?
actions/upload-artifact@v4 are immutable, so two jobs in one run can't upload the same name; matrix jobs put the matrix value in the artifact name. retention-days sets a shorter lifetime per artifact but can't exceed the limit set by the repository, organization or enterprise.Source: Publish and download pipeline artifacts; Store and share data with workflow artifacts
Traps in 3.1 questions
- GitHub Packages looks like the natural choice for a GitHub shop, but it has no Python or Cargo registry and doesn't cache public registries; that need points to Azure Artifacts upstream sources.
- Feed views don't change upstream search order, and a feed-level role doesn't enable cross-organization upstreams; only sharing the view with the Entra tenant does.
- Feed Reader looks like least privilege for a pipeline, but it can't save packages from upstreams; Feed and Upstream Reader (Collaborator) is the minimum.
- Zero-padded run numbers (MM, dd, Rev:rr) look tidy but NuGet normalizes them, so the package version stops matching the run number.
12 questions in the bank test task 3.1. Practice Domain 3
3.2 Design and implement a testing strategy for Azure DevOps pipelines and GitHub Actions
Task 3.2 covers gates that stop a bad build from shipping, the testing pyramid, running and publishing tests, and coverage enforcement, now with Copilot code review, Copilot cloud agent and MCP servers in the loop. Most questions turn on where a gate is defined (YAML, protected resource or ruleset) and which exact setting makes it blocking rather than advisory.
- 3.2.1Design quality and release gates 3 questions
- 3.2.2Implement quality and release gates by using GitHub Copilot and MCP servers Now with AI tools4 questions
- 3.2.3Design a comprehensive testing strategy, including local tests, unit tests, integration tests, and load tests 3 questions
- 3.2.4Implement tests in a pipeline, including configuring test tasks, configuring test agents, and documenting test results, by using GitHub Copilot and MCP servers Now with AI tools4 questions
- 3.2.5Implement code coverage analysis by using GitHub Copilot and MCP servers Now with AI tools4 questions
Where do quality and release gates live, and in what order do Azure Pipelines checks run?
Source: Define approvals and checks; Deployments and environments
How do I make Copilot code review and Copilot cloud agent part of the merge gate?
Source: Configuring code review by GitHub Copilot; Configuring settings for GitHub Copilot in the cloud
Can an AI agent scan for secrets before code reaches a pull request?
secret_protection toolset explicitly because it isn't in the default toolsets, and the run_secret_scanning tool currently belongs to the copilot toolset. Findings from an MCP scan are ephemeral: they appear only in the agent's session and are never written as secret scanning alerts, so they don't show in the Security tab or the alerts APIs. Repository secret scanning and push protection remain the system of record and the actual gate; the MCP scan is an early check inside the agent loop.Source: Scanning for secrets with the GitHub MCP server
How do unit, integration and load tests fit into one testing strategy?
services: key creates a fresh Docker container per service and destroys it when the job ends, so each job gets an isolated database; service containers need Linux runners. Azure Load Testing in CI/CD reads fail criteria, such as response time or error percentage, from the YAML test configuration file stored next to the test script. When a criterion is met the test run fails, and the pipeline run takes that status.Source: Shift testing left with unit tests; Define load test fail criteria
How do I run and publish tests in a pipeline and let an agent read the results through MCP?
condition: succeededOrFailed() on PublishTestResults@2; the run still fails. continueOnError: true on the test step would mark the run partially succeeded instead. To run VSTest without Visual Studio on the agent, add the Visual Studio Test Platform Installer task and set the VSTest test platform version to Installed by tools installer. For an agent, the remote Azure DevOps MCP Server at https://mcp.dev.azure.com/{organization} needs no install for Entra-backed organizations; its testplan toolset lists plans, suites and cases and returns test results for a build ID. The X-MCP-Toolsets header limits toolsets and X-MCP-Readonly: true removes write tools. On the remote GitHub MCP server each toolset has its own URL, appending /readonly keeps read tools only, and get_job_logs with failed_only and a run_id returns the logs of every failed job.Source: PublishTestResults@2 - Publish Test Results v2 task; Set up the remote Azure DevOps MCP Server
How do I enforce code coverage on pull requests in Azure DevOps and GitHub?
azurepipelines-coverage.yml at the repository root. The status is advisory until a branch policy requires the check named {pipeline name}/codecoverage. In GitHub, the Restrict code coverage ruleset rule (GitHub Code Quality, public preview) blocks by Minimum line coverage percentage or Maximum line coverage drop against the default branch. It evaluates only data already uploaded, so make every coverage-uploading check a required status check. Code Quality accepts Cobertura XML only. Its automatic coverage setup is an AI agent that finds your test framework and opens a pull request with an upload workflow, but it won't convert JaCoCo-only output.Source: Review and configure code coverage results in Azure Pipelines; Automatic code coverage setup
Traps in 3.2 questions
- A ManualValidation task or YAML gate looks equivalent to an environment check, but anyone who edits the pipeline can delete it; checks on the protected resource can't be removed from YAML.
- Approval looks like it should run before Branch control, but static checks run first, so a run from a disallowed branch fails before approvers are asked.
- Raising the diff coverage target doesn't block merges; the coverage status stays advisory until a branch policy requires it.
- Copilot approving a pull request isn't enough on its own; Allow Copilot approvals to count toward merge requirements must also be on for the ruleset's approval count.
18 questions in the bank test task 3.2. Practice Domain 3
3.3 Design and implement Azure DevOps pipelines and GitHub Actions
Task 3.3 is the largest task in Domain 3: choosing and hosting the CI/CD engine, connecting Azure Pipelines to GitHub, writing YAML with Copilot, triggers, execution order, reuse, environment checks and the new GitHub Agentic Workflows. Questions hinge on exact keys and defaults, such as a custom condition replacing succeeded() or which runner type supports private networking.
- 3.3.1Select a deployment automation solution, including Azure Pipelines and GitHub Actions 4 questions
- 3.3.2Design an Azure DevOps agent or GitHub runner infrastructure, including cost, tool selection, licenses, connectivity, and maintainability 6 questions
- 3.3.3Implement an Azure DevOps or GitHub runner agent infrastructure 6 questions
- 3.3.4Design and implement integration between Azure Pipelines and GitHub repositories 5 questions
- 3.3.5Develop pipelines in YAML by using GitHub Copilot Now with AI tools5 questions
- 3.3.6Develop and implement pipeline trigger rules 5 questions
- 3.3.7Design and implement a strategy for job execution order, including parallelism and multi-stage pipelines 5 questions
- 3.3.8Create reusable pipeline elements, including YAML templates, task groups, variables, and variable groups 5 questions
- 3.3.9Design and implement checks and approvals by using YAML-based environments 4 questions
- 3.3.10Design and implement GitHub Agentic Workflows New in AZ-4019 questions
When is Azure Pipelines the right choice, and how should it connect to GitHub repositories?
audit (organization-wide audit_summary.md, local files only), forecast (usage from past runs), dry-run (one converted workflow) and migrate (opens a pull request). Service connections and pre-deployment approvals are manual; gates are unsupported. When Azure Pipelines builds GitHub code, use the Azure Pipelines GitHub App: it runs under the Azure Pipelines identity and is the only authentication type that posts GitHub Checks. A pipeline appears as a required status check only with the app and after a run in the past week; OAuth and PAT act as a person. Securely build pull requests from forked repositories, set at organization level, withholds secrets and requires a /azp run comment from a collaborator with Write permission. It's on by default only for organizations created from September 2023.Source: Migrating from Azure DevOps with GitHub Actions Importer; Build GitHub repositories
Which agent or runner hosting fits our cost, network and maintenance requirements?
Microsoft.DevOpsInfrastructure/pools, give the DevOpsInfrastructure principal Reader and Network Contributor, keep pool and network in one region. One pool serves several organizations and images, and the default is stateless (Fresh agent every time); stateful agents are reused up to seven days. Scale set agents need overprovisioning disabled and a manual upgrade policy. GitHub larger runners are billed even in public repositories and are the only runners with Azure private networking; Actions Runner Controller runs ephemeral Kubernetes runners per job.Source: Compare Managed DevOps Pools with Azure Virtual Machine Scale Set agents; Configure networking
How do I get Copilot to write pipeline YAML I can trust?
.github/instructions/*.instructions.md with an applyTo glob in the frontmatter. On GitHub.com both Copilot cloud agent and Copilot code review use them for matching files; excludeAgent: "code-review" or "cloud-agent" removes one. Review generated YAML for logic, not only syntax: a custom stage condition replaces the default succeeded(), so a branch-only condition publishes even after tests fail. Write and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/main')). When converting, step templates map to composite actions and job-level reuse to reusable workflows. For a failed run, Explain error beside the failed check or on the run summary opens Copilot Chat with the failure context.Source: Adding repository custom instructions for GitHub Copilot; Generate build pipelines and publish accepted outputs with Copilot
How do triggers, dependencies and concurrency control what runs and when?
pr: section; PR validation is a Build validation branch policy. batch: true folds pushes made during a run into one next run, and path filters can't use variables. Cron schedules are in UTC and skip days with no changes unless always: true. A resources.pipelines trigger starts a pipeline when another completes; it can't be defined in a template. In Actions, workflow_run fires whatever the conclusion, so test github.event.workflow_run.conclusion == 'success'. Stages run in file order; dependsOn: [] starts a stage at once. Read an output (isOutput=true) from an earlier stage with stageDependencies.<stage>.<job>.outputs['<step>.<var>']. Matrix fail-fast defaults to true; max-parallel caps legs. A concurrency group runs one job at a time and keeps one pending; queue: max holds up to 100 and can't be combined with cancel-in-progress: true.Source: Configure pipeline triggers; Control the concurrency of workflows and jobs
Template, task group or variable group, and where do approvals belong?
parameters in a shared repository, referenced as template: file@repo, is changed in one place. Parameters restricted with values: are validated at template expansion, so a bad value fails the run before any job starts. An extends template fixes the pipeline structure, and the Required template check on a resource fails runs that don't extend it; an include template enforces nothing. A Key Vault-linked variable group refreshes mapped secrets each run but adds new vault secrets only when you map them. In Actions, a composite action runs inside the caller's job; a reusable workflow runs as its own job. Put approvals on a YAML environment, not in a task. Exclusive lock with lockBehavior: sequential deploys every waiting run in turn; the default runLatest deploys only the newest. GitHub environments can prevent self-review.Source: How to use YAML templates for reusable and secure pipelines; Define approvals and checks
What is a GitHub Agentic Workflow and how is it kept safe?
.github/workflows/: YAML frontmatter (on, permissions, safe-outputs, engine, network, tools) plus natural-language instructions. gh aw compile generates the .lock.yml that Actions runs; after a frontmatter change, recompile and commit both files. The agent job is read-only. Writes such as create-issue or add-comment are requested as safe outputs and applied by a separate job with scoped write permission; staged: true previews them in the step summary. copilot is the default engine; in organization repositories copilot-requests: write bills Copilot to the organization without a PAT, once an admin allows organization-billed Copilot CLI usage. network: defaults allows only basic infrastructure, so add ecosystems such as python. on.roles is exact-match, default [admin, maintainer, write], and on.manual-approval waits on an environment. Builds and multi-stage deployments stay in standard Actions.Source: Creating GitHub Agentic Workflows; GitHub Agentic Workflows (github/gh-aw)
Traps in 3.3 questions
- Adding a branch filter as a stage condition looks harmless, but it replaces the default succeeded(), so the stage runs even after a failed build unless you wrap it in and(succeeded(), ...).
- The pr: section looks like the way to validate pull requests in Azure Repos Git, but it's ignored there; only a Build validation branch policy queues PR builds.
- OAuth and PAT connections build GitHub repositories, but only the Azure Pipelines GitHub App posts GitHub Checks and lets the pipeline be picked as a required status check.
- Editing the .lock.yml of an agentic workflow looks faster, but the compiler overwrites it; change the markdown frontmatter and run gh aw compile.
54 questions in the bank test task 3.3. Practice Domain 3
3.4 Design and implement deployments
Task 3.4 covers how a release reaches production: exposure strategies, ordering of dependent deployments, zero-downtime mechanics, the hotfix path, automatic halting and rollback, and the deployment tasks for containers and databases. Most questions hinge on picking the one built-in feature that meets a constraint such as no redeployment, no custom code or a Linux app.
- 3.4.1Design a deployment strategy, including blue-green, canary, ring, progressive exposure, feature flags, and A/B testing 2 questions
- 3.4.2Design a pipeline to ensure that dependency deployments are reliably ordered 2 questions
- 3.4.3Plan for minimizing downtime during deployments by using load balancing, deployment slot usage and swap, and rolling deployments 3 questions
- 3.4.4Design a hotfix path plan for responding to high-priority code fixes 2 questions
- 3.4.5Design and implement a resiliency strategy for deployment 3 questions
- 3.4.6Implement deployment by using containers, binaries, scripts, and database tasks 2 questions
Which App Configuration feature flag do I use for a percentage rollout, and which for an A/B test?
Source: Roll out features to targeted audiences; Use variant feature flags
What do the runOnce, rolling and canary strategies of a deployment job do?
deployment job targets an environment and records deployment history against it. runOnce runs the preDeploy, deploy, routeTraffic and postRouteTraffic hooks once, then on: success or on: failure; on: failure is the documented place for rollback steps. rolling works only with virtual machine resources: maxParallel (a number or x%) sets how many VMs update per iteration while the rest keep serving. canary runs preDeploy once, then repeats the other hooks for each value in increments. With KubernetesManifest@1, the default canary split is by replica count, so the percentage is approximate; trafficSplitMethod: smi splits per request through SMI TrafficSplit objects, with replicas set by baselineAndCanaryReplicas. $(strategy.action) passes deploy, promote or reject to the task; promote finalizes the canary by replacing the stable workload.strategy:
canary:
increments: [10, 20]
deploy:
steps:
- task: KubernetesManifest@1
inputs:
action: $(strategy.action)
strategy: $(strategy.name)
percentage: $(strategy.increment)Source: Deployment jobs; KubernetesManifest@1 - Deploy to Kubernetes v1 task
How do App Service deployment slots and scale set upgrades avoid downtime?
WEBSITE_SWAP_WARMUP_PING_PATH and WEBSITE_SWAP_WARMUP_PING_STATUSES define the warm-up request and stop the swap on an unlisted status code; WEBSITE_WARMUP_PATH fires on every restart instead. Swapping again restores the last known good app. Auto swap isn't supported on Linux or Web App for Containers. For Virtual Machine Scale Sets, the Rolling upgrade policy updates instances in batches with unhealthy-instance limits; Automatic mode may take every instance down at once, and Flexible orchestration needs the Application Health extension for rolling upgrades.Source: Set up staging environments in Azure App Service; Upgrade policy modes for Virtual Machine Scale Sets
How do I make dependent deployments run in a fixed order?
dependsOn: a stage starts only after every stage it lists has completed and, by default, succeeded. Stages without dependsOn run one after another in file order, and dependsOn: [] removes all dependencies so the stage starts immediately. To run a database stage before the API while documentation still deploys in parallel, make DeployApi depend on DeployDb and let DeployDocs depend only on Build. An exclusive lock check serializes separate runs that use the same resource; it doesn't order stages inside a run. In GitHub Actions, a concurrency group allows one running and one pending run, and a newly queued run cancels the pending one. queue: max lets up to 100 runs wait and processes them one at a time in the order they started waiting. It can't be combined with cancel-in-progress: true; that combination fails workflow validation.Source: Stages in Azure Pipelines; Control the concurrency of workflows and jobs
What is the hotfix path in Release Flow, and how does the fix reach a release branch?
main: the fix is made on a topic branch, reviewed, merged to main, then cherry-picked into the release branch. Release branches are never merged back into main, so fixing main first guarantees the next release branch already contains the fix. A fix made only on the release branch is easily lost. In Azure Repos, the Cherry-pick action on the completed pull request creates a topic branch from the target you choose, applies all of the pull request's changes on the server and opens a new pull request into that branch, where the release branch's reviewer and build validation policies still apply. A pull request from main into the release branch would carry every change merged since the branch was cut. A completed pull request can't be reactivated or retargeted; only abandoned ones can be reactivated.Source: How Microsoft develops with DevOps; Copy changes to a branch with cherry-pick
How do I stop a bad rollout automatically and review database changes before they run?
SqlAzureDacpacDeployment@1 runs SqlPackage. The Publish action applies the .dacpac; Script writes the incremental Transact-SQL that a publish would execute; DeployReport returns an XML description of the changes; DriftReport lists changes made to a registered database. Publish the script as an artifact and put the Publish stage behind an approval so a DBA reviews the exact statements.Source: Pipeline deployment approvals; SqlAzureDacpacDeployment@1 - Azure SQL Database deployment v1 task
Traps in 3.4 questions
- Slot traffic routing (Traffic %) is not a feature flag: it splits requests between two deployed builds, pins a client for one hour by cookie, and can't always include QA or exclude a group.
- The rolling deployment job strategy is supported only for virtual machine resources; for Kubernetes canaries use the canary strategy with KubernetesManifest@1.
- A Key Vault reference is just an app setting, so it still swaps with the content; only marking it as a deployment slot setting keeps the value with its slot.
- An exclusive lock orders separate pipeline runs on one resource, while dependsOn orders stages inside one run; questions about a migration finishing before the API inside one pipeline want dependsOn.
14 questions in the bank test task 3.4. Practice Domain 3
3.5 Design and implement infrastructure as code (IaC)
Task 3.5 tests whether you can choose an IaC and configuration approach that keeps Azure resources, guest OS settings and application configuration matched to code. Questions hinge on deployment modes versus deployment stacks, what-if output, Terraform state storage and drift correction.
- 3.5.1Recommend a strategy for IaC and configuration management 3 questions
- 3.5.2Implement a configuration management strategy for application infrastructure 3 questions
How do I delete resources removed from a Bicep file: complete mode or a deployment stack?
az stack group create, az stack sub create, az stack mg create) manages its resources as a unit. --action-on-unmanage decides what happens to resources dropped from the template: detachAll leaves them in Azure, deleteResources deletes managed resources, and deleteAll also deletes managed resource groups. --deny-settings-mode creates a deny assignment that applies to everyone regardless of RBAC role: denyDelete blocks deletion, denyWriteAndDelete blocks updates and deletion. --deny-settings-excluded-principals exempts up to five Microsoft Entra principals; excluding a group exempts its members, which suits break-glass access. Being Stack Owner lets a user manage the stack, not bypass its deny assignment. Redeploying a template spec in incremental mode still deletes nothing.Source: Create and deploy Azure deployment stacks in Bicep; Azure Resource Manager deployment modes
Where should Terraform state live when several pipelines run terraform apply?
azurerm backend, which stores state as a blob in an Azure Storage account. The blob is locked automatically before any operation that writes state, so two concurrent applies from Azure Pipelines and GitHub Actions can't corrupt it, and Azure Storage encrypts the data at rest. It needs no extra servers. Pipeline artifacts and a file share on one agent offer no state locking, and Key Vault is not a Terraform backend. Microsoft also suggests prevent_destroy = true in the lifecycle block of the storage account resource to avoid deleting the state account by accident.terraform {
backend "azurerm" {
resource_group_name = "tfstate"
storage_account_name = "<storage_account_name>"
container_name = "tfstate"
key = "terraform.tfstate"
}
}Source: Store Terraform state in Azure Storage
How do I check a Bicep change in a pipeline before it deploys, and why do portal edits get reverted?
az deployment group what-if predicts changes. By default it prints a text summary; --no-pretty-print returns JSON a script can inspect. Each resource gets a change type: Create, Delete (only in complete mode), Ignore, NoChange, Modify, Deploy (not enough information to decide) or NoEffect. The default result format, FullResourcePayloads, includes property-level details; ResourceIdOnly lists only resource IDs. --confirm-with-what-if (-c) on az deployment group create prompts a person, so it doesn't suit an unattended gate. Redeploying in incremental mode reapplies every property of a resource; properties the template doesn't specify are reset to their defaults, not left as edited in the portal. Declare settings such as httpsOnly in the Bicep file so each redeployment is idempotent and drift is removed on the next run.Source: Bicep deployment what-if operation; Azure Resource Manager deployment modes
How do I manage OS settings inside VMs and application configuration as code?
Source: What is Azure Machine Configuration?; Snapshots in Azure App Configuration
Traps in 3.5 questions
- Complete mode does delete resources missing from the template, but the expected answer for deletions is a deployment stack because complete mode is not recommended and is being deprecated.
- denyDelete still allows updates; only denyWriteAndDelete blocks both, and Stack Owner does not exempt anyone from the deny assignment.
- --confirm-with-what-if prompts a human; --no-pretty-print is the switch that makes what-if output machine-readable.
- Apply and Monitor reports drift but never fixes it; only Apply and Autocorrect brings a machine back into conformance.
6 questions in the bank test task 3.5. Practice Domain 3
3.6 Maintain Azure DevOps pipelines and GitHub Actions
Task 3.6 is about running pipelines over time: measuring pass rate, duration and flaky tests, cutting run time and agent effort, and keeping runs, artifacts and packages only as long as needed. Questions hinge on which built-in report or setting does the job and on exact retention rules.
- 3.6.1Monitor pipeline health, including failure rate, duration, and flaky tests 2 questions
- 3.6.2Optimize a pipeline for cost, time, performance, and reliability 3 questions
- 3.6.3Design and implement a retention strategy for pipeline artifacts and dependencies 3 questions
Where do I see pipeline failure rate and duration trends in Azure Pipelines and GitHub Actions?
Source: Pipeline reports; Viewing GitHub Actions metrics for your organization
How does Azure Pipelines detect flaky tests and keep them from failing builds?
continueOnError would hide real regressions too.Source: Manage flaky tests
Which settings cut checkout and dependency-restore time in Azure Pipelines?
Cache@2 restores files by key, usually built from a static string, $(Agent.OS) and a lock file hash. On a miss, restoreKeys matches by prefix and restores the most recently created entry, so a changed lock file still starts warm. Caches are immutable; a new one is saved under the exact key at the end of the job. Caches are scoped per pipeline and branch, pull request runs can read the target branch cache but not write to it, and caches expire after seven days without use. cacheHitVar only reports whether a restore happened. Pipeline artifacts share outputs between jobs; they aren't a cache. For large repositories, fetchDepth: 1 fetches only the commit being built and sparseCheckoutDirectories writes only the listed folders; fetchDepth: 0 fetches full history.- checkout: self
fetchDepth: 1
- task: Cache@2
inputs:
key: '"yarn" | "$(Agent.OS)" | yarn.lock'
restoreKeys: |
"yarn" | "$(Agent.OS)"
path: $(YARN_CACHE_FOLDER)Source: Pipeline caching; steps.checkout definition
When should I choose Managed DevOps Pools over Microsoft-hosted or scale set agents?
Source: Managed DevOps Pools overview
How long does Azure Pipelines keep runs, and how do I keep production runs longer?
Source: Retention policies for Azure Pipelines
How do I set retention for GitHub Actions artifacts and Azure Artifacts packages?
retention-days input of actions/upload-artifact shortens one artifact's lifetime but can't exceed the configured limit. In an Azure Artifacts feed, a Feed Owner enables package retention with Maximum number of versions per package and Days to keep recently downloaded packages; a version is deleted only when both conditions are met. Versions promoted to a view are exempt, and promotion can't be undone. Deleted packages sit in the Recycle Bin for 30 days and still count toward storage. Unlisting only hides a version, and pipeline run retention never deletes packages.Source: Configuring the retention period for checks, workflow runs, commit statuses, artifacts, and logs in your organization; Delete and recover packages
Traps in 3.6 questions
- Usage metrics show Actions minutes consumed; failure rate and queue time are in Actions performance metrics, which a custom organization role can grant without owner rights.
- cacheHitVar does not create a fallback; restoreKeys is what restores the newest cache by prefix when the exact key misses.
- Azure Pipelines run retention never governs NuGet, npm or Universal packages; feed retention policies and views do.
- Per-pipeline retention rules are gone; a question that needs only production runs kept longer wants a retention lease, not a longer project-wide retention period.
8 questions in the bank test task 3.6. Practice Domain 3

Free Domain 3 questions
A repository uses GitHub Agentic Workflows. An engineer edits the YAML frontmatter of .github/workflows/issue-triage.md to add the add-labels safe output, pushes only that file, and finds that the next run still cannot apply labels. You need the change to take effect. Which two actions should you perform? Each correct answer presents part of the solution. (Choose TWO.)
Choose TWO.
- Edit issue-triage.lock.yml manually to add a job that applies the labels.
- Run gh aw compile issue-triage to regenerate the compiled workflow.
- Run gh aw run issue-triage so the runner reloads the markdown source.
- Add issues: write to the frontmatter permissions for the agent job.
- Commit the regenerated issue-triage.lock.yml together with the .md file.
Show answer and explanation
Answer: B and E. GitHub Actions executes the compiled .lock.yml, not the markdown source. Frontmatter changes such as safe-outputs require gh aw compile to regenerate the lock file, and both the .md and .lock.yml files must be committed and pushed.
Why the other options are wrong:
- A. The lock file is generated by the compiler; manual edits drift from the source and are overwritten on the next compile.
- C. gh aw run only triggers the existing compiled workflow; it doesn't apply frontmatter changes.
- D. Writes are applied by the separate safe-outputs job; giving the agent job write access breaks the read-only design and still leaves the lock file stale.
Documentation: Creating GitHub Agentic Workflows; GitHub Agentic Workflows (github/gh-aw)
Contoso, Ltd. hosts all source code in GitHub Enterprise Cloud and builds with GitHub Actions. The data platform team publishes internal Python libraries and Rust crates, and developers install them together with open-source dependencies from PyPI and crates.io. Security requires that every public package a build consumes is cached in a company-controlled store so that builds keep working when a public registry is unavailable. You need to recommend a package management solution. What should you recommend?
- GitHub Packages, with a package registry linked to each library repository
- An Azure Artifacts feed with upstream sources enabled for PyPI and crates.io
- Azure Artifacts Universal Packages, with one Universal Package per library release
- The organization's linked artifacts page in GitHub, pointing at an external package store
Show answer and explanation
Answer: B. Azure Artifacts feeds host Python and Cargo packages, and upstream sources for PyPI and crates.io automatically save every public package that a collaborator or build installs, so restores keep working when the public registry is down. GitHub Packages offers registries for npm, RubyGems, Maven, Gradle, NuGet, and containers only, so it can't host the Python or Cargo packages at all.
Why the other options are wrong:
- A. GitHub Packages has no Python or Cargo registry and doesn't cache packages from public registries.
- C. Universal Packages store arbitrary files, but pip and cargo can't install from them and they don't cache PyPI or crates.io.
- D. The linked artifacts page stores only metadata about artifacts; it doesn't host package files or cache public packages.
Documentation: What are upstream sources?; Introduction to GitHub Packages
Contoso has an Azure Artifacts feed named Platform with two upstream sources, listed in this order: npmjs.com, then an internal feed view named Hardened@Release. The security team rebuilds a few open-source npm packages with patches, publishes them to Hardened by using the same package names and versions as the public originals, and promotes them to its @Release view. None of these packages have been installed through Platform yet. You need builds that restore from Platform to receive the rebuilt versions. What should you do?
- Move the Hardened@Release upstream source above npmjs.com in the feed settings
- Add the Hardened feed as an additional registry entry in each project's .npmrc file
- Promote the rebuilt packages to the @Release view of the Platform feed
- Change the default view of the Platform feed from @Local to @Release
Show answer and explanation
Answer: A. A feed resolves packages in a fixed order: packages published to the feed, then packages already saved from upstreams, then each upstream source in the order configured. Microsoft recommends placing the source that contains customized open-source packages before public registries, so the rebuilt versions win.
Why the other options are wrong:
- B. Referencing several feeds in a client configuration file makes restores nondeterministic; the guidance is one feed with upstream sources.
- C. The rebuilt packages live in Hardened, not in Platform, and views don't change upstream search order.
- D. The default view controls what consumers of Platform see; it doesn't change the order in which upstream sources are searched.
Documentation: What are upstream sources?
A .NET service depends on the Fabrikam.Messaging NuGet package, which follows Semantic Versioning. Version 4.1.3 fixed a message-loss bug, and the service must never restore an earlier version. The vendor has announced breaking changes in version 5.0. You need to set the Version attribute of the PackageReference so that restore accepts 4.1.3 and any later compatible release, but never 5.0 or later. Which value should you use?
- (4.1.3,5.0)
- [4.1.3,5.0]
- [4.1.3,5.0)
- 4.*
Show answer and explanation
Answer: C. In NuGet range notation, a square bracket is inclusive and a parenthesis is exclusive, so [4.1.3,5.0) means 4.1.3 ≤ x < 5.0. That keeps the bug-fixed release as the floor and stops at the next major version, which is where SemVer signals breaking changes.
Why the other options are wrong:
- A. The leading parenthesis makes 4.1.3 itself unacceptable, so the bug-fixed release would be excluded.
- B. The closing square bracket includes 5.0, which contains the announced breaking changes.
- D. A floating 4.* range accepts any 4.x.y version, including releases earlier than 4.1.3 that lack the fix.
Documentation: NuGet Package Version Reference
A YAML pipeline versions its build artifacts by using the variables shown. The pipeline ran six times with minor set to 4. A developer then changed minor to 5, and the pipeline ran twice. The change was reverted to minor: 4 in the next commit. What is the value of patch in the first run after the revert?
variables:
major: 2
minor: 4
patch: $[counter(format('{0}.{1}', variables['major'], variables['minor']), 0)]
steps:
- script: dotnet pack -c Release -p:Version=$(major).$(minor).$(patch)
- 0
- 2
- 6
- 8
Show answer and explanation
Answer: C. The counter function keeps a separate value for each unique prefix. The prefix 2.4 produced 0 through 5 in the first six runs, and the prefix 2.5 started its own sequence at the seed. When minor returns to 4, the counter resumes where the 2.4 prefix left off, so the next value is 6.
Why the other options are wrong:
- A. The counter returns the seed only for a prefix it hasn't seen before; the prefix 2.4 was already used.
- B. 2 would be the next value for the prefix 2.5, which has its own sequence.
- D. Counters aren't shared across prefixes, so the two runs with minor set to 5 don't advance the 2.4 counter.
Documentation: Expressions
Contoso deploys a web app by using a multi-stage YAML pipeline in Azure Pipelines. After the canary stage, the production stage must start only if no Azure Monitor alert rules for the app are firing. Developers can edit the pipeline YAML, but the operations team must enforce this rule without relying on developers to keep a step in the YAML file. What should you configure?
- An AzureMonitor@1 task in an agentless job at the start of the production stage
- A Query Azure Monitor alerts check on the environment that the production stage targets
- A ManualValidation@0 task that asks operators to confirm that no alerts are active
- A pre-deployment gate in a classic release pipeline that queries Azure Monitor alerts
Show answer and explanation
Answer: B. Checks are defined on protected resources such as environments by the resource owner, not in the YAML file, so pipeline authors can't remove them. The Query Azure Monitor alerts check succeeds only if no alert rules are activated at the time of evaluation and is reevaluated until it passes or times out.
Why the other options are wrong:
- A. A task in the YAML file can be removed or changed by anyone who edits the pipeline.
- C. A manual confirmation isn't an automated gate and still lives in the YAML that developers can edit.
- D. Classic release gates require moving the deployment out of the existing YAML pipeline into a classic release pipeline.
Documentation: Define approvals and checks
Contoso uses GitHub Enterprise Cloud with Enterprise Managed Users and has 120 repositories in one organization. All members have Copilot Business licenses. As a quality gate, every pull request that targets a default branch must receive a Copilot code review automatically, and Copilot must review the pull request again whenever new commits are pushed. You need to meet the requirement with the least administrative effort. What should you do?
- Ask each developer to turn on Automatic Copilot code review in their personal Copilot settings
- Create an organization ruleset with the Copilot code review rule and Review new pushes selected
- Add a workflow to every repository that calls request_copilot_review through the GitHub MCP server
- Add a CODEOWNERS file to every repository that names Copilot as the owner of all paths
Show answer and explanation
Answer: B. An organization branch ruleset can target many repositories at once and include the Automatically request Copilot code review rule; selecting Review new pushes makes Copilot review each new push, not just the first one. This is one configuration object for all 120 repositories.
Why the other options are wrong:
- A. Automatic review in personal settings isn't available for managed user accounts and depends on every developer opting in.
- C. A workflow per repository must be created and maintained 120 times and needs a token, which is more administrative effort.
- D. Rulesets and Copilot settings are the documented ways to trigger automatic Copilot reviews; CODEOWNERS isn't one of them.
Documentation: Configuring code review by GitHub Copilot
A YAML pipeline runs pytest and publishes the results as shown. When all tests pass, the results appear on the Tests tab. When any test fails, the Tests tab is empty, so developers can't see which test failed. The run must still be marked as failed when a test fails. What should you change?
steps:
- script: python -m pytest tests --junitxml=$(Build.ArtifactStagingDirectory)/TEST-results.xml
displayName: Run tests
- task: PublishTestResults@2
inputs:
testResultsFormat: JUnit
testResultsFiles: '**/TEST-*.xml'
searchFolder: $(Build.ArtifactStagingDirectory)
- Add continueOnError: true to the Run tests step so that later steps keep running
- Set failTaskOnMissingResultsFile: true on the PublishTestResults@2 task
- Set mergeTestResults: true on the PublishTestResults@2 task
- Add condition: succeededOrFailed() to the PublishTestResults@2 task
Show answer and explanation
Answer: D. When pytest returns a non-zero exit code, the step fails and later steps are skipped under the default condition, so the results file is never published. The succeededOrFailed() condition runs the publish step even after a previous failure, while the failed test step still makes the run fail.
Why the other options are wrong:
- A. continueOnError makes the run partially succeeded instead of failed, which breaks the requirement.
- B. The task is skipped after the test failure, so a setting on the task never takes effect.
- C. Merging affects how several result files are grouped into test runs, not whether the task runs after a failure.
Documentation: PublishTestResults@2 - Publish Test Results v2 task; Expressions
Contoso builds a service in Azure Repos with a YAML pipeline named web-ci, which publishes Cobertura coverage by using PublishCodeCoverageResults@2. The repository root contains the azurepipelines-coverage.yml file shown. Pull requests show a failed coverage status, but developers can still complete them. You need to block pull request completion when diff coverage is below the target. What should you do?
coverage:
status:
comments: on
diff:
target: 80%
- Set failIfCoverageEmpty to true on the PublishCodeCoverageResults@2 task
- Raise the diff target in azurepipelines-coverage.yml so that the coverage status check is stricter
- Switch to PublishCodeCoverageResults@1 so that low coverage fails the build validation run
- Add a branch policy on main that requires the web-ci/codecoverage status to succeed
Show answer and explanation
Answer: D. The diff coverage status that Azure Pipelines posts to a pull request is advisory by default. To enforce it, configure a branch policy that requires the coverage status, which follows the naming convention {pipeline name}/codecoverage.
Why the other options are wrong:
- A. failIfCoverageEmpty fails the task only when no coverage data is produced, not when diff coverage is low.
- B. A higher target changes the threshold, but the status stays advisory without a branch policy.
- C. With the v1 task, the coverage policy gets stuck and comments aren't generated; v2 is required.
Documentation: Review and configure code coverage results in Azure Pipelines
Fabrikam has an Azure DevOps Services organization. A legacy .NET Framework application is stored in an Azure Repos TFVC repository, and the source control team will not migrate it to Git before next year. You need to build the application automatically on every check-in starting this quarter. The solution must use Azure DevOps and must not require moving the source code. What should you use?
- A YAML pipeline in Azure Pipelines whose azure-pipelines.yml file is stored in the TFVC repository.
- A GitHub Actions workflow on a self-hosted runner that runs the TFVC command-line client to get sources.
- A classic build pipeline in Azure Pipelines with a continuous integration trigger on the TFVC path.
- A YAML pipeline in Azure Pipelines that declares the TFVC repository as a repository resource.
Show answer and explanation
Answer: C. Azure Repos TFVC is supported only by the classic editor in Azure Pipelines; YAML pipelines don't support TFVC. A classic build pipeline with a CI trigger builds every check-in without moving the code and stays inside Azure DevOps.
Why the other options are wrong:
- A. YAML pipelines can't be stored in or triggered from a TFVC repository.
- B. This leaves Azure DevOps for CI and needs a custom runner setup, which breaks the stated constraint.
- D. YAML repository resources support Git-based providers only, not TFVC.
Documentation: Build source repositories
Your Azure DevOps organization uses the Microsoft-hosted free tier for private projects. Builds queue often, and jobs that run longer than 60 minutes are stopped. Yesterday, a Project Collection Administrator purchased one Microsoft-hosted parallel job, yet only one job still runs at a time. You need two Microsoft-hosted jobs to run concurrently without the 60-minute job limit. What should you do?
- Change the quantity of paid Microsoft-hosted parallel jobs from one to two.
- Add a second agent to the Azure Pipelines pool and keep the one paid job.
- Open a support request to raise the limit of 25 Microsoft-hosted parallel jobs.
- Re-enable the free tier so its job is added on top of the purchased parallel job.
Show answer and explanation
Answer: A. When you buy your first Microsoft-hosted parallel job while on the free tier, the organization still has one parallel job; the purchase only removes the time limits. To run two jobs at once you must purchase two Microsoft-hosted parallel jobs.
Why the other options are wrong:
- B. You can't register agents in the Microsoft-hosted Azure Pipelines pool; concurrency is governed by parallel jobs.
- C. The 25-job cap for new organizations isn't the constraint here; the organization owns only one job.
- D. The free grant isn't stacked on the first paid job; the first purchase only lifts the time limits.
Documentation: Configure and pay for parallel jobs
Contoso hosts its repositories in a GitHub organization and builds them with Azure Pipelines YAML pipelines. The pipelines connect by using an OAuth service connection that a lead developer authorized, and that developer is leaving. You need builds and GitHub status updates to stop depending on any individual's GitHub identity, and you need build, test, and code coverage results to appear in GitHub Checks. What should you do?
- Create a GitHub PAT with the repo and admin:repo_hook scopes and use it in a new service connection.
- Install the Azure Pipelines GitHub App in the organization for the required repositories.
- Re-authorize the OAuth service connection by using a GitHub organization owner's account.
- Create a GitHub Enterprise Server service connection that points to the organization's URL.
Show answer and explanation
Answer: B. With the Azure Pipelines GitHub App, builds and status updates use the Azure Pipelines identity instead of a personal one, and the app is the only authentication type that works with GitHub Checks. Microsoft recommends it for CI pipelines.
Why the other options are wrong:
- A. A PAT still acts as a personal GitHub identity and doesn't work with GitHub Checks.
- C. OAuth still uses a personal identity, just a different one, and Checks remain unavailable.
- D. That connection type targets GitHub Enterprise Server instances, not GitHub.com organizations.
Documentation: Build GitHub repositories
You ask GitHub Copilot Chat to add a Publish stage to an Azure Pipelines YAML pipeline. Publish must run only for the main branch and only after the Build stage, including its tests, succeeds. Copilot proposes the excerpt shown. During review, you find that Publish runs on main even when tests in Build fail. What should you change?
stages:
- stage: Build
jobs:
- job: BuildAndTest
steps:
- script: dotnet test App.sln -c Release
- stage: Publish
dependsOn: Build
condition: eq(variables['Build.SourceBranch'], 'refs/heads/main')
jobs:
- job: PublishArtifact
steps:
- publish: $(Build.ArtifactStagingDirectory)
artifact: app
- Add continueOnError: false to the dotnet test step in the BuildAndTest job.
- Change the condition to and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/main')).
- Remove dependsOn: Build so that the stage waits for every previous stage by default.
- Ask Copilot to regenerate the stage, and accept the result once the YAML passes validation.
Show answer and explanation
Answer: B. A custom condition replaces the default succeeded() check, so the stage runs whenever the branch expression is true. Wrapping it in and(succeeded(), ...) keeps the branch restriction and also requires Build to succeed, which is the correction the Copilot review guidance shows.
Why the other options are wrong:
- A. continueOnError is already false by default; the failed test step fails Build, but the condition ignores that.
- C. The custom condition would still override the success check whatever the dependency.
- D. Passing validation shows only that the YAML parses, not that a failed test blocks publishing.
Documentation: Generate build pipelines and publish accepted outputs with Copilot
You have an Azure DevOps project named Fabrikam that hosts its code in Azure Repos Git. A YAML pipeline named web-ci contains a pr: section that lists main as the target branch. Developers report that opening a pull request into main never queues web-ci, although CI runs on push work as expected. You need every pull request that targets main to be validated by web-ci before the pull request can be completed. What should you do?
- Add autoCancel: true and drafts: true under the existing pr: section of web-ci.
- Add a Build validation branch policy on main that queues the web-ci pipeline.
- Replace the pr: section with a trigger: section that includes the refs/pull/* refs.
- Add the project's build service identity as a required reviewer on the main branch.
Show answer and explanation
Answer: B. For Azure Repos Git, pull request validation is implemented with branch policies, not with the YAML pr: keyword, which is ignored for this repository type. Configuring a Build validation policy on the target branch (main) queues web-ci for each pull request and can block completion until the build succeeds.
Why the other options are wrong:
- A. Every pr: setting, including autoCancel and drafts, is ignored for Azure Repos Git, so editing that section changes nothing.
- C. A trigger: section defines CI runs on pushes to branches; it does not create pull request validation or gate completion.
- D. A required reviewer is an approval requirement for people; it never queues a pipeline run.
Documentation: Build Azure Repos Git repositories
You have an ASP.NET Core web app named Checkout that reads its feature flags from an Azure App Configuration store by using the .NET feature management library. A redesigned payment flow is merged behind a flag named NewPayments. The product owner wants the flag on immediately for the internal QA group, then on for 5 percent of all other users, raising that percentage each week without redeploying the app. Members of the Finance group must not see the feature until the rollout reaches 100 percent. What should you configure on the NewPayments flag?
- A time window filter that enables the flag on each scheduled weekly rollout date.
- A custom feature filter that reads the group claim and hard-codes the 5 percent rate.
- A targeting filter with QA included, Finance excluded, and a default percentage of 5.
- An App Service staging slot that runs the new flow and receives 5 percent of the traffic.
Show answer and explanation
Answer: C. The built-in targeting filter combines included groups, excluded groups and a default percentage of the remaining user base. Exclusions win over inclusions and percentages, so Finance stays off, QA is always on, and the default percentage can be raised in App Configuration without a redeployment.
Why the other options are wrong:
- A. A time window filter turns the flag on for everyone during a period; it cannot target QA, exclude Finance or expose only a percentage of users.
- B. Hard-coding the percentage in a custom filter means every weekly increase requires a code change and a redeployment.
- D. Slot traffic routing splits requests randomly between two deployed builds; it cannot always include QA or always exclude Finance.
Documentation: Roll out features to targeted audiences
The full bank has 97 more Domain 3 questions and 20-question Domain 3 drills that serve unseen questions first.
Domain 3 drill: $19.99