azure-devops-extension-task-boilerplate project: Help you to author azure pipeline agent task

Canhua Li
2 min readOct 6, 2019


Azure pipeline helps you to implement continuous integration and continuous delivery(CI/CD) for your application. When you create a pipeline, Task is the fundamental building block in the pipeline. A task is just a packaged script or procedure helps you to make the job done, for example, VSTest task, VSBuild task.

Microsoft provides out-of-the-box tasks with Azure pipelines on azure-pipelines-tasks repo.

When we talk about writing tasks, actually there are two kinds of tasks:

  1. agent task. Eg, Install Windows Application Driver on the agent
  2. server task. Eg, query work items from GitHub, monitoring Azure

Hereafter I just talk about agent task. Below is the reason that I need to implement a custom task:

WinAppDriver v1.1 is included in ‘windows 2019’ Microsoft hosted agent, and it takes time to make the hosted agent to be prebuilt with latest WinAppDriver, so I need a tool to help me to change WinAppDriver to a different version on the agent before I start my testing. In the pipeline, I expected to use the task like this

So I started from the this tutorial. Generally speaking, I can use PowerShell or node to write this task, since the example is node, and I use node too. After I completed my task, I found azure-devops-extension-tasks, and it has better organization than the tutorial, and it provides:

  1. tslint
  2. package one or more tasks in the same extension
  3. easy command to init, build, and package the extension.

So based on azure-devops-extension-tasks repo, I created azure-devops-extension-task-boilerplate. After you clone this repo, just run npm run package.Then your first task is ready to ship.

In the boilerplate, BuildTasks folder is added, which is used to supports multiple tasks in the same extension

In the root directory, it includes: — Describe the package, license, and icon showed in azure marketplace

package.json — A lot of scripts help you to manage, build and package tasks. Here are some important commands:

  1. From the root of the repo run npm run initdev. This will pull down the necessary modules and TypeScript declare files.
  2. Run npm run build to compile all tasks.
  3. Run npm run package to create a .vsix extension package that includes the build tasks.

Based on the boilerplate, I implemented WinAppDriverInstaller. To uninstall and install WinAppDriver, it requires privilege permission. Finally I found node-windows project, which Elevate and makes the command to execute with elevated privileges.



Canhua Li

Senior Software Engineer — Microsoft