共用方式為


TFS 2018 task reference

A task performs an action in a pipeline. For example, a task can build an app, interact with Azure resources, install a tool, or run a test. Tasks are the building blocks for defining automation in a pipeline.

The articles in this section describe the built-in tasks for Azure Pipelines and specify the semantics for attributes that hold special meaning for each task.

For previous versions of the task reference, see:

For how-tos and tutorials about authoring pipelines using tasks, including creating custom tasks, custom extensions, and finding tasks on the Visual Studio Marketplace, see Tasks concepts and Azure Pipelines documentation.

Important

Screenshot of how to select a version from Azure DevOps Content Version selector.

To view the task reference for tasks available for your platform, make sure that you select the correct Azure DevOps version from the version selector which is located above the table of contents. Feature support differs depending on whether you are working from Azure DevOps Services or an on-premises version of Azure DevOps Server.
To learn which on-premises version you are using, see Look up your Azure DevOps platform and version.

Build tasks

Task Description
.NET Core
DotNetCoreCLI@2
DotNetCoreCLI@1
DotNetCoreCLI@0
Build, test, package, or publish a dotnet application, or run a custom dotnet command. For package commands, supports NuGet.org and authenticated feeds like Package Management and MyGet.
Android Build
AndroidBuild@1
AndroidBuild@1 is deprecated. Use Gradle.
Android Signing
AndroidSigning@2
AndroidSigning@1
Sign and align Android APK files.
Ant
Ant@1
Build with Apache Ant.
CMake
CMake@1
Build with the CMake cross-platform build system.
Docker
Docker@0
Build, tag, push, or run Docker images, or run a Docker command. Task can be used with Docker or Azure Container registry.
Docker Compose
DockerCompose@0
Build, push or run multi-container Docker applications. Task can be used with Docker or Azure Container registry.
Gradle
Gradle@2
Gradle@1
Build using a Gradle wrapper script.
Grunt
Grunt@0
The JavaScript Task Runner.
Gulp
Gulp@0
Node.js streaming task based build system.
Index sources and publish symbols
PublishSymbols@2
PublishSymbols@1
Index your source code and publish symbols to a file share or Visual Studio Team Services Symbol Server.
Jenkins Queue Job
JenkinsQueueJob@2
JenkinsQueueJob@1
Queue a job on a Jenkins server.
Maven
Maven@2
Maven@1
Build with Apache Maven.
MSBuild
MSBuild@1
Build with MSBuild.
Visual Studio Build
VSBuild@1
Build with MSBuild and set the Visual Studio version property.
Xamarin.Android
XamarinAndroid@1
Build an Android app with Xamarin.
Xamarin.iOS
XamariniOS@1
Build an iOS app with Xamarin on macOS.
Xcode
Xcode@4
Build, test, or archive an Xcode workspace on macOS. Optionally package an app.
Xcode Build
Xcode@3
Xcode@2
Build an Xcode workspace on macOS.
Xcode Package iOS
XcodePackageiOS@0
Generate an .ipa file from Xcode build output using xcrun (Xcode 7 or below).

Deploy tasks

