AZ-400 Continuous Integration 2 — Questions and Answers
Question 1: In Azure Pipelines, what is the purpose of a 'trigger' block in a YAML pipeline definition?
- To define variables used across pipeline stages
- To specify which branch changes automatically start the pipeline (Correct answer)
- To configure the agent pool for pipeline runs
- To set approval gates between stages
Correct answer: To specify which branch changes automatically start the pipeline
The trigger block in a YAML pipeline specifies branch patterns that automatically initiate a pipeline run when code is pushed.
Question 2: Which Azure Pipelines feature allows you to reuse pipeline logic across multiple pipelines without duplication?
- Pipeline variables
- Template references (Correct answer)
- Stage dependencies
- Artifact publishing
Correct answer: Template references
Template references let you define reusable YAML blocks (steps, jobs, or stages) in separate files and include them across multiple pipelines.
Question 3: What does setting 'continueOnError: true' on a pipeline step accomplish?
- Retries the step up to three times before failing
- Allows subsequent steps to run even if this step fails (Correct answer)
- Marks the overall pipeline as succeeded regardless of outcome
- Sends a notification when the step encounters an error
Correct answer: Allows subsequent steps to run even if this step fails
Setting continueOnError: true means the pipeline proceeds to the next step even if the current step exits with a non-zero code, though the job result may still be marked as failed.
Question 4: A developer wants to run unit tests only when files in the 'src/' folder change. Which Azure Pipelines feature enables this?
- Branch filters
- Path filters in trigger configuration (Correct answer)
- Pipeline conditions
- Stage dependencies
Correct answer: Path filters in trigger configuration
Path filters in the trigger block (include/exclude paths) restrict pipeline execution to runs triggered by changes in specified directory paths.
Question 5: What is the function of the 'publishTestResults' task in Azure Pipelines CI?
- Deploys test artifacts to a test environment
- Uploads test result files so they appear in the pipeline run summary (Correct answer)
- Runs automated tests and reports pass/fail counts
- Archives test logs to Azure Blob Storage
Correct answer: Uploads test result files so they appear in the pipeline run summary
The PublishTestResults task ingests JUnit, NUnit, or TRX result files and surfaces them in the Tests tab of the pipeline run UI.
Question 6: Which retention policy setting in Azure Pipelines controls how long pipeline run artifacts and logs are kept?
- Pipeline timeout
- Artifact retention leases (Correct answer)
- Agent pool quotas
- Service connection expiration
Correct answer: Artifact retention leases
Artifact retention leases allow pipelines or external tools to extend how long a specific run's artifacts and logs are preserved beyond the default retention period.
Question 7: In a multi-stage Azure Pipeline, what keyword defines a dependency between two stages so that Stage B only runs after Stage A succeeds?
- requires
- dependsOn (Correct answer)
- after
- needs
Correct answer: dependsOn
The dependsOn keyword in a stage definition specifies which preceding stages must complete successfully before the current stage begins.
In Azure Pipelines, what is the purpose of a 'trigger' block in a YAML pipeline definition?