AZ-400 Question 135
Select 2Your team hosts all code in a single GitHub repository for a Node.js application. They want to set up a continuous integration (CI) build in Azure Pipelines that triggers automatically whenever a pull request is opened. Additionally, the pipeline should post the build status back to GitHub so developers can see if their commits pass or fail. Which two steps must you implement to accomplish this?
- A
Use the GitHub App-based service connection in Azure DevOps to authorize access to the repository.
- B
Enable continuous delivery triggers by specifying only the main branch as a build source in the pipeline.
- C
In your pipeline YAML, configure a pull_request trigger referencing the relevant branches or branch filters.
- D
Disable the required status checks in GitHub branch protection rules so that the pipeline can run automatically.
- E
Install the Azure DevOps extension on GitHub and activate the repository in Azure Pipelines.
Show answer and explanation
Correct answers: A, C
Explanation
To integrate Azure Pipelines with a GitHub repository for pull request builds, you must establish a GitHub service connection in Azure DevOps (often via the GitHub App-based authentication) and configure a pull_request trigger in the pipeline YAML. This setup ensures that when a pull request is opened or updated in GitHub, Azure Pipelines is triggered to build the project and post status updates back to the pull request. Refer to official Microsoft documentation on 'Build GitHub pull request validation in Azure Pipelines' for more detailed guidance.
- A. Correct.
Correct. Creating a GitHub service connection in Azure DevOps is required, commonly done via the GitHub App-based connection. This allows Azure Pipelines to authenticate securely and report build status back to GitHub.
- B. Incorrect.
Incorrect. Simply specifying the main branch for continuous delivery triggers does not automatically enable pull request CI triggers. You must explicitly define pull_request triggers or their equivalent in the Azure Pipelines YAML.
- C. Correct.
Correct. Defining a pull_request trigger in the pipeline YAML ensures that a build runs whenever a pull request is opened or updated, and allows Azure Pipelines to post status updates back to GitHub.
- D. Incorrect.
Incorrect. Required status checks in branch protection rules do not need to be disabled. Azure Pipelines can still run and report the status back to GitHub, and these checks help enforce code quality.
- E. Incorrect.
Incorrect. While installing certain GitHub Marketplace extensions might add convenience features, it is not strictly necessary for enabling pull request triggers and build status reporting in Azure Pipelines.