Task Description
App Center distribute
AppCenterDistribute@0
Distribute app builds to testers and users via App Center.
Azure App Service Classic (Deprecated)
AzureWebPowerShellDeployment@1
Create or update Azure App Service using Azure PowerShell.
Azure App Service deploy
AzureRmWebAppDeployment@2
Update Azure App Service using Web Deploy / Kudu REST APIs.
Azure App Service Deploy
AzureRmWebAppDeployment@3
Update Azure WebApp Services On Windows, Web App On Linux with built-in images or docker containers, ASP.NET, .NET Core, PHP, Python or Node based Web applications, Function Apps, Mobile Apps, Api applications, Web Jobs using Web Deploy / Kudu REST APIs.
Azure App Service Manage
AzureAppServiceManage@0
Start, Stop, Restart, Slot swap, Install site extensions or Enable Continuous Monitoring for an Azure App Service.
Azure CLI
AzureCLI@1
Run a Shell or Batch script with Azure CLI commands against an azure subscription.
Azure CLI Preview
AzureCLI@0
Run a Shell or Batch script with Azure CLI commands against an azure subscription.
Azure Cloud Service Deployment
AzureCloudPowerShellDeployment@1
Deploy an Azure Cloud Service.
Azure File Copy
AzureFileCopy@1
Copy files to Azure blob or VM(s).
Azure Key Vault
AzureKeyVault@1
Download Azure Key Vault Secrets.
Azure Monitor Alerts
AzureMonitorAlerts@0
Configure alerts on available metrics for an Azure resource.
Azure PowerShell
AzurePowerShell@2
AzurePowerShell@1
Run a PowerShell script within an Azure environment.
Azure Resource Group Deployment
AzureResourceGroupDeployment@2
AzureResourceGroupDeployment@1
Deploy, start, stop, delete Azure Resource Groups.
Azure SQL Database Deployment
SqlAzureDacpacDeployment@1
Deploy Azure SQL DB using DACPAC or run scripts using SQLCMD.
Azure VM scale set Deployment
AzureVmssDeployment@0
Deploy Virtual Machine scale set image.
Build Machine Image
PackerBuild@0
Build machine image using Packer. This image can be used for Azure Virtual machine scale set deployment.
Chef
Chef@1
Deploy to Chef environments by editing environment attributes.
Chef Knife
ChefKnife@1
Run Scripts with knife commands on your chef workstation.
Copy Files Over SSH
CopyFilesOverSSH@0
Copy files or build artifacts to a remote machine over SSH.
Deploy to Kubernetes
Kubernetes@0
Deploy, configure, update your Kubernetes cluster in Azure Container Service by running kubectl commands.
IIS Web App Deploy
IISWebAppDeploymentOnMachineGroup@0
Deploy a Website or Web Application using WebDeploy.
IIS Web App deployment (Deprecated)
IISWebAppDeployment@1
Deploy by MSDeploy, create/update website & app pools.
IIS Web App Manage
IISWebAppManagementOnMachineGroup@0
Create or update a Website, Web App, Virtual Directories, and Application Pool.
Invoke REST API
InvokeRESTAPI@1
InvokeRESTAPI@0
Invoke REST API as a part of your process.
Manual Intervention
ManualIntervention@8
Pause deployment and wait for intervention.
PowerShell on Target Machines
PowerShellOnTargetMachines@2
PowerShellOnTargetMachines@1
Execute PowerShell scripts on remote machine(s).
Service Fabric Application Deployment
ServiceFabricDeploy@1
Deploy a Service Fabric application to a cluster.
Service Fabric Compose Deploy
ServiceFabricComposeDeploy@0
Deploy a docker-compose application to a Service Fabric cluster.
SQL Server Database Deploy
SqlDacpacDeploymentOnMachineGroup@0
Deploy to SQL Server Database using DACPAC or SQL scripts.
SQL Server database deploy (Deprecated)
SqlServerDacpacDeployment@1
Deploy SQL Server Database using DACPAC.
SSH
SSH@0
Run shell commands or a script on a remote machine using SSH.
Windows Machine File Copy
WindowsMachineFileCopy@2
WindowsMachineFileCopy@1
Copy files to remote machine(s).

Package tasks

