AZ-400 Question 289
Select 2Your organization manages two projects: one uses GitHub Actions for CI/CD workflows, and the other uses Azure Pipelines. You want to ensure the team receives immediate Slack notifications whenever a build or workflow fails. Additionally, a few developers should receive alerts only when a new pull request is opened. Which two configurations should you implement to meet these requirements?
- A
Create a service hook subscription in Azure DevOps that triggers on the 'Build completed' event and routes only failed runs to a Slack channel.
- B
Directly modify the Azure Pipelines YAML definition to use a manual Slack notification step in every new or existing pipeline.
- C
Add a Slack notification step in the GitHub Actions workflow that is triggered when the workflow run concludes with a failure.
- D
Enable GitHub repository watchers for the entire team, which will automatically send Slack alerts on new pull requests.
Show answer and explanation
Correct answers: A, C
Explanation
To configure Slack alerts for Azure Pipelines, set up a service hook subscription in Azure DevOps under Project Settings → Service Hooks. For GitHub Actions, include a Slack notification action or step that triggers on workflow failures (e.g., using 'conclusion: failure'). These approaches allow you to manage alerts for specific events (build failures, new pull requests) without updating every pipeline or relying solely on default emails. Refer to Microsoft Docs (https://docs.microsoft.com/azure/devops/service-hooks/) and GitHub Actions workflows documentation (https://docs.github.com/actions) for detailed steps on setting up Slack notifications.
- A. Correct.
Correct. Azure DevOps service hook subscriptions can filter events (e.g., build failures) and send a message to Slack. This ensures that only failed builds are reported, and you don�t have to modify each pipeline's YAML.
- B. Incorrect.
Incorrect. While you can add Slack tasks directly into a pipeline YAML, this approach requires manual updates to each pipeline. Using service hooks is more flexible and scalable because you manage notifications centrally rather than editing each definition.
- C. Correct.
Correct. GitHub Actions can integrate with Slack by adding a step to post a notification when the workflow run fails. This allows immediate communication of issues to the team without changing the default GitHub notification settings for everyone.
- D. Incorrect.
Incorrect. Enabling repository watchers only provides GitHub-based notifications (e.g., emails or GitHub notifications), not Slack messages. You need a dedicated Slack integration or action for pull request alerts.