Courseiva
Configure processes and communicationsmediumMultiple ChoiceObjective-mapped

Creating a GitHub Issue Automatically When an Azure Pipelines Build Fails

Your team uses GitHub Issues for work tracking. You want to automate the creation of a new issue when a build pipeline fails in Azure Pipelines. Which action should you implement in the YAML pipeline?

Quick Answer

Since Azure Pipelines has no native GitHub Issues integration, a PowerShell (or script) task calling the GitHub Issues REST API directly — POST /repos/{owner}/{repo}/issues, authenticated with a token — is the standard way to automatically open an issue when a build fails, giving full control over the issue's title and body content.

⚠ Common exam trap

Test-takers frequently confuse Service Hooks (external configuration) with pipeline tasks, thinking a Service Hook can be defined inside a YAML pipeline, when in fact Service Hooks are configured outside the pipeline in Azure DevOps project settings and cannot be triggered conditionally based on pipeline failure within the YAML definition.

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

Use a PowerShell task to call the GitHub Issues API.

Azure Pipelines does not natively support creating GitHub Issues directly from a YAML pipeline. Instead, you must use a PowerShell task (or a script task) to call the GitHub Issues API (POST /repos/{owner}/{repo}/issues) with an authentication token to create the issue when the build fails. This approach gives you full control over the issue content and is the standard way to integrate with GitHub Issues from Azure Pipelines.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • Add a GitHub Action that triggers on pipeline completion.

    Why it's wrong here

    GitHub Actions cannot be directly triggered by Azure Pipelines.

  • Use a PowerShell task to call the GitHub Issues API.

    Why this is correct

    The GitHub API allows creating issues from any HTTP client.

  • Configure a Service Hook in Azure DevOps to GitHub Issues.

    Why it's wrong here

    Service Hooks are for Azure DevOps, not Azure Pipelines YAML.

  • Add a task to create a work item in Azure Boards.

    Why it's wrong here

    Azure Boards is not GitHub Issues.

About these practice questions

This AZ-400 question is part of Courseiva's 823-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

Same concept, more angles

1 more way this is tested on AZ-400

These questions test the same concept from different angles. Work through them to make sure you can recognise it however the exam phrases it.

Variation 1. Your team uses GitHub Issues for tracking bugs and features. They want to automatically assign issues to the person who created the pull request that closes the issue. Which GitHub Actions workflow trigger and action should you use?

hard
  • A.Use the 'pull_request' event and the 'actions/assign' action to assign the issue.
  • B.Use the 'issues' event with 'closed' type and an action that assigns the issue to the PR author.
  • C.Use the 'push' event and call the GitHub API to assign the issue.
  • D.Use the 'schedule' event to periodically check for closed issues and assign them.

Why B: The 'issues' event with 'closed' type triggers a workflow when an issue is closed, and the 'actions/github-script' action can be used to assign the issue to the pull request author by querying the pull request that closed the issue. Option A is incorrect because the 'pull_request' event does not directly close issues; closing an issue is done via a commit or pull request merge. Option C is incorrect because the 'push' event is not related to issue closure. Option D is incorrect because the 'schedule' event is time-based and does not respond to issue closures.

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

This AZ-400 practice question is part of Courseiva's free Microsoft certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the AZ-400 exam.