Task Description
CocoaPods
CocoaPods@0
CocoaPods is a dependency manager for Swift and Objective-C Cocoa projects. This task runs 'pod install'.
npm
Npm@1
Npm@0
Install and publish npm packages, or run an npm command. Supports npmjs.com and authenticated registries like Package Management.
npm Authenticate (for task runners)
npmAuthenticate@0
Don't use this task if you're also using the npm task. Provides npm credentials to an .npmrc file in your repository for the scope of the build. This enables npm task runners like Gulp and Grunt to authenticate with private registries.
NuGet
NuGetCommand@2
Restore, pack, or push NuGet packages, or run a NuGet command. Supports NuGet.org and authenticated feeds like Package Management and MyGet. Uses NuGet.exe and works with .NET Framework apps. For .NET Core and .NET Standard apps, use the .NET Core task.
NuGet Command
NuGet@0
Deprecated: use the “NuGet” task instead. It works with the new Tool Installer framework so you can easily use new versions of NuGet without waiting for a task update, provides better support for authenticated feeds outside this account/collection, and uses NuGet 4 by default.
NuGet Installer
NuGetInstaller@0
Installs or restores missing NuGet packages.
NuGet Packager
NuGetPackager@0
Deprecated: use the “NuGet” task instead. It works with the new Tool Installer framework so you can easily use new versions of NuGet without waiting for a task update, provides better support for authenticated feeds outside this account/collection, and uses NuGet 4 by default.
NuGet Publisher
NuGetPublisher@0
Deprecated: use the “NuGet” task instead. It works with the new Tool Installer framework so you can easily use new versions of NuGet without waiting for a task update, provides better support for authenticated feeds outside this account/collection, and uses NuGet 4 by default.
NuGet Restore
NuGetRestore@1
Restores NuGet packages in preparation for a Visual Studio Build step.
Xamarin Component Restore
XamarinComponentRestore@0
Restores Xamarin components for the specified solution.

Test tasks

Task Description
App Center Test
AppCenterTest@1
Test app packages with Visual Studio App Center.
Mobile Center Test
VSMobileCenterTest@0
Test mobile app packages with Visual Studio Mobile Center.
Publish Code Coverage Results
PublishCodeCoverageResults@1
Publish Cobertura or JaCoCo code coverage results from a build.
Publish Test Results
PublishTestResults@2
PublishTestResults@1
Publish Test Results to VSTS/TFS.
Run Functional Tests
RunVisualStudioTestsusingTestAgent@1
Deprecated: This task and it’s companion task (Visual Studio Test Agent Deployment) are deprecated. Use the 'Visual Studio Test' task instead. The VSTest task can run unit as well as functional tests. Run tests on one or more agents using the multi-agent phase setting. Use the 'Visual Studio Test Platform' task to run tests without needing Visual Studio on the agent. VSTest task also brings new capabilities such as automatically rerunning failed tests.
Visual Studio Test
VSTest@2
VSTest@1
Run unit and functional tests (Selenium, Appium, Coded UI test, etc.) using the Visual Studio Test runner. Test frameworks that have a Visual Studio test adapter such as xUnit, NUnit, Chutzpah, etc. can also be run. Tests can be distributed on multiple agents using this task (version 2).
Visual Studio Test Agent Deployment
DeployVisualStudioTestAgent@2
DeployVisualStudioTestAgent@1
DeployVisualStudioTestAgent@2 is deprecated. Use the Visual Studio Test task to run unit and functional tests.
Xamarin Test Cloud
XamarinTestCloud@1
[Depreciated] Testing mobile apps with Xamarin Test Cloud using Xamarin.UITest - recommended task is now AppCenterTest.

Tool tasks

Task Description
.NET Core SDK/runtime installer
DotNetCoreInstaller@0
Acquire a specific version of the .NET Core SDK from the internet or local cache and add it to the PATH.
Java Tool Installer
JavaToolInstaller@0
Acquires a specific version of Java from a user supplied Azure blob or the tools cache and sets JAVA_HOME. Use this task to change the version of Java used in Java tasks.
NuGet Tool Installer
NuGetToolInstaller@0
Acquires a specific version of NuGet from the internet or the tools cache and adds it to the PATH. Use this step to change the version of NuGet used in the NuGet steps.
Use Node.js ecosystem
NodeTool@0
Finds or Downloads and caches specified version spec of Node and adds it to the PATH.
Visual Studio Test Platform Installer
VisualStudioTestPlatformInstaller@1
Acquires the test platform from nuget.org or the tools cache. Satisfies the ‘vstest’ demand and can be used for running tests and collecting diagnostic data using the Visual Studio Test task.

