AZ-400 Continuous Integration 3 — Questions and Answers
Question 1: A team needs to enforce that every pull request passes a build pipeline before merging. Which Azure DevOps feature should they configure?
- Branch lock policies
- Build validation branch policies (Correct answer)
- Pipeline triggers
- Required reviewers
Correct answer: Build validation branch policies
Build validation policies in Azure Repos require a specified pipeline to pass successfully before a pull request can be completed.
Question 2: What is the role of a 'self-hosted agent' in Azure Pipelines compared to a Microsoft-hosted agent?
- It runs faster due to dedicated Azure hardware
- It runs on infrastructure you manage, allowing custom software and network access (Correct answer)
- It is free and has no job time limits
- It automatically scales based on pipeline demand
Correct answer: It runs on infrastructure you manage, allowing custom software and network access
Self-hosted agents run on your own VMs or containers, giving you control over installed tools, network connectivity, and persistent caches between runs.
Question 3: Which Azure Pipelines variable predefined at runtime holds the unique identifier of the current pipeline run?
- $(Build.DefinitionId)
- $(Build.BuildId) (Correct answer)
- $(System.TeamProjectId)
- $(Agent.WorkFolder)
Correct answer: $(Build.BuildId)
$(Build.BuildId) is a predefined variable containing the unique numeric ID assigned to each pipeline run.
Question 4: What does the 'pool' keyword specify in an Azure Pipelines YAML job?
- The set of variables available to the job
- The agent pool or specific agent where the job's steps execute (Correct answer)
- The list of services required by the job
- The retention policy for the job's artifacts
Correct answer: The agent pool or specific agent where the job's steps execute
The pool keyword designates which agent pool (or a specific agent) should be used to run the job's steps.
Question 5: A CI pipeline runs on every commit and takes 45 minutes. The team wants to reduce feedback time. What Azure Pipelines feature allows running independent test suites simultaneously?
- Parallel jobs across multiple stages
- Parallel jobs within a single stage using multiple job entries (Correct answer)
- Pipeline caching
- Deployment groups
Correct answer: Parallel jobs within a single stage using multiple job entries
Defining multiple jobs within the same stage runs them in parallel (subject to available agents), reducing total wall-clock time for independent work.
Question 6: Which task should you use in Azure Pipelines to cache NuGet packages and reduce restore times on repeated builds?
- PublishBuildArtifacts
- Cache (Correct answer)
- DownloadPipelineArtifact
- NuGetAuthenticate
Correct answer: Cache
The Cache task stores and restores directories (such as the NuGet package cache) between pipeline runs using a cache key, reducing download time.
Question 7: In Azure DevOps, what is a 'service connection' used for in the context of CI pipelines?
- Connecting pipeline stages within the same organization
- Storing authenticated credentials to access external services like Azure, Docker Hub, or GitHub (Correct answer)
- Defining network routes between pipeline agents
- Linking a pipeline to a specific Git repository
Correct answer: Storing authenticated credentials to access external services like Azure, Docker Hub, or GitHub
Service connections securely store authentication details (tokens, service principals, etc.) so pipelines can interact with external services without embedding credentials in YAML.
A team needs to enforce that every pull request passes a build pipeline before merging.
Which Azure DevOps feature should they configure?