AZ-400 Development Processes & Continuous Integration 4 — Questions and Answers
Question 1: A company stores pipeline variables in Azure Key Vault and references them in pipelines. Which Azure DevOps feature enables this integration natively?
- Service connections of type Azure Resource Manager
- Variable groups linked to Azure Key Vault (Correct answer)
- Pipeline secrets stored in the agent's environment
- Secure files in the Library
Correct answer: Variable groups linked to Azure Key Vault
Variable groups in Azure DevOps Library can be linked to Azure Key Vault, automatically syncing secrets as pipeline variables at runtime.
Question 2: When configuring a CI build for a .NET application in Azure Pipelines, which task restores NuGet package dependencies?
- DotNetCoreCLI with command 'publish'
- DotNetCoreCLI with command 'restore' (Correct answer)
- NuGetCommand with command 'push'
- MSBuild with /t:Clean target
Correct answer: DotNetCoreCLI with command 'restore'
The DotNetCoreCLI task with command 'restore' runs 'dotnet restore' to download and cache all NuGet package dependencies defined in the project.
Question 3: A pipeline must build a Docker image and push it to Azure Container Registry (ACR). Which service connection type is required?
- Generic service connection
- Docker Registry service connection pointing to ACR (Correct answer)
- Azure Resource Manager service connection
- SSH service connection
Correct answer: Docker Registry service connection pointing to ACR
A Docker Registry service connection configured for ACR provides the credentials needed to authenticate the Docker push task against your container registry.
Question 4: You want to cache NuGet packages between pipeline runs to speed up builds. Which Azure Pipelines feature should you use?
- Pipeline artifacts with retention policies
- The Cache task with a key based on the packages.lock.json hash (Correct answer)
- A self-hosted agent with packages pre-installed
- Storing packages in an Azure Blob Storage drop folder
Correct answer: The Cache task with a key based on the packages.lock.json hash
The Cache task saves and restores directories between pipeline runs using a cache key, with the packages.lock.json hash ensuring the cache is invalidated when dependencies change.
Question 5: Which Azure Pipelines condition syntax runs a step only when the previous step fails?
- condition: succeeded()
- condition: failed() (Correct answer)
- condition: always()
- condition: canceledOrFailed()
Correct answer: condition: failed()
The 'failed()' condition causes a step to execute only if the preceding step or job has failed, useful for cleanup or notification tasks.
Question 6: A team wants to enforce a coding standard by failing the CI build when SonarQube reports critical issues. What mechanism enables this?
- SonarQube quality gate checked by the 'SonarQubePublish' task after analysis (Correct answer)
- A post-deployment script that queries the SonarQube API
- A branch policy that blocks PRs based on file line counts
- Manually reviewing the SonarQube dashboard after each build
Correct answer: SonarQube quality gate checked by the 'SonarQubePublish' task after analysis
The SonarQubePublish task polls the SonarQube server for the quality gate result and fails the pipeline if the gate status is 'Failed'.
Question 7: What is the effect of setting 'trigger: none' in an Azure Pipelines YAML file?
- The pipeline runs on every commit to every branch
- The pipeline never runs automatically and must be triggered manually or via API (Correct answer)
- The pipeline runs only on pull requests
- The pipeline runs on a schedule defined elsewhere in the file
Correct answer: The pipeline never runs automatically and must be triggered manually or via API
Setting 'trigger: none' disables all automatic CI triggers, requiring the pipeline to be run manually, via the API, or through a pipeline resource trigger.
A company stores pipeline variables in Azure Key Vault and references them in pipelines.
Which Azure DevOps feature enables this integration natively?