Utility tasks

Task Description
Archive Files
ArchiveFiles@2
ArchiveFiles@1
Archive files using compression formats such as .7z, .rar, .tar.gz, and .zip.
Azure Network Load Balancer
AzureNLBManagement@1
Connect/Disconnect an Azure virtual machine's network interface to a Load Balancer's backend address pool.
Bash
Bash@3
This is an early preview. Run a Bash script on macOS, Linux, or Windows.
Batch Script
BatchScript@1
Run a windows cmd or bat script and optionally allow it to change the environment.
Command Line
CmdLine@2
CmdLine@1
Run a command line script using Bash on Linux and macOS and cmd.exe on Windows.
Copy and Publish Build Artifacts
CopyPublishBuildArtifacts@1
CopyPublishBuildArtifacts@1 is deprecated. Use the Copy Files task and the Publish Build Artifacts task instead.
Copy Files
CopyFiles@2
CopyFiles@1
Copy files from source folder to target folder using match patterns (The match patterns will only match file paths, not folder paths).
cURL Upload Files
cURLUploader@2
cURLUploader@1
Use cURL to upload files with FTP, FTPS, SFTP, HTTP, and more.
Decrypt File (OpenSSL)
DecryptFile@1
A thin utility task for file decryption using OpenSSL.
Delay
Delay@1
Delay further execution of the workflow by a fixed time.
Delete Files
DeleteFiles@1
Delete files or folders. (The minimatch patterns will only match file paths, not folder paths).
Download Build Artifacts
DownloadBuildArtifacts@0
Download Build Artifacts.
Download Package
DownloadPackage@0
Download a package from a Package Management feed in VSTS or TFS.
Requires the Package Management extension.
Download Secure File
DownloadSecureFile@1
Download a secure file to a temporary location on the build or release agent.
Extract Files
ExtractFiles@1
Extract a variety of archive and compression files such as .7z, .rar, .tar.gz, and .zip.
FTP Upload
FtpUpload@1
FTP Upload.
Install Apple Certificate
InstallAppleCertificate@1
InstallAppleCertificate@0
Install an Apple certificate required to build on a macOS agent.
Install Apple Provisioning Profile
InstallAppleProvisioningProfile@1
InstallAppleProvisioningProfile@0
Install an Apple provisioning profile required to build on a macOS agent.
Install SSH Key
InstallSSHKey@0
Install an SSH key prior to a build or release.
Invoke Azure Function
AzureFunction@1
AzureFunction@0
Invoke Azure function as a part of your process.
Jenkins Download Artifacts
JenkinsDownloadArtifacts@1
Download artifacts produced by a Jenkins job.
PowerShell
PowerShell@2
PowerShell@1
This is an early preview. Run a PowerShell script on Windows, macOS, or Linux.
Publish Build Artifacts
PublishBuildArtifacts@1
Publish build artifacts to Visual Studio Team Services/TFS or a file share.
Publish To Azure Service Bus
PublishToAzureServiceBus@1
PublishToAzureServiceBus@0
Sends a message to azure service bus using a service connection (no agent required).
PyPI Publisher
PyPIPublisher@0
Publish Python packages to PyPI.
Query Azure Monitor Alerts
AzureMonitor@0
Observe the configured Azure monitor rules for active alerts.
Query Work Items
queryWorkItems@0
Executes a work item query and checks for the number of items returned.
Service Fabric PowerShell
ServiceFabricPowerShell@1
Run a PowerShell script within the context of an Azure Service Fabric cluster connection.
Shell Script
ShellScript@2
Run a shell script using bash.
Update Service Fabric App Versions
ServiceFabricUpdateAppVersions@1
Automatically updates the versions of a packaged Service Fabric application.
Update Service Fabric Manifests
ServiceFabricUpdateManifests@2
Automatically updates portions of the application and service manifests within a packaged Service Fabric application.
Xamarin License
XamarinLicense@1
[Deprecated] Upgrade to free version of Xamarin: https://store.xamarin.com.

Open source

These tasks are open source on GitHub. Feedback and contributions are welcome. See Pipeline task changelog for a list of task changes, including a historical record of task updates.

FAQ

What are task input aliases?

Inputs to a task are identified by a label, name, and may include one or more optional aliases. The following example is an excerpt from the source code for the Known Hosts Entry input of the InstallSSHKey@0 task.

{
    "name": "hostName",
    "aliases": [
        "knownHostsEntry"
    ],
    "label": "Known Hosts Entry"
    ...
}

Before YAML pipelines were introduced in 2019, pipelines were created and edited using a UI based pipeline editor, and only the label was used by pipeline authors to reference a task input.

Screenshot of the task assistant in the YAML pipeline editor.

When YAML pipelines were introduced in 2019, pipeline authors using YAML started using the task input name to refer to a task input. In some cases, the task input names weren't descriptive, so aliases were added to provide additional descriptive names for task inputs.

For example, the InstallSSHKey@0 task has a Known Hosts Entry input named hostName that expects an entry from a known_hosts file. The Known Hosts Entry label in the classic pipeline designer makes this clear, but it isn't as clear when using the hostName name in a YAML pipeline. Task input aliases were introduced to allow task authors to provide decriptive names for their previously authored tasks, and for the InstallSSHKey@0 task, a knownHostsEntry alias was added, while keeping the original hostName name for compatibility with existing pipelines using that name.

Any items in a task input's aliases are interchangeable with the name in a YAML pipeline. The following two YAML snippets are functionally identical, with the first example using the knownHostsEntry alias and the second example using hostName.

- task: InstallSSHKey@0
  inputs:
    # Using knownHostsEntry alias
    knownHostsEntry: 'sample known hosts entry line'
    # Remainder of task inputs omitted

- task: InstallSSHKey@0
  inputs:
    # Using hostName name
    hostName: 'sample known hosts entry line'
    # Remainder of task inputs omitted

Starting with Azure DevOps Server 2019.1, the YAML pipeline editor was introduced, which provides an intellisense type functionality.

The YAML pipeline editor uses the Yamlschema - Get REST API to retrieve the schema used for validation in the editor. If a task input has an alias, the schema promotes the alias to the primary YAML name for the task input, and the alias is suggested by the intellisense.

Screenshot of intellisense in the YAML pipeline editor.

The following example is the Known Hosts Entry task input for the InstallSSHKey@0 task from the YAML schema, with knownHostsEntry listed in the name position and hostName in the aliases collection.

"properties": {
    "knownHostsEntry": {
      "type": "string",
      "description": "Known Hosts Entry",
      "ignoreCase": "key",
      "aliases": [
        "hostName"
      ]
    },

Because the intellisense in the YAML pipeline editor displays knownHostsEntry, and the YAML generated by the task assistant uses knownHostsEntry in the generated YAML, the task reference displays the alias from the task source code as the YAML name for a task input. If a task has more than one alias (there are a few that have two aliases), the first alias is used as the name.

Why did the task reference change?

The Azure Pipelines tasks reference documentation moved to its current location to support the following improvements.

  • Task articles are generated using the task source code from the Azure Pipelines tasks open source repository.
  • Task input names and aliases are generated from the task source so they are always up to date.
  • YAML syntax blocks are generated from the task source so they are up to date.
  • Supports community contributions with integrated user content such as enhanced task input descriptions, remarks and examples.
  • Provides task coverage for all supported Azure DevOps versions.
  • Updated every sprint to cover the latest updates.

To contribute, see Contributing to the tasks content.

Where can I learn step-by-step how to build my app?

Build your app

Can I add my own build tasks?

Yes: Add a build task

What are installer tasks?

To learn more about tool installer tasks, see Tool installers.