Azure Devops Pipelines Tasks Reference Azure Pipelines
Azure Devops Pipelines Tasks Reference Azure Pipelines
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.
Please refer to the YAML Reference for steps.task for details on the general attributes
supported by tasks.
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
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
ノ Expand table
Task Description
Advanced Security AutoBuild Attempts to build the repository by finding and building
AdvancedSecurity-Codeql- project files in the source folder.
Autobuild@1
Advanced Security Initialize CodeQL Initializes the CodeQL database in preparation for
AdvancedSecurity-Codeql-Init@1 building.
Advanced Security Perform CodeQL Finalizes the CodeQL database and runs the analysis
analysis queries.
AdvancedSecurity-Codeql-Analyze@1
Advanced Security Publish Results Combines SARIF file(s) produced by code scanning
AdvancedSecurity-Publish@1 tool(s), enhances the combined SARIF file, and publishes
the enhanced SARIF file to the Advanced Security service.
Azure IoT Edge Build and deploy an Azure IoT Edge image.
AzureIoTEdge@2
Download GitHub Nuget Packages Restore your nuget packages using dotnet CLI.
DownloadGitHubNugetPackage@1
Index sources and publish symbols Index your source code and publish symbols to a file
PublishSymbols@2 share or Azure Artifacts symbol server.
PublishSymbols@1
Publish Quality Gate Result Publish SonarQube's Quality Gate result on the Azure
SonarQubePublish@5 DevOps build result, to be used after the actual analysis.
SonarQubePublish@4
Task Description
Run Code Analysis Run scanner and upload the results to the SonarQube
SonarQubeAnalyze@5 server.
SonarQubeAnalyze@4
Visual Studio build Build with MSBuild and set the Visual Studio version
VSBuild@1 property.
Xcode Package iOS Generate an .ipa file from Xcode build output using xcrun
XcodePackageiOS@0 (Xcode 7 or below).
Deploy tasks
ノ Expand table
Task Description
App Center distribute Distribute app builds to testers and users via
AppCenterDistribute@3 Visual Studio App Center.
AppCenterDistribute@2
AppCenterDistribute@1
AppCenterDistribute@0
Azure App Service Classic (Deprecated) Create or update Azure App Service using
AzureWebPowerShellDeployment@1 Azure PowerShell.
Azure App Service deploy Deploy to Azure App Service a web, mobile, or
AzureRmWebAppDeployment@4 API app using Docker, Java, .NET, .NET Core,
AzureRmWebAppDeployment@3 Node.js, PHP, Python, or Ruby.
AzureRmWebAppDeployment@2
Task Description
Azure App Service manage Start, stop, restart, slot swap, slot delete, install
AzureAppServiceManage@0 site extensions or enable continuous
monitoring for an Azure App Service.
Azure App Service Settings Update/Add App settings an Azure Web App
AzureAppServiceSettings@1 for Linux or Windows.
Azure CLI Preview Run a Shell or Batch script with Azure CLI
AzureCLI@0 commands against an azure subscription.
Azure Container Apps Deploy An Azure DevOps Task to build and deploy
AzureContainerApps@1 Azure Container Apps.
AzureContainerApps@0
Azure Database for MySQL deployment Run your scripts and make changes to your
AzureMysqlDeployment@1 Azure Database for MySQL.
Azure Resource Group Deployment Deploy, start, stop, delete Azure Resource
AzureResourceGroupDeployment@1 Groups.
Azure SQL Database deployment Deploy an Azure SQL Database using DACPAC
SqlAzureDacpacDeployment@1 or run scripts using SQLCMD.
Azure VM scale set deployment Deploy a virtual machine scale set image.
AzureVmssDeployment@0
Azure Web App for Containers Deploy containers to Azure App Service.
AzureWebAppContainer@1
Check Azure Policy compliance Security and compliance assessment for Azure
AzurePolicyCheckGate@0 Policy.
IIS Web App deployment (Deprecated) Deploy using MSDeploy, then create/update
IISWebAppDeployment@1 websites and app pools.
IIS web app manage Create or update websites, web apps, virtual
IISWebAppManagementOnMachineGroup@0 directories, or application pools.
Package and deploy Helm charts Deploy, configure, update a Kubernetes cluster
HelmDeploy@0 in Azure Container Service by running helm
commands.
SQL Server database deploy Deploy a SQL Server database using DACPAC
SqlDacpacDeploymentOnMachineGroup@0 or SQL scripts.
Task Description
SQL Server database deploy (Deprecated) Deploy a SQL Server database using DACPAC.
SqlServerDacpacDeployment@1
Package tasks
ノ Expand table
Task Description
Cargo authenticate (for task Authentication task for the cargo client used for installing
runners) Cargo crates distribution.
CargoAuthenticate@0
Conda environment This task is deprecated. Use conda directly in script to work
CondaEnvironment@1 with Anaconda environments.
CondaEnvironment@0
Maven Authenticate Provides credentials for Azure Artifacts feeds and external
MavenAuthenticate@0 maven repositories.
npm authenticate (for task Don't use this task if you're also using the npm task. Provides
runners) npm credentials to an .npmrc file in your repository for the
npmAuthenticate@0 scope of the build. This enables npm task runners like gulp
and Grunt to authenticate with private registries.
NuGet command Deprecated: use the “NuGet” task instead. It works with the
NuGet@0 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
organization/collection, and uses NuGet 4 by default.
NuGet packager Deprecated: use the “NuGet” task instead. It works with the
NuGetPackager@0 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
organization/collection, and uses NuGet 4 by default.
NuGet publisher Deprecated: use the “NuGet” task instead. It works with the
NuGetPublisher@0 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
organization/collection, and uses NuGet 4 by default.
Python pip authenticate Authentication task for the pip client used for installing
PipAuthenticate@1 Python distributions.
PipAuthenticate@0
Python twine upload Authenticate for uploading Python distributions using twine.
authenticate Add '-r FeedName/EndpointName --config-file
TwineAuthenticate@1 $(PYPIRC_PATH)' to your twine upload command. For feeds
TwineAuthenticate@0 present in this organization, use the feed name as the
repository (-r). Otherwise, use the endpoint name defined in
the service connection.
Task Description
App Center test Test app packages with Visual Studio App Center.
AppCenterTest@1
Mobile Center Test Test mobile app packages with Visual Studio Mobile
VSMobileCenterTest@0 Center.
Publish code coverage results Publish any of the code coverage results from a build.
PublishCodeCoverageResults@2
PublishCodeCoverageResults@1
Run functional tests Deprecated: This task and it’s companion task (Visual
RunVisualStudioTestsusingTestAgent@1 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 job 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 Run unit and functional tests (Selenium, Appium,
VSTest@2 Coded UI test, etc.) using the Visual Studio Test (VsTest)
VSTest@1 runner. Test frameworks that have a Visual Studio test
adapter such as MsTest, xUnit, NUnit, Chutzpah (for
JavaScript tests using QUnit, Mocha and Jasmine), etc.
can be run. Tests can be distributed on multiple agents
using this task (version 2).
Task Description
Visual Studio Test Agent Deployment Deploy and configure Test Agent to run tests on a set
DeployVisualStudioTestAgent@1 of machines.
Xamarin Test Cloud [Deprecated] Test mobile apps with Xamarin Test Cloud
XamarinTestCloud@1 using Xamarin.UITest. Instead, use the 'App Center test'
task.
Tool tasks
ノ Expand table
Task Description
.NET Core SDK/runtime installer Acquire a specific version of the .NET Core SDK from the
DotNetCoreInstaller@1 internet or local cache and add it to the PATH.
DotNetCoreInstaller@0
Duffle tool installer Install a specified version of Duffle for installing and
DuffleInstaller@0 managing CNAB bundles.
Install Azure Func Core Tools Install Azure Func Core Tools.
FuncToolsInstaller@0
NuGet tool installer Acquires a specific version of NuGet from the internet or
NuGetToolInstaller@1 the tools cache and adds it to the PATH. Use this task to
Task Description
Use .NET Core Acquires a specific version of the .NET Core SDK from the
UseDotNet@2 internet or the local cache and adds it to the PATH. Use this
task to change the version of .NET Core used in subsequent
tasks. Additionally provides proxy support.
Use Node.js ecosystem Set up a Node.js environment and add it to the PATH,
UseNode@1 additionally providing proxy support.
NodeTool@0
Use Python version Use the specified version of Python from the tool cache,
UsePythonVersion@0 optionally adding it to the PATH.
Use Ruby version Use the specified version of Ruby from the tool cache,
UseRubyVersion@0 optionally adding it to the PATH.
Visual Studio test platform Acquire the test platform from nuget.org or the tool cache.
installer Satisfies the ‘vstest’ demand and can be used for running
VisualStudioTestPlatformInstaller@1 tests and collecting diagnostic data using the Visual Studio
Test task.
Utility tasks
ノ Expand table
Task Description
Advanced Security Dependency Scan for open source dependency vulnerabilities in your
Scanning source code.
AdvancedSecurity-Dependency-
Scanning@1
Archive Files Archive files using compression formats such as .7z, .rar,
ArchiveFiles@1 .tar.gz, and .zip.
Command Line Run a command line script using Bash on Linux and
CmdLine@2 macOS and cmd.exe on Windows.
CmdLine@1
Copy files Copy files from a source folder to a target folder using
CopyFiles@2 patterns matching file paths (not folder paths).
Copy Files Copy files from source folder to target folder using
CopyFiles@1 minimatch patterns (The minimatch patterns will only
match file paths, not folder paths).
Deploy Azure Static Web App Build and deploy an Azure Static Web App.
AzureStaticWebApp@0
Download artifacts from file share Download artifacts from a file share, like \share\drop.
DownloadFileshareArtifacts@1
GitHub Comment Write a comment to your GitHub entity i.e. issue or a pull
GitHubComment@0 request (PR).
Install Apple provisioning profile Install an Apple provisioning profile required to build on
InstallAppleProvisioningProfile@1 a macOS agent machine.
Install Apple Provisioning Profile Install an Apple provisioning profile required to build on
InstallAppleProvisioningProfile@0 a macOS agent.
Node.js tasks runner installer Install specific Node.js version to run node tasks.
NodeTaskRunnerInstaller@0
Notation Azure Pipepine Task for setting up Notation CLI, sign and
Notation@0 verify with Notation.
Publish Pipeline Artifacts Publish (upload) a file or directory as a named artifact for
PublishPipelineArtifact@1 the current run.
PublishPipelineArtifact@0
Publish To Azure Service Bus Sends a message to Azure Service Bus using a service
PublishToAzureServiceBus@1 connection (no agent is required).
PublishToAzureServiceBus@0
Query Azure Monitor alerts Observe the configured Azure Monitor rules for active
AzureMonitor@1 alerts.
Query Classic Azure Monitor alerts Observe the configured classic Azure Monitor rules for
AzureMonitor@0 active alerts.
Query work items Execute a work item query and check the number of
queryWorkItems@0 items returned.
Review App Use this task under deploy phase provider to create a
ReviewApp@0 resource dynamically.
Update Service Fabric App Versions Automatically updates the versions of a packaged
ServiceFabricUpdateAppVersions@1 Service Fabric application.
Task Description
Update Service Fabric manifests Automatically update portions of application and service
ServiceFabricUpdateManifests@2 manifests in a packaged Azure Service Fabric application.
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
JSON
{
"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.
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 .
yml
- 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.
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.
JSON
"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.
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.
Feedback
Was this page helpful? Yes No
Provide product feedback
DotNetCoreCLI@2 - .NET Core v2 task
Article • 04/29/2024
Build, test, package, or publish a dotnet application, or run a custom dotnet command.
Syntax
YAML
# .NET Core v2
# Build, test, package, or publish a dotnet application, or run a custom
dotnet command.
- task: DotNetCoreCLI@2
inputs:
command: 'build' # 'build' | 'push' | 'pack' | 'publish' | 'restore' |
'run' | 'test' | 'custom'. Required. Command. Default: build.
#publishWebProjects: true # boolean. Optional. Use when command =
publish. Publish web projects. Default: true.
#projects: # string. Optional. Use when command = build || command =
restore || command = run || command = test || command = custom ||
publishWebProjects = false. Path to project(s) or solution(s).
#custom: # string. Required when command = custom. Custom command.
#arguments: # string. Optional. Use when command = build || command =
publish || command = run || command = test || command = custom. Arguments.
#restoreArguments: # string. Optional. Use when command = restore.
Arguments.
#publishTestResults: true # boolean. Optional. Use when command = test.
Publish test results and code coverage. Default: true.
#testRunTitle: # string. Optional. Use when command = test. Test run
title.
#zipAfterPublish: true # boolean. Optional. Use when command = publish.
Zip published projects. Default: true.
#modifyOutputPath: true # boolean. Optional. Use when command = publish.
Add project's folder name to publish path. Default: true.
#packagesToPush: '$(Build.ArtifactStagingDirectory)/*.nupkg' # string.
Alias: searchPatternPush. Required when command = push. Path to NuGet
package(s) to publish. Default: $(Build.ArtifactStagingDirectory)/*.nupkg.
#nuGetFeedType: 'internal' # 'internal' | 'external'. Required when
command = push. Target feed location. Default: internal.
#publishVstsFeed: # string. Alias: feedPublish. Required when command =
push && nuGetFeedType = internal. Target feed.
#publishFeedCredentials: # string. Alias: externalEndpoint. Required
when command = push && nuGetFeedType = external. NuGet server.
#packagesToPack: '**/*.csproj' # string. Alias: searchPatternPack.
Required when command = pack. Path to csproj or nuspec file(s) to pack.
Default: **/*.csproj.
#configuration: '$(BuildConfiguration)' # string. Alias:
configurationToPack. Optional. Use when command = pack. Configuration to
Package. Default: $(BuildConfiguration).
#packDirectory: '$(Build.ArtifactStagingDirectory)' # string. Alias:
outputDir. Optional. Use when command = pack. Package Folder. Default:
$(Build.ArtifactStagingDirectory).
#nobuild: false # boolean. Optional. Use when command = pack. Do not
build. Default: false.
#includesymbols: false # boolean. Optional. Use when command = pack.
Include Symbols. Default: false.
#includesource: false # boolean. Optional. Use when command = pack.
Include Source. Default: false.
# Feeds and authentication
#feedsToUse: 'select' # 'select' | 'config'. Alias: selectOrConfig.
Required when command = restore. Feeds to use. Default: select.
#vstsFeed: # string. Alias: feedRestore. Optional. Use when
selectOrConfig = select && command = restore. Use packages from this Azure
Artifacts feed.
#includeNuGetOrg: true # boolean. Optional. Use when selectOrConfig =
select && command = restore. Use packages from NuGet.org. Default: true.
#nugetConfigPath: # string. Optional. Use when selectOrConfig = config
&& command = restore. Path to NuGet.config.
#externalFeedCredentials: # string. Alias: externalEndpoints. Optional.
Use when selectOrConfig = config && command = restore. Credentials for feeds
outside this organization/collection.
# Advanced
#noCache: false # boolean. Optional. Use when command = restore. Disable
local cache. Default: false.
#restoreDirectory: # string. Alias: packagesDirectory. Optional. Use
when command = restore. Destination directory.
#verbosityRestore: 'Detailed' # '-' | 'Quiet' | 'Minimal' | 'Normal' |
'Detailed' | 'Diagnostic'. Optional. Use when command = restore. Verbosity.
Default: Detailed.
# Advanced
#publishPackageMetadata: true # boolean. Optional. Use when command =
push && nuGetFeedType = internal && command = push. Publish pipeline
metadata. Default: true.
# Pack options
#versioningScheme: 'off' # 'off' | 'byPrereleaseNumber' | 'byEnvVar' |
'byBuildNumber'. Required when command = pack. Automatic package versioning.
Default: off.
#versionEnvVar: # string. Required when versioningScheme = byEnvVar &&
command = pack. Environment variable.
#majorVersion: '1' # string. Alias: requestedMajorVersion. Required when
versioningScheme = byPrereleaseNumber && command = pack. Major. Default: 1.
#minorVersion: '0' # string. Alias: requestedMinorVersion. Required when
versioningScheme = byPrereleaseNumber && command = pack. Minor. Default: 0.
#patchVersion: '0' # string. Alias: requestedPatchVersion. Required when
versioningScheme = byPrereleaseNumber && command = pack. Patch. Default: 0.
# Advanced
#buildProperties: # string. Optional. Use when command = pack.
Additional build properties.
#verbosityPack: 'Detailed' # '-' | 'Quiet' | 'Minimal' | 'Normal' |
'Detailed' | 'Diagnostic'. Optional. Use when command = pack. Verbosity.
Default: Detailed.
# Advanced
#workingDirectory: # string. Optional. Use when command != restore &&
command != push && command != pack && command != pack && command != push &&
command != restore. Working directory.
Inputs
command - Command
string . Required. Allowed values: build , push (nuget push), pack , publish , restore ,
run , test , custom . Default value: build .
The dotnet command to run. Specify custom to add arguments or use a command not
listed here.
) Important
The NuGet Authenticate task is the new recommended way to authenticate with
Azure Artifacts and other NuGet repositories. The restore and push commands of
this .NET Core CLI task no longer take new features and only critical bugs are
addressed. See remarks for details.
If this input is set to true , the projects property value is skipped, and the task tries to
find the web projects in the repository and run the publish command on them. Web
projects are identified by the presence of either a web.config file or a wwwroot folder in
the directory. In the absence of a web.config file or a wwwroot folder, projects that use a
web SDK, like Microsoft.NET.Sdk.Web , are selected.
string . Optional. Use when command = build || command = restore || command = run ||
The path to the .csproj or .sln file(s) to use. You can use wildcards (e.g. **/*.csproj
for all .csproj files in all subfolders). For more information, see the file matching
patterns reference.
This path is relative to the root of the repository regardless of the workingDirectory
setting.
custom - Custom command
string . Required when command = custom .
The command to pass to dotnet.exe for execution. For a full list of available commands,
see the dotnet CLI documentation.
arguments - Arguments
string . Optional. Use when command = build || command = publish || command = run ||
Specifies the arguments for the selected command. For example, build configuration,
output folder, and runtime. The arguments depend on the command selected.
This input currently only accepts arguments for build , publish , run , test , and custom .
If you would like to add arguments for a command not listed, use custom .
restoreArguments - Arguments
Enabling this option will generate a test results TRX file in $(Agent.TempDirectory) ,
and the results will be published to the server.
Code coverage can be collected by adding the --collect "Code coverage" option to the
command line arguments.
If this input is set to true , folders created by the publish command will be zipped and
deleted.
If this input is set to true , folders created by the publish command will have the project
file name prefixed to their folder names when the output path is specified explicitly in
arguments. This is useful if you want to publish multiple projects to the same folder.
Input alias: selectOrConfig . string . Required when command = restore . Allowed values:
select (Feed(s) I select here), config (Feeds in my NuGet.config). Default value: select .
You can either select a feed from Azure Artifacts and/or NuGet.org here, or you can
commit a nuget.config file to your source code repository and set its path using the
nugetConfigPath input.
Input alias: feedRestore . string . Optional. Use when selectOrConfig = select &&
command = restore .
Includes the selected feed in the generated NuGet.config . You must have Package
Management installed and licensed to select a feed here. projectName / feedName are
used for project-scoped feeds. Only FeedName is used for organization-scoped feeds.
Note: This is not supported for the test command.
boolean . Optional. Use when selectOrConfig = select && command = restore . Default
value: true .
The NuGet.config in your repository that specifies the feeds from which to restore
packages.
Input alias: externalEndpoints . string . Optional. Use when selectOrConfig = config &&
command = restore .
The credentials to use for external registries located in the selected NuGet.config . For
feeds in this organization/collection, leave this input blank; the build's credentials are
used automatically.
Specifies the folder in which packages are installed. If no folder is specified, packages
are restored into the default NuGet package cache.
verbosityRestore - Verbosity
string . Optional. Use when command = restore . Allowed values: - , Quiet , Minimal ,
Normal , Detailed , Diagnostic . Default value: Detailed .
Specifies the amount of detail displayed in the output for the restore command.
Input alias: searchPatternPush . string . Required when command = push . Default value:
$(Build.ArtifactStagingDirectory)/*.nupkg .
The pattern to match or path to nupkg files to be uploaded. Multiple patterns can be
separated by a semicolon, and you can make a pattern negative by prefixing it with ! .
Example: **/*.nupkg;!**/*.Tests.nupkg .
nuGetFeedType - Target feed location
Input alias: feedPublish . string . Required when command = push && nuGetFeedType =
internal .
Specifies a feed hosted in this organization. You must have Package Management
installed and licensed to select a feed here.
boolean . Optional. Use when command = push && nuGetFeedType = internal && command =
Associates this build/release pipeline's metadata (run #, source code information) with
the package.
Input alias: externalEndpoint . string . Required when command = push && nuGetFeedType
= external .
The NuGet service connection that contains the external NuGet server's credentials.
Input alias: searchPatternPack . string . Required when command = pack . Default value:
**/*.csproj .
You can separate multiple patterns with a semicolon, and you can make a pattern
negative by prefixing it with ! . Example: **/*.csproj;!**/*.Tests.csproj .
configuration - Configuration to Package
Input alias: configurationToPack . string . Optional. Use when command = pack . Default
value: $(BuildConfiguration) .
When using a .csproj file, this input specifies the configuration to package.
Input alias: outputDir . string . Optional. Use when command = pack . Default value:
$(Build.ArtifactStagingDirectory) .
The folder where packages will be created. If this folder is empty, packages will be
created alongside the csproj file.
Specifies that the task will not build the project before packing. This task corresponds to
the --no-build parameter of the build command.
Includes source code in the package. This task corresponds to the --include-source
command line parameter.
string . Required when command = pack . Allowed values: off , byPrereleaseNumber (Use
the date and time), byEnvVar (Use an environment variable), byBuildNumber (Use the
build number). Default value: off .
This task cannot be used with included referenced projects. If you choose Use the date
and time , this will generate a SemVer -compliant version formatted as X.Y.Z-ci-
datetime where you choose X , Y , and Z .
If you choose Use an environment variable , you must select an environment variable
and ensure it contains the version number you want to use.
If you choose Use the build number , this will use the build number to version your
package. Note: Under Options , set the build number format to
$(BuildDefinitionName)_$(Year:yyyy).$(Month).$(DayOfMonth)$(Rev:.r) .
majorVersion - Major
minorVersion - Minor
patchVersion - Patch
Specifies a list of token = value pairs, separated by semicolons, where each occurrence
of $token$ in the .nuspec file will be replaced with the given value. Values can be
strings in quotation marks.
verbosityPack - Verbosity
string . Optional. Use when command = pack . Allowed values: - , Quiet , Minimal , Normal ,
Detailed , Diagnostic . Default value: Detailed .
Specifies the amount of detail displayed in the output for the pack command.
string . Optional. Use when command != restore && command != push && command != pack
&& command != pack && command != push && command != restore .
The current working directory where the script is run. Empty is the root of the repo
(build) or artifacts (release), which is $(System.DefaultWorkingDirectory) .
Output variables
None.
Remarks
) Important
The NuGet Authenticate task is the new recommended way to authenticate with
Azure Artifacts and other NuGet repositories. The restore and push commands of
this .NET Core CLI task no longer take new features and only critical bugs are
addressed.
dotnet restore in an earlier step, because the earlier step will have cleaned up the
credentials it used.
To fix this issue, add the --no-restore flag to the Arguments textbox.
In addition, the test command does not recognize the feedRestore or vstsFeed
arguments, and feeds specified in this manner will not be included in the generated
NuGet.config file when the implicit restore step runs. It's recommended that an explicit
dotnet restore step be used to restore packages. The restore command respects the
YAML
# Restore project
- task: DotNetCoreCLI@2
inputs:
command: 'custom'
custom: 'restore'
# Build project
- task: DotNetCoreCLI@2
inputs:
command: 'custom'
custom: 'build'
arguments: '--no-restore'
Why should I check in a NuGet.config?
Checking a NuGet.config into source control ensures that a key piece of information
needed to build your project—the location of its packages—is available to every
developer that checks out your code.
However, for situations where a team of developers works on a large range of projects,
it's also possible to add an Azure Artifacts feed to the global NuGet.config on each
developer's machine. In these situations, using the Feeds I select here option in the
NuGet task replicates this configuration.
Troubleshooting
.NET Core does not have Entity Framework(EF) built-in. You will have to either install EF
before beginning execution or add global.json to the project with required .NET Core
SDK version. This will ensure that correct SDK is used to build EF project. If the required
version is not present on the machine, add the UseDotNetV2 task to your pipeline to
install the required version. For more information, see Get the Entity Framework Core
runtime.
Examples
Build examples
Push examples
Push examples
Pack examples
Publish examples
Restore examples
Test examples
Build examples
Build a project
YAML
# Build project
- task: DotNetCoreCLI@2
inputs:
command: 'build'
YAML
Push examples
YAML
# Push non test NuGet packages from a build to internal organization Feed
- task: DotNetCoreCLI@2
inputs:
command: 'push'
searchPatternPush:
'$(Build.ArtifactStagingDirectory)/*.nupkg;!$(Build.ArtifactStagingDirectory
)/*.Tests.nupkg'
feedPublish: 'FabrikamFeed'
YAML
YAML
YAML
Publish examples
YAML
Restore examples
YAML
#Restore packages with the .NET Core CLI task
- task: DotNetCoreCLI@2
displayName: 'dotnet restore'
inputs:
command: 'restore'
feedsToUse: 'select'
feedRestore: 'projectName/feedName'
projects: '**/*.csproj'
includeNuGetOrg: true
Test examples
YAML
Requirements
ノ Expand table
Requirement Description
Runs on Agent
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Syntax
YAML
# .NET Core v1
# Build, test and publish using dotnet core command-line.
- task: DotNetCoreCLI@1
inputs:
command: 'build' # 'build' | 'publish' | 'restore' | 'test' | 'run'.
Required. Command. Default: build.
#publishWebProjects: true # boolean. Optional. Use when command =
publish. Publish Web Projects. Default: true.
#projects: # string. Optional. Use when command != publish ||
publishWebProjects = false. Project(s).
#arguments: # string. Arguments.
#zipAfterPublish: true # boolean. Optional. Use when command = publish.
Zip Published Projects. Default: true.
Inputs
command - Command
string . Required. Allowed values: build , publish , restore , test , run . Default value:
build .
The dotnet command to run. Specify custom to add arguments or use a command not
listed here.
If this input is set to true , the projects property value is skipped, and the task tries to
find the web projects in the repository and run the publish command on them. Web
projects are identified by the presence of either a web.config file or a wwwroot folder in
the directory. In the absence of a web.config file or a wwwroot folder, projects that use a
web SDK, like Microsoft.NET.Sdk.Web , are selected.
projects - Project(s)
The path to the .csproj file(s) to use. You can use wildcards (e.g. **/*.csproj for all
.csproj files in all subfolders). For more information, see the file matching patterns
reference.
arguments - Arguments
string .
Specifies the arguments for the selected command. For example, build configuration,
output folder, and runtime. The arguments depend on the command selected.
This input currently only accepts arguments for build , publish , run , test , and custom .
If you would like to add arguments for a command not listed, use custom .
If this input is set to true , a folder created by the publish command will be zipped and
deleted.
Output variables
None.
Remarks
For a newer version of this task, see DotNetCoreCLI@2.
Requirements
ノ Expand table
Requirement Description
Runs on Agent
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
See also
DotNetCoreCLI@2
Feedback
Was this page helpful? Yes No
Use this task to build, test, package, or publish a dotnet application, or to run a custom
dotnet command. For package commands, this task supports NuGet.org and
authenticated feeds like Package Management and MyGet.
If your .NET Core or .NET Standard build depends on NuGet packages, make sure to add
two copies of this step: one with the restore command and one with the build
command.
Syntax
# .NET Core v0
# Build, test and publish using dotnet core command-line.
- task: DotNetCoreCLI@0
inputs:
command: 'build' # 'build' | 'publish' | 'restore' | 'test' | 'run'.
Required. Command. Default: build.
#publishWebProjects: true # boolean. Optional. Use when command =
publish. Publish Web Projects. Default: true.
#projects: # string. Optional. Use when command != publish ||
publishWebProjects = false. Project(s).
#arguments: # string. Arguments.
#zipAfterPublish: true # boolean. Optional. Use when command = publish.
Zip Published Projects. Default: true.
Inputs
command - Command
string . Required. Allowed values: build , publish , restore , test , run . Default value:
build .
The dotnet command to run. Specify custom to add arguments or use a command not
listed here.
projects - Project(s)
The path to the .csproj file(s) to use. You can use wildcards (e.g. **/*.csproj for all
.csproj files in all subfolders). For more information, see the file matching patterns
reference.
arguments - Arguments
string .
Specifies the arguments for the selected command. For example, build configuration,
output folder, and runtime. The arguments depend on the command selected.
This input currently only accepts arguments for build , publish , run , test , and custom .
If you want to add arguments for a command not listed, use custom .
If this input is set to true , the folder created by the publish command will be zipped
and deleted.
Output variables
None.
Remarks
) Important
DotNetCoreCLI@2.
Requirements
ノ Expand table
Requirement Description
Runs on Agent
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
See also
DotNetCoreCLI@2
Feedback
Was this page helpful? Yes No
Use this task to acquire a specific version of the .NET Core SDK from the internet or local
cache and add it to the PATH.
) Important
This task is deprecated and will be retired January 31, 2024. Use UseDotNet@2.
Syntax
YAML
Inputs
packageType - Package to install
string . Required. Allowed values: runtime (Only Runtime), sdk (SDK (contains
Find the value of version for installing SDK/Runtime in the releases-index file .
Specifies if you want preview versions to be included while searching for latest versions.
This setting is ignored if you specify an exact version, such as 3.0.100-preview3-010431 .
Specifies where .NET Core SDK/Runtime should be installed. Different paths can have
the following impact on .NET's behavior:
You can also configure the Multi-Level Lookup setting. This setting can configure .NET
host to probe for a suitable version.
Output variables
None.
Remarks
This task is deprecated. Use @UseDotNet2.
Requirements
ノ Expand table
Requirement Description
Demands None
Capabilities Running this task satisfies the following demands for any subsequent tasks
in the same job: DotNetCore
Command Any
restrictions
Feedback
Was this page helpful? Yes No
Use this task to acquire a specific version of the .NET Core SDK from the internet or local
cache and add it to the PATH.
) Important
Syntax
YAML
Inputs
packageType - Package to install
string . Required. Allowed values: runtime , sdk (SDK (contains runtime)). Default value:
sdk .
version - Version
string . Required. Default value: 1.0.4 .
Specifies the exact version of the .NET Core SDK or Runtime to install.
Find the value of version-sdk for installing the SDK, or version-runtime for installing
Runtime from any releases in GitHub .
7 Note
The task won't work with new versions of .NET Core. Upgrade to @UseDotNet2 of
the task so you can download the latest versions of .NET Core.
Output variables
None.
Remarks
This task is deprecated. Use @UseDotNet2.
Requirements
ノ Expand table
Requirement Description
Demands None
Capabilities Running this task satisfies the following demands for any subsequent tasks
in the same job: DotNetCore
Command Any
restrictions
Attempts to automatically build your project for CodeQL analysis by finding and
building project files in the source folder. This task is not required if you have your own
custom build steps, or if you are not using cpp , java , csharp , or swift . You must have
GitHub Advanced Security for Azure DevOps enabled for the repository being scanned.
Syntax
YAML
Inputs
None.
Output variables
None.
Remarks
) Important
This task is not required if you have your own custom build steps, or if you are not using
cpp , java , csharp , or swift . You must have GitHub Advanced Security for Azure
1. Initialize CodeQL
2. AutoBuild (or your custom build tasks)
3. Perform CodeQL analysis
The AutoBuild task is optional and may be replaced with your custom build tasks. Either
AutoBuild or your custom build tasks must be run for your project to be analyzed.
The AdvancedSecurity-Codeql-Autobuild@1 task must appear after the initialize step for
successful completion.
YAML
# Run analysis
- task: AdvancedSecurity-Codeql-Analyze@1
displayName: 'Advanced Security Code Scanning'
Requirements
ノ Expand table
Requirement Description
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
See also
Code scanning for GitHub Advanced Security
Feedback
Was this page helpful? Yes No
Scan your application for any vulnerabilities in open source components used in your
source code. You must have GitHub Advanced Security for Azure DevOps enabled for
the repository being scanned.
Syntax
YAML
Inputs
directoryExclusionList - Directory exclusion list
string .
Output variables
None.
Remarks
Use this task to scan your application for any vulnerabilities in open source components
used in your source code.
) Important
You must have GitHub Advanced Security for Azure DevOps enabled for the repository
being scanned.
Prerequisites
For the task to successfully complete and populate the Advanced Security tab for the
scanned repository, Advanced Security must be enabled for that repository prior to
running a build with the dependency scanning task included.
The task is available to run on self-hosted agents as well as Microsoft-hosted agents. For
self-hosted agents, see additional self-hosted agent set-up instructions.
For the most accurate scanning results, add the Advanced Security dependency
scanning task after your build steps but before any clean up of the build process, as
shown in the following example.
YAML
# Restore project
- task: DotNetCoreCLI@2
inputs:
command: 'custom'
custom: 'restore'
# Build project
- task: DotNetCoreCLI@2
inputs:
command: 'custom'
custom: 'build'
arguments: '--no-restore'
Requirements
ノ Expand table
Requirement Description
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
See also
Dependency scanning for GitHub Advanced Security
Feedback
Was this page helpful? Yes No
You must have GitHub Advanced Security for Azure DevOps enabled for the repository
being scanned.
Syntax
# Advanced Security Initialize CodeQL v1
# Initializes the CodeQL database in preparation for building.
- task: AdvancedSecurity-Codeql-Init@1
inputs:
#languages: # 'csharp' | 'cpp' | 'go' | 'java' | 'javascript' | 'python'
| 'ruby' | 'swift'. Languages to analyze.
#querysuite: 'Select a query suite...' # 'Select a query suite...' |
'code-scanning' | 'security-extended' | 'security-experimental' | 'security-
and-quality'. CodeQL Query Suite to use for analysis. Default: Select a
query suite....
# Advanced
#ram: # string. Options to control RAM usage in MB.
#threads: # string. Use this many threads to evaluate queries.
#codeqlpathstoignore: # string. Set a list of paths to exclude in the
CodeQL analysis.
#codeqlpathstoinclude: # string. Set a list of additional paths to
include in the CodeQL analysis.
#sourcesfolder: # string. Sets the folder that contains the sources to
be analyzed.
#loglevel: '_' # '0' | '1' | '2' | '_'. Set the log level for the CodeQL
analysis. Default: _.
#configfilepath: # string. Use this to enable custom query analysis in
codeql (path must be absolute).
#codeqltoolsdirectory: # string. Set a custom CodeQL tools directory
(path must be absolute).
Inputs
languages - Languages to analyze
string . Allowed values: csharp , cpp , go , java , javascript , python , ruby , swift .
The programming language to analyze. Multiple languages can be separated by a
comma.
You can set the language here in the task, or you can specify the language in a pipeline
variable named advancedsecurity.codeql.language . If both are set, the value specified in
the task takes precedence.
The query suite, i.e. ruleset, used for analysis. You can specify the value here in the task,
or you can specify it in a pipeline variable named advancedsecurity.codeql.querysuite .
If both are set, the value specified in the task takes precedence. The default value is
Select a query suite... which indicates that the query suite must be specified in the
advancedsecurity.codeql.querysuite variable.
Set total amount of RAM the query evaluator should be allowed to use.
You can specify ram here in the task, or you can specify it in a pipeline variable named
advancedsecurity.codeql.ram . If both are set, the value specified in the task takes
precedence.
You can pass 0 to use one thread per core on the machine, or -N to leave N cores
unused (except still use at least one thread).
You can specify threads here in the task, or you can specify it in a pipeline variable
named advancedsecurity.codeql.threads . If both are set, the value specified in the task
takes precedence.
string .
You can provide multiple paths separated by commas. The paths must be relative to the
sourcesfolder where CodeQL is running, which defaults to the Build.SourcesDirectory
string .
You can provide multiple paths separated by commas. The paths must be relative to the
sourcesfolder where CodeQL is running, which defaults to the Build.SourcesDirectory
codeqlpathstoinclude: $(Build.SourcesDirectory)/app .
string .
If you don't provide this value, the default sources folder for the pipeline infrastructure
is used (provided by the Build.SourcesDirectory variable).
You can specify loglevel here in the task, or you can specify it in a pipeline variable
named advancedsecurity.codeql.loglevel . If both are set, the value specified in the task
takes precedence, unless the default value _ for loglevel in the task is specified. If _ is
specified, the value from advancedsecurity.codeql.loglevel is used if available.
configfilepath - Use this to enable custom query analysis in codeql (path must be
absolute).
string .
If path is not provided, then codeql analysis will proceed with default queries.
codeqltoolsdirectory - Set a custom CodeQL tools directory (path must be absolute)
string .
If the path is not provided, the default value of $agent_toolsdirectory will be utilized.
Output variables
None.
Remarks
You must have GitHub Advanced Security for Azure DevOps enabled for the repository
being scanned.
) Important
1. Initialize CodeQL
2. AutoBuild (or your custom build tasks)
3. Perform CodeQL analysis
The AutoBuild task is optional and may be replaced with your custom build tasks. Either
AutoBuild or your custom build tasks must be run for your project to be analyzed.
Requirements
ノ Expand table
Requirement Description
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
See also
Code scanning for GitHub Advanced Security
Feedback
Was this page helpful? Yes No
Analyzes the code in an Azure Repos Git repository to find security vulnerabilities and
coding errors. You must have GitHub Advanced Security for Azure DevOps enabled for
the repository being scanned.
Syntax
YAML
Inputs
WaitForProcessing - Enable Wait for Processing
Wait for Advanced Security to process published SARIF file before completing.
Time, in seconds, to wait between each call to Advanced Security to check SARIF
processing status.
WaitForProcessingTimeout - Wait for Processing Timeout
string . Optional. Use when WaitForProcessing = true . Default value: 120 .
Time, in seconds, to wait for Advanced Security to process SARIF file before completing.
Output variables
None.
Remarks
) Important
Prerequisites
For the task to successfully complete and populate the Advanced Security tab for the
scanned repository, Advanced Security must be enabled for that repository prior to
running a build with the dependency scanning task included.
The task is available to run on self-hosted agents as well as Microsoft-hosted agents. For
self-hosted agents, see additional self-hosted agent set-up instructions.
1. Initialize CodeQL
2. AutoBuild (or your custom build tasks)
3. Perform CodeQL analysis
The AutoBuild task is optional and may be replaced with your custom build tasks. Either
AutoBuild or your custom build tasks must be run for your project to be analyzed.
The analysis task must appear after the initialize task for successful completion.
YAML
# Run analysis
- task: AdvancedSecurity-Codeql-Analyze@1
displayName: 'Advanced Security Code Scanning'
Requirements
ノ Expand table
Requirement Description
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
See also
Code scanning for GitHub Advanced Security
Feedback
Was this page helpful? Yes No
Combines SARIF file(s) produced by code scanning tool(s), enhances the combined
SARIF file, and publishes the enhanced SARIF file to the Advanced Security service.
7 Note
This task publishes the SARIF files produced by non-Microsoft tasks to Code
Scanning for GitHub Advanced Security. Currently, this task works with the
Infrastructure-as-Code Scanning Tasks Extension tasks. For more information,
see Infrastructure‐as‐Code Scanning .
This task isn't needed when using GitHub Advanced Security for Azure DevOps
tasks like AdvancedSecurity-Dependency-Scanning@1 or AdvancedSecurity-
Codeql-Analyze@1.
Syntax
# Advanced Security Publish Results v1
# Combines SARIF file(s) produced by code scanning tool(s), enhances the
combined SARIF file, and publishes the enhanced SARIF file to the Advanced
Security service.
- task: AdvancedSecurity-Publish@1
inputs:
#SarifsInputDirectory: # string. SARIF(s) Input Directory.
#Category: # string. Category.
#WaitForProcessing: false # boolean. Enable Wait for Processing.
Default: false.
#WaitForProcessingInterval: '5' # string. Optional. Use when
WaitForProcessing = true. Wait for Processing Time Interval. Default: 5.
#WaitForProcessingTimeout: '120' # string. Optional. Use when
WaitForProcessing = true. Wait for Processing Timeout. Default: 120.
Inputs
SarifsInputDirectory - SARIF(s) Input Directory
string .
Path to the directory containing the SARIF file(s) that need to be combined, enhanced,
and published to Advanced Security. When not specified, the task will look for SARIF
file(s) in pre-determined locations.
Category - Category
string .
Category to associate scan results with when enhancing the SARIF file(s) before
publishing to Advanced Security. The category of scan results helps distinguish between
different types of scan results. Use this field when publishing SARIF file(s) produced by
tools other than CodeQL. When publishing SARIF file(s) produced by CodeQL, there is
no need to specify a category, and if one is specified, it will be ignored by the task.
Wait for Advanced Security to process published SARIF file before completing.
Time, in seconds, to wait between each call to Advanced Security to check SARIF
processing status.
Time, in seconds, to wait for Advanced Security to process SARIF file before completing.
Remarks
This task publishes the SARIF files produced by non-Microsoft tasks to Code Scanning
for GitHub Advanced Security. Currently, this task works with the Infrastructure-as-Code
Scanning Tasks Extension tasks. For more information, see Infrastructure‐as‐Code
Scanning .
This task isn't needed when using GitHub Advanced Security for Azure DevOps tasks like
AdvancedSecurity-Dependency-Scanning@1 or AdvancedSecurity-Codeql-Analyze@1.
Requirements
ノ Expand table
Requirement Description
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Feedback
Was this page helpful? Yes No
Use this task to build an Android app using Gradle and (optionally) start the emulator
for unit tests.
Syntax
# Android Build v1
# AndroidBuild@1 is deprecated. Use Gradle.
- task: AndroidBuild@1
inputs:
#gradleWrapper: # string. Location of Gradle Wrapper.
#gradleProj: # string. Project Directory.
#gradleArguments: 'build' # string. Gradle Arguments. Default: build.
# Android Virtual Device (AVD) Options
avdName: 'AndroidBuildEmulator' # string. Required. Name. Default:
AndroidBuildEmulator.
#createAvd: AndroidBuildEmulator # boolean. Create AVD. Default:
AndroidBuildEmulator.
#emulatorTarget: 'android-19' # string. Required when createAvd = true.
AVD Target SDK. Default: android-19.
#emulatorDevice: 'Nexus 5' # string. Optional. Use when createAvd =
true. AVD Device. Default: Nexus 5.
#avdAbi: 'default/armeabi-v7a' # string. Required when createAvd = true.
AVD ABI. Default: default/armeabi-v7a.
#avdForce: false # boolean. Optional. Use when createAvd = true.
Overwrite Existing AVD. Default: false.
#avdOptionalArgs: # string. Optional. Use when createAvd = true. Create
AVD Optional Arguments.
# Emulator Options
#startEmulator: false # boolean. Start and Stop Android Emulator.
Default: false.
#emulatorTimeout: '300' # string. Required when startEmulator = true.
Timeout in Seconds. Default: 300.
#emulatorHeadless: false # boolean. Optional. Use when startEmulator =
true. Headless Display. Default: false.
#emulatorOptionalArgs: '-no-snapshot-load -no-snapshot-save' # string.
Optional. Use when startEmulator = true. Emulator Optional Arguments.
Default: -no-snapshot-load -no-snapshot-save.
#deleteAvd: false # boolean. Optional. Use when startEmulator = true.
Delete AVD. Default: false.
Inputs
gradleWrapper - Location of Gradle Wrapper
string .
The location of the gradlew wrapper that is used for the build. Agents on Windows
(including Microsoft-hosted agents) must use the gradlew.bat wrapper. Agents on Linux
or macOS can use the gradlew shell script. Learn more about the Gradle Wrapper.
string .
The relative path from the repo root to the root directory of the application. This is most
likely to be where the build.gradle file is located.
Provides any options to pass to the Gradle command line. Learn more about the Gradle
command line .
avdName - Name
You must deploy your own agent to use this string. You cannot use a Microsoft-hosted
pool if you want to create an AVD.
The Android SDK version that the Android Virtual Device (AVD) targets.
emulatorDevice - AVD Device
string . Optional. Use when createAvd = true . Default value: Nexus 5 .
The device pipeline that may be used. This can be a device index or an Id.
The Application Binary Interface (ABI) to use for the Android Virtual Device (AVD). Learn
more about ABI Management .
Overwrites an existing AVD by passing --force to the android create avd command.
Starts and stops the Android emulator after the Android Build task finishes.
You must deploy your own agent to use this boolean. You cannot use a Microsoft-
hosted pool if you want to use an emulator. Learn more about Azure Pipeline agents.
Defines how long (in seconds) the build will wait for the emulator to start.
no-snapshot-save .
Output variables
None.
Requirements
ノ Expand table
Requirement Description
Demands Self-hosted agents must have capabilities that match the following demands
to run jobs that use this task: AndroidSDK
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Command Any
restrictions
Requirement Description
Feedback
Was this page helpful? Yes No
Use this task in a pipeline to sign and align Android APK files.
Syntax
# Android Signing v3
# Sign and align Android APK files.
- task: AndroidSigning@3
inputs:
apkFiles: '**/*.apk' # string. Alias: files. Required. APK files.
Default: **/*.apk.
# Signing Options
#apksign: true # boolean. Sign the APK. Default: true.
apksignerKeystoreFile: # string. Alias: keystoreFile. Required when
apksign = true. Keystore file.
#apksignerKeystorePassword: # string. Alias: keystorePass. Optional. Use
when apksign = true. Keystore password.
#apksignerKeystoreAlias: # string. Alias: keystoreAlias. Optional. Use
when apksign = true. Alias.
#apksignerKeyPassword: # string. Alias: keyPass. Optional. Use when
apksign = true. Key password.
#apksignerVersion: 'latest' # string. Optional. Use when apksign = true.
apksigner version. Default: latest.
#apksignerArguments: '--verbose' # string. Optional. Use when apksign =
true. apksigner arguments. Default: --verbose.
#apksignerFile: # string. Alias: apksignerLocation. Optional. Use when
apksign = true. apksigner location.
# Zipalign Options
#zipalign: true # boolean. Zipalign. Default: true.
#zipalignVersion: 'latest' # string. Optional. Use when zipalign = true.
Zipalign version. Default: latest.
#zipalignFile: # string. Alias: zipalignLocation. Optional. Use when
zipalign = true. Zipalign location.
Inputs
apkFiles - APK files
The relative path from the repo root to the APK(s) you want to sign. You can use
wildcards to specify multiple files. For example:
outputs\apk*.apk to sign all .APK files in the outputs\apk\ subfolder.
**/bin/*.apk to sign all .APK files in all bin subfolders.
Signs the APK with a provided Android Keystore file. Unsigned APKs can only run in an
emulator. APKs must be signed to run on a device.
The file path to the Android Keystore file that is used to sign the APK. This file must be
uploaded to the secure files library, where it is securely stored with encryption. The
Android Keystore file is removed from the agent machine when the pipeline completes.
The file can either be checked into source control or placed on the build machine
directly by an administrator. It is recommended to encrypt the keystore file in source
control and use the Decrypt File task to decrypt the file during the build.
) Important
Use a new variable with its lock enabled on the Variables pane to encrypt this value.
See secret variables.
apksignerKeystoreAlias - Alias
The alias that identifies the public/private key pair to be used in the Android Keystore
file.
apksignerKeyPassword - Key password
) Important
Use a new variable with its lock enabled on the Variables pane to encrypt this value.
See secret variables.
The Android SDK build-tools version that the apksigner executable uses for the task.
Provides options to pass to the apksigner command line. See the apksigner
documentation .
Specifies the location of the apksigner executable used during signing. This defaults to
the apksigner found in the Android SDK version folder that your application builds
against.
zipalign - Zipalign
boolean . Default value: true .
Select if you want to zipalign your package. This reduces the amount of RAM consumed
by an app.
The Android SDK build-tools version that the zipalign executable uses for the task.
zipalignFile - Zipalign location
Specifies the location of the zipalign executable used during signing. This defaults to
the zipalign found in the Android SDK version folder that your application builds
against.
Output variables
None.
Remarks
Use this task in a pipeline to sign and align Android APK files.
This version of the task uses apksigner instead of jarsigner to sign APKs.
Requirements
ノ Expand table
Requirement Description
Demands Self-hosted agents must have capabilities that match the following demands
to run jobs that use this task: JDK
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Command This task runs using the following command restrictions: restricted
restrictions
Requirement Description
Settable variables This task has permission to set the following variables: Setting variables is
disabled
Feedback
Was this page helpful? Yes No
Use this task in a pipeline to sign and align Android APK files.
Syntax
# Android Signing v2
# Sign and align Android APK files.
- task: AndroidSigning@2
inputs:
apkFiles: '**/*.apk' # string. Alias: files. Required. APK files.
Default: **/*.apk.
# Signing Options
#jarsign: true # boolean. Sign the APK. Default: true.
jarsignerKeystoreFile: # string. Alias: keystoreFile. Required when
jarsign = true. Keystore file.
#jarsignerKeystorePassword: # string. Alias: keystorePass. Optional. Use
when jarsign = true. Keystore password.
#jarsignerKeystoreAlias: # string. Alias: keystoreAlias. Optional. Use
when jarsign = true. Alias.
#jarsignerKeyPassword: # string. Alias: keyPass. Optional. Use when
jarsign = true. Key password.
#jarsignerArguments: '-verbose -sigalg MD5withRSA -digestalg SHA1' #
string. Optional. Use when jarsign = true. Jarsigner arguments. Default: -
verbose -sigalg MD5withRSA -digestalg SHA1.
# Zipalign Options
#zipalign: true # boolean. Zipalign. Default: true.
#zipalignFile: # string. Alias: zipalignLocation. Optional. Use when
zipalign = true. Zipalign location.
Inputs
apkFiles - APK files
The relative path from the repo root to the APK(s) you want to sign. You can use
wildcards to specify multiple files. For example:
Signs the APK with a provided keystore file. Unsigned APKs can only run in an emulator.
APKs must be signed to run on a device.
The file path to the Android Keystore file that is used to sign the APK. This file must be
uploaded to the secure files library, where it is securely stored with encryption. The
Android Keystore file is removed from the agent machine when the pipeline completes.
The file can either be checked into source control or placed on the build machine
directly by an administrator. It is recommended to encrypt the keystore file in source
control and use the Decrypt File task to decrypt the file during the build.
) Important
Use a new variable with its lock enabled on the Variables tab to encrypt this value.
See secret variables.
jarsignerKeystoreAlias - Alias
The alias that identifies the public/private key pair to be used in the Android Keystore
file.
The key password for the alias and Android Keystore file.
) Important
Use a new variable with its lock enabled on the Variables tab to encrypt this value.
See secret variables.
string . Optional. Use when jarsign = true . Default value: -verbose -sigalg MD5withRSA
-digestalg SHA1 .
zipalign - Zipalign
Select this boolean if you want to zipalign your package. This reduces the amount of
RAM consumed by an app.
Specifies the location of the zipalign executable used during signing. This defaults to the
zipalign found in the Android SDK version folder that your application builds against.
Output variables
None.
Requirements
ノ Expand table
Requirement Description
Demands Self-hosted agents must have capabilities that match the following demands
to run jobs that use this task: JDK
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Command This task runs using the following command restrictions: restricted
restrictions
Settable variables This task has permission to set the following variables: Setting variables is
disabled
Feedback
Was this page helpful? Yes No
Use this task in a pipeline to sign and align Android APK files.
Syntax
# Android Signing v1
# Sign and align Android APK files.
- task: AndroidSigning@1
inputs:
files: # string. Required. APK Files.
# Signing Options
#jarsign: true # boolean. Sign the APK. Default: true.
keystoreFile: # string. Required when jarsign = true. Keystore File.
#keystorePass: # string. Optional. Use when jarsign = true. Keystore
Password.
#keystoreAlias: # string. Optional. Use when jarsign = true. Alias.
#keyPass: # string. Optional. Use when jarsign = true. Key Password.
#jarsignerArguments: '-verbose -sigalg MD5withRSA -digestalg SHA1' #
string. Optional. Use when jarsign = true. Jarsigner Arguments. Default: -
verbose -sigalg MD5withRSA -digestalg SHA1.
# Zipalign Options
#zipalign: true # boolean. Zipalign. Default: true.
#zipalignLocation: # string. Optional. Use when zipalign = true.
Zipalign Location.
Inputs
files - APK Files
string . Required.
The relative path from the repo root to the APK(s) you want to sign. You can use
wildcards to specify multiple files. For example:
Signs the APK with a provided Android Keystore file. Unsigned APKs can only run in an
emulator. APKs must be signed to run on a device.
The file path to the Android Keystore file that is used to sign the APK. This file must be
uploaded to the secure files library, where it is securely stored with encryption. The
Android Keystore file is removed from the agent machine when the pipeline completes.
The file can either be checked into source control or placed on the build machine
directly by an administrator. It is recommended to encrypt the keystore file in source
control and use the Decrypt File task to decrypt the file during the build.
) Important
Use a new variable with its lock enabled on the Variables pane to encrypt this value.
See secret variables.
keystoreAlias - Alias
The alias that identifies the public/private key pair to be used in the Android Keystore
file.
The key password for the alias and Android Keystore file.
) Important
Use a new variable with its lock enabled on the Variables pane to encrypt this value.
See secret variables.
-digestalg SHA1 .
zipalign - Zipalign
boolean . Default value: true .
Select this boolean if you want to zipalign your package. This reduces the amount of
RAM consumed by an app.
Specifies the location of the zipalign executable used during signing. This defaults to the
zipalign found in the Android SDK version folder that your application builds against.
Output variables
None.
Requirements
ノ Expand table
Requirement Description
Demands Self-hosted agents must have capabilities that match the following demands
to run jobs that use this task: JDK, AndroidSDK
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Command Any
restrictions
Feedback
Was this page helpful? Yes No
Syntax
# Ant v1
# Build with Apache Ant.
- task: Ant@1
inputs:
buildFile: 'build.xml' # string. Alias: antBuildFile. Required. Ant
build file. Default: build.xml.
#options: # string. Options.
#targets: # string. Target(s).
# JUnit Test Results
#publishJUnitResults: true # boolean. Publish to Azure Pipelines.
Default: true.
testResultsFiles: '**/TEST-*.xml' # string. Required when
publishJUnitResults = true. Test results files. Default: **/TEST-*.xml.
#testRunTitle: # string. Optional. Use when publishJUnitResults = true.
Test run title.
# Code Coverage
#codeCoverageToolOptions: 'None' # 'None' | 'Cobertura' | 'JaCoCo'.
Alias: codeCoverageTool. Code coverage tool. Default: None.
codeCoverageClassFilesDirectories: '.' # string. Alias:
classFilesDirectories. Required when codeCoverageTool != None. Class files
directories. Default: ..
#codeCoverageClassFilter: # string. Alias: classFilter. Optional. Use
when codeCoverageTool != None. Class inclusion/exclusion filters.
#codeCoverageSourceDirectories: # string. Alias: srcDirectories.
Optional. Use when codeCoverageTool != None. Source files directories.
#codeCoverageFailIfEmpty: false # boolean. Alias: failIfCoverageEmpty.
Optional. Use when codeCoverageTool != None. Fail when code coverage results
are missing. Default: false.
# Advanced
#antHomeDirectory: # string. Alias: antHomeUserInputPath. Set ANT_HOME
path.
javaHomeOption: 'JDKVersion' # 'JDKVersion' | 'Path'. Alias:
javaHomeSelection. Required. Set JAVA_HOME by. Default: JDKVersion.
#jdkVersionOption: 'default' # 'default' | '1.11' | '1.10' | '1.9' |
'1.8' | '1.7' | '1.6'. Alias: jdkVersion. Optional. Use when
javaHomeSelection = JDKVersion. JDK version. Default: default.
#jdkUserInputDirectory: # string. Alias: jdkUserInputPath. Required when
javaHomeSelection = Path. JDK path.
#jdkArchitectureOption: 'x64' # 'x86' | 'x64'. Alias: jdkArchitecture.
Optional. Use when jdkVersion != default. JDK architecture. Default: x64.
Inputs
buildFile - Ant build file
The relative path from the repository root to the Ant build file.
For more information about build files, see Using Apache Ant .
options - Options
string .
Provides options to pass to the Ant command line. You can provide your own properties
(for example, -DmyProperty=myPropertyValue ) and also use built-in variables (for
example, -DcollectionId=$(system.collectionId) ). Alternatively, the built-in variables
are already set as environment variables during the build and can be passed directly (for
example, -DcollectionIdAsEnvVar=%SYSTEM_COLLECTIONID% ).
targets - Target(s)
string .
An optional, space-separated list of targets to build. If not specified, the default target
will be used. If no default target is defined, Ant 1.6.0 and later will build all top-level
tasks.
Select this option to publish JUnit test results produced by the Ant build to Azure
Pipelines. Each test results file matching Test Results Files will be published as a test
run in Azure Pipelines.
Input alias: codeCoverageTool . string . Allowed values: None , Cobertura , JaCoCo . Default
value: None .
If you are using the Microsoft-hosted agents, then the tools are set up for you. If you are
using the on-premises Windows agent, you must ensure the agent is set up for either
JaCoco or Cobertura.
JaCoCo - ensure that jacocoant.jar is available in the lib folder of Ant installation.
Learn more about JaCoCo Ant tasks .
Cobertura - ensure that an environment variable COBERTURA_HOME points to the
Cobertura .jar files location. Learn more about Cobertura with Ant tasks .
After you select one of these tools, the following arguments appear:
The comma-separated list of relative paths from the Ant build file to directories
containing class files and archive files ( .jar , .war , etc.). Code coverage is reported for
class files in these directories. For example: target/classes,target/testClasses .
The comma-separated list of filters to include or exclude classes from collecting code
coverage. For example: +:com. , +:org. , -:my.app*. .
codeCoverageSourceDirectories - Source files directories
The comma-separated list of relative paths from the Ant build file to source code
directories. Code coverage reports will use these to highlight source code. For example:
src/java,src/Test .
Fails the build if the code coverage did not produce any results to publish.
If set, overrides any existing ANT_HOME environment variable with the given path.
Sets JAVA_HOME either by selecting a JDK version that will be discovered during builds
or by manually entering a JDK path.
Attempts to discover the path to the selected JDK version and sets JAVA_HOME
accordingly.
Output variables
None.
Remarks
Use this task to build with Apache Ant.
Requirements
ノ Expand table
Requirement Description
Demands Self-hosted agents must have capabilities that match the following demands
to run jobs that use this task: ant
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Command Any
restrictions
Feedback
Was this page helpful? Yes No
Use this task to distribute app builds to testers and users via Visual Studio App Center.
Syntax
YAML
Inputs
serverEndpoint - App Center service connection
string . Required.
Selects the service connection for Visual Studio App Center. To create one, click the
Manage link and create a new service connection.
string . Required.
{orgname}/{app_identifier} .
The relative path from the repo root to the APK/AAB or IPA file you want to publish.
string .
The build version of the uploading binary which needs to be specified for .zip and
.msi . This value will be ignored unless the platform is WPF or WinForms.
Input alias: symbolsType . string . Allowed values: Apple , Android , UWP . Default value:
Apple .
Includes symbol files to receive symbolicated stack traces in App Center Diagnostics.
symbolsPath - Symbols path
string . Optional. Use when symbolsType == AndroidNative || symbolsType = Windows .
The relative path from the repo root to the symbols folder.
The relative path to the APPXSYM symbols file. Path may contain wildcards.
The relative path from the repo root to dSYM folder. Path may contain wildcards.
The relative path from the repo root to Android's mapping.txt file.
The relative path from the repo root to the additional native libraries you want to
publish (e.g. .so files).
Uploads the selected symbols file or folder and all other items inside the same parent
folder. This is required for React Native apps.
The release notes will be attached to the release and shown to testers on the installation
page.
releaseNotesInput - Release notes
Selects a UTF-8 encoded text file which contains the release notes for this version.
The App Center Distribute SDK required to mandate an update. Testers are automatically
prompted to update.
The IDs of the distribution groups who will receive the build release. Leave it empty to
use the default group, and use commas or semicolons to separate multiple IDs.
destinationStoreId - Destination ID
string . Required when destinationType = store .
The IDs of the distribution store that will receive the build release.
Output variables
None.
Remarks
Use this task to distribute app builds to testers and users through App Center.
Examples
This example pipeline builds an Android app, runs tests, and publishes the app using
App Center Distribute.
YAML
# Android
# Build your Android project with Gradle.
# Add steps that test, sign, and distribute the APK, save build artifacts,
and more:
# https://learn.microsoft.com/azure/devops/pipelines/ecosystems/android
pool:
vmImage: 'macOS-latest'
steps:
- task: Gradle@2
inputs:
workingDirectory: ''
gradleWrapperFile: 'gradlew'
gradleOptions: '-Xmx3072m'
publishJUnitResults: false
testResultsFiles: '**/TEST-*.xml'
tasks: build
- task: CopyFiles@2
inputs:
contents: '**/*.apk'
targetFolder: '$(build.artifactStagingDirectory)'
- task: PublishBuildArtifacts@1
inputs:
pathToPublish: '$(build.artifactStagingDirectory)'
artifactName: 'outputs'
artifactType: 'container'
Requirements
ノ Expand table
Requirement Description
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Feedback
Was this page helpful? Yes No
Use this task to distribute app builds to testers and users via Visual Studio App Center.
) Important
This task is deprecated and will be retired January 31, 2024. Use
AppCenterDistribute@3.
Syntax
# App Center distribute v2
# Distribute app builds to testers and users via Visual Studio App Center.
- task: AppCenterDistribute@2
inputs:
serverEndpoint: # string. Required. App Center service connection.
appSlug: # string. Required. App slug.
appFile: # string. Alias: app. Required. Binary file path.
releaseNotesOption: 'input' # 'input' | 'file'. Alias:
releaseNotesSelection. Required. Create release notes. Default: input.
releaseNotesInput: # string. Required when releaseNotesSelection =
input. Release notes.
#releaseNotesFile: # string. Required when releaseNotesSelection = file.
Release notes file.
#isMandatory: false # boolean. Require users to update to this release.
Default: false.
#distributionGroupId: # string. Alias: destinationIds | destinationId.
Destination IDs.
# Symbols
#symbolsOption: 'Apple' # 'Apple'. Alias: symbolsType. Symbols type.
Default: Apple.
#symbolsPath: # string. Optional. Use when symbolsType == AndroidNative
|| symbolsType = Windows. Symbols path.
#symbolsPdbFiles: '**/*.pdb' # string. Alias: pdbPath. Optional. Use
when symbolsType = UWP. Symbols path (*.pdb). Default: **/*.pdb.
#symbolsDsymFiles: # string. Alias: dsymPath. Optional. Use when
symbolsType = Apple. dSYM path.
#symbolsMappingTxtFile: # string. Alias: mappingTxtPath. Optional. Use
when symbolsType = AndroidJava. Mapping file.
#symbolsIncludeParentDirectory: # boolean. Alias: packParentFolder.
Include all items in parent folder.
Inputs
serverEndpoint - App Center service connection
string . Required.
Selects the service connection for Visual Studio App Center. To create one, click the
Manage link and create a new service connection.
string . Required.
{orgname}/{app_identifier} .
The relative path from the repo root to the APK or IPA file you want to publish.
Input alias: symbolsType . string . Allowed values: Apple . Default value: Apple .
Includes symbol files to receive symbolicated stack traces in App Center Diagnostics.
The relative path from the repo root to the symbols folder.
Input alias: pdbPath . string . Optional. Use when symbolsType = UWP . Default value:
**/*.pdb .
The relative path from the repo root to PDB symbols files. Path may contain wildcards.
symbolsDsymFiles - dSYM path
The relative path from the repo root to dSYM folder. Path may contain wildcards.
The relative path from the repo root to Android's mapping.txt file.
Uploads the selected symbols file or folder and all other items inside the same parent
folder. This is required for React Native apps.
Release notes are attached to the release and shown to testers on the installation page.
Selects a UTF-8 encoded text file which contains the release notes for this version.
The App Center Distribute SDK required to mandate update. Testers are automatically
prompted to update.
distributionGroupId - Destination IDs
The IDs of the distribution stores or groups who will receive the build release. Leave it
empty to use the default group.
Output variables
None.
Remarks
This task is deprecated. Use AppCenterDistribute@3.
Requirements
ノ Expand table
Requirement Description
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Use this task to distribute app builds to testers and users via App Center and Visual
Studio App Center.
) Important
This task is deprecated and will be retired January 31, 2024. Use
AppCenterDistribute@3.
Syntax
# App Center distribute v1
# Distribute app builds to testers and users via Visual Studio App Center.
- task: AppCenterDistribute@1
inputs:
serverEndpoint: # string. Required. App Center service connection.
appSlug: # string. Required. App slug.
appFile: # string. Alias: app. Required. Binary file path.
releaseNotesOption: 'input' # 'input' | 'file'. Alias:
releaseNotesSelection. Required. Create release notes. Default: input.
releaseNotesInput: # string. Required when releaseNotesSelection =
input. Release notes.
#releaseNotesFile: # string. Required when releaseNotesSelection = file.
Release notes file.
#isMandatory: false # boolean. Require users to update to this release.
Default: false.
#distributionGroupId: # string. Alias: destinationId. Destination ID.
# Symbols
#symbolsOption: 'Apple' # 'Apple'. Alias: symbolsType. Symbols type.
Default: Apple.
#symbolsPath: # string. Optional. Use when symbolsType == AndroidNative
|| symbolsType = Windows. Symbols path.
#symbolsPdbFiles: '**/*.pdb' # string. Alias: pdbPath. Optional. Use
when symbolsType = UWP. Symbols path (*.pdb). Default: **/*.pdb.
#symbolsDsymFiles: # string. Alias: dsymPath. Optional. Use when
symbolsType = Apple. dSYM path.
#symbolsMappingTxtFile: # string. Alias: mappingTxtPath. Optional. Use
when symbolsType = AndroidJava. Mapping file.
#symbolsIncludeParentDirectory: # boolean. Alias: packParentFolder.
Include all items in parent folder.
Inputs
serverEndpoint - App Center service connection
string . Required.
Selects the service connection for Visual Studio App Center. To create one, click the
Manage link and create a new service connection.
string . Required.
{orgname}/{app_identifier} .
The relative path from the repo root to the APK or IPA file you want to publish.
Input alias: symbolsType . string . Allowed values: Apple . Default value: Apple .
Includes symbol files to receive symbolicated stack traces in App Center Diagnostics.
The relative path from the repo root to the symbols folder.
Input alias: pdbPath . string . Optional. Use when symbolsType = UWP . Default value:
**/*.pdb .
The relative path from the repo root to .pdb symbols files. Path may contain wildcards.
symbolsDsymFiles - dSYM path
The relative path from the repo root to the dSYM folder. Path may contain wildcards.
The relative path from the repo root to Android's mapping.txt file.
Uploads the selected symbols file or folder and all other items inside the same parent
folder. This is required for React Native apps.
The release notes are attached to the release and shown to testers on the installation
page.
Selects a UTF-8 encoded text file which contains the release notes for this version.
The App Center Distribute SDK required to mandate an update. Testers are automatically
prompted to update.
distributionGroupId - Destination ID
The IDs of the distribution stores or groups who will receive the build release. Leave it
empty to use the default group.
Output variables
None.
Remarks
This task is deprecated. Use AppCenterDistribute@3.
Requirements
ノ Expand table
Requirement Description
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Use this task to distribute app builds to testers and users via App Center.
) Important
Syntax
# App Center distribute v0
# Distribute app builds to testers and users via App Center.
- task: AppCenterDistribute@0
inputs:
serverEndpoint: # string. Required. App Center connection.
appSlug: # string. Required. App slug.
appFile: # string. Alias: app. Required. Binary file path.
releaseNotesOption: 'input' # 'input' | 'file'. Alias:
releaseNotesSelection. Required. Create release notes. Default: input.
releaseNotesInput: # string. Required when releaseNotesSelection =
input. Release notes.
#releaseNotesFile: # string. Required when releaseNotesSelection = file.
Release notes file.
#distributionGroupId: # string. Distribution group ID.
# Symbols
#symbolsOption: 'Apple' # 'Apple'. Alias: symbolsType. Symbols type.
Default: Apple.
#symbolsPath: # string. Optional. Use when symbolsType == AndroidNative
|| symbolsType = Windows. Symbols path.
#symbolsPdbFiles: '**/*.pdb' # string. Alias: pdbPath. Optional. Use
when symbolsType = UWP. Symbols path (*.pdb). Default: **/*.pdb.
#symbolsDsymFiles: # string. Alias: dsymPath. Optional. Use when
symbolsType = Apple. dSYM path.
#symbolsMappingTxtFile: # string. Alias: mappingTxtPath. Optional. Use
when symbolsType = AndroidJava. Mapping file.
#symbolsIncludeParentDirectory: # boolean. Alias: packParentFolder.
Include all items in parent folder.
Inputs
serverEndpoint - App Center connection
string . Required.
Selects the service endpoint for your Visual Studio App Center connection. To create
one, click the Manage link and create a new service endpoint.
The relative path from the repo root to the APK or IPA file you want to publish.
Input alias: symbolsType . string . Allowed values: Apple . Default value: Apple .
Includes symbol files to receive symbolicated stack traces in App Center Diagnostics.
The relative path from the repo root to the symbols folder.
Input alias: pdbPath . string . Optional. Use when symbolsType = UWP . Default value:
**/*.pdb .
The relative path from the repo root to .pdb symbols files. Path may contain wildcards.
symbolsDsymFiles - dSYM path
The relative path from the repo root to the dSYM folder. Path may contain wildcards.
The relative path from the repo root to Android's mapping.txt file.
Uploads the selected symbols file or folder and all other items inside the same parent
folder. This is required for React Native apps.
The release notes will be attached to the release and shown to testers on the installation
page.
Selects a UTF-8 encoded text file which contains the release notes for this version.
The IDs of the distribution groups who will receive the build release.. Leave it empty to
use the default group.
Task control options
All tasks have control options in addition to their task inputs. For more information, see
Control options and common task properties.
Output variables
None.
Remarks
This task is deprecated. Use AppCenterDistribute@3.
Requirements
ノ Expand table
Requirement Description
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Feedback
Was this page helpful? Yes No
Syntax
YAML
Inputs
appFile - Binary application file path
Input alias: app . string . Required.
The relative path from the repo root to the APK or IPA file you want to test.
artifactsDirectory - Artifacts directory
Specifies where to place the artifacts produced by the prepare step and used by the run
step. This directory will be created if it does not already exist.
Input alias: framework . string . Required when enablePrepare = true . Allowed values:
appium , espresso , calabash , uitest (Xamarin UI Test), xcuitest . Default value: appium .
Input alias: appiumBuildDir . string . Required when enablePrepare = true && framework
= appium .
Input alias: espressoBuildDir . string . Optional. Use when enablePrepare = true &&
framework = espresso .
Input alias: espressoTestApkPath . string . Optional. Use when enablePrepare = true &&
framework = espresso .
The path to the APK file with the Espresso tests. If not set, build-dir is used to discover
it. A wildcard is allowed.
The profile to run. This value must exist in the Cucumber configuration file.
boolean . Optional. Use when enablePrepare = true && framework = calabash . Default
value: false .
When set to true , this input skips the configuration check specified by the Cucumber
profile.
Input alias: uitestBuildDir . string . Required when enablePrepare = true && framework
= uitest .
The path to the store file that is used to sign the app.
Input alias: uitestStorePass . string . Optional. Use when enablePrepare = true &&
framework = uitest .
The password of the store file that is used to sign the app. To encrypt this value, use a
new variable with its lock enabled on the Variables tab.
uitestKeyAlias - Key alias
Specifies the alias that identifies the public/private key pair that is used in the store file.
Input alias: uitestKeyPass . string . Optional. Use when enablePrepare = true &&
framework = uitest .
Specifies the key password for the alias and store file. To encrypt this value, use a new
variable with its lock enabled on the Variables tab.
Input alias: uitestToolsDir . string . Optional. Use when enablePrepare = true &&
framework = uitest .
The path to the directory with the Xamarin UI test tools that contain test-cloud.exe.
Input alias: xcuitestTestIpaPath . string . Optional. Use when enablePrepare = true &&
framework = xcuitest .
The additional arguments that are passed to the App Center test prepare step.
Input alias: credsType . string . Required when enableRun = true . Allowed values:
serviceEndpoint (App Center service connection), inputs (Credentials). Default value:
serviceEndpoint .
Uses the App Center service connection or enters the credentials to connect to Visual
Studio App Center.
Selects the service connection for Visual Studio App Center. If needed, click the Manage
link to create a new service connection.
Create your username by visiting the App Center sign in page , and provide the value
here.
Set your password by visiting the App Center sign in page , and provide the value
here. Variables defined in build or release pipelines as $(passwordVariable) are
accepted. You may mark the variable type as secret to secure it.
appSlug - App slug
string . Required when enableRun = true .
devices - Devices
string . Required when enableRun = true .
Identifies the devices this test will run against. Copy and paste this string when you
define a new test run from the Visual Studio App Center Test beacon.
The series name for organizing the test runs (for example: master, production, beta).
ja_JP (Japanese (Japan)), ru_RU (Russian (Russia)), es_MX (Spanish (Mexico)), es_ES
Utilize if your language isn't displayed. Select Other and enter its locale, such as en_US .
Enters any two-letter ISO-639 language code along with any two-letter ISO 3166
country code in the format <language>_<country> , such as en_US .
loginOptions - Additional options for login
Input alias: loginOpts . string . Optional. Use when enableRun = true && credsType =
inputs .
The additional arguments that are passed to the Visual Studio App Center login step.
The additional arguments that are passed to the Visual Studio App Center test run.
Input alias: async . boolean . Optional. Use when enableRun = true . Default value: false .
Executes a command asynchronously and exits when the tests are uploaded without
waiting for the test results.
The path to the Visual Studio App Center CLI on the build or release agent.
Output variables
None.
Remarks
This task lets you run test suites against an application binary (.apk or .ipa file) using
App Center Test.
Examples
This example runs Espresso tests on an Android app using the App Center Test task.
YAML
steps:
- task: AppCenterTest@1
displayName: 'Espresso Test - Synchronous'
inputs:
appFile: 'Espresso/espresso-app.apk'
artifactsDirectory: '$(Build.ArtifactStagingDirectory)/AppCenterTest'
frameworkOption: espresso
espressoBuildDirectory: Espresso
serverEndpoint: 'myAppCenterServiceConnection'
appSlug: 'xplatbg1/EspressoTests'
devices: a84c93af
Requirements
ノ Expand table
Requirement Description
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Feedback
Was this page helpful? Yes No
Archive files using compression formats such as .7z, .tar, .gz, and .zip.
Syntax
# Archive files v2
# Compress files into .7z, .tar.gz, or .zip.
- task: ArchiveFiles@2
inputs:
rootFolderOrFile: '$(Build.BinariesDirectory)' # string. Required. Root
folder or file to archive. Default: $(Build.BinariesDirectory).
#includeRootFolder: true # boolean. Prepend root folder name to archive
paths. Default: true.
# Archive
archiveType: 'zip' # 'zip' | '7z' | 'tar' | 'wim'. Required. Archive
type. Default: zip.
#sevenZipCompression: 'normal' # 'ultra' | 'maximum' | 'normal' | 'fast'
| 'fastest' | 'none'. Optional. Use when archiveType = 7z. 7z compression.
Default: normal.
#tarCompression: 'gz' # 'gz' | 'bz2' | 'xz' | 'none'. Optional. Use when
archiveType = tar. Tar compression. Default: gz.
archiveFile: '$(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip' #
string. Required. Archive file to create. Default:
$(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip.
#replaceExistingArchive: true # boolean. Replace existing archive.
Default: true.
#verbose: false # boolean. Force verbose output. Default: false.
#quiet: false # boolean. Force quiet output. Default: false.
Inputs
rootFolderOrFile - Root folder or file to archive
string . Required. Default value: $(Build.BinariesDirectory) .
Name of the root folder or the file path to files to add to the archive. For folders,
everything in the named folder is added to the archive.
For example, if the root folder is: /home/user/output/classes/ and the file path:
com/acme/Main.class . The resulting archive will contain: classes/com/acme/Main.class .
string . Required. Allowed values: zip , 7z , tar , wim . Default value: zip .
zip - Default. Choose this format for all zip compatible types such as .zip, .jar, .war,
.ear
7z - 7-Zip format, (.7z)
tar - tar format, use for compressed tars including .tar.gz, .tar.bz2, .tar.xz
wim - wim format, .wim
sevenZipCompression - 7z compression
string . Optional. Use when archiveType = 7z . Allowed values: ultra , maximum , normal ,
string . Optional. Use when archiveType = tar . Allowed values: gz , bz2 , xz , none .
Default value: gz .
$(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip .
Specify the name of the archive file to create. For example, to create foo.tgz :
zip
7z
wim
If set to true, forces tools to use verbose output. Overrides the 'quiet' setting.
If set to true , forces tools to use quiet output. The verbose setting (or equivalent) can
override this setting.
Remarks
Use this task to create an archive file from a source folder. Standard archive formats are
supported including .zip, .jar, .war, .ear, .tar, .7z, and more.
Requirements
ノ Expand table
Requirement Description
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Command This task runs using the following command restrictions: restricted
restrictions
Settable variables This task has permission to set the following variables: Setting variables is
disabled
Feedback
Was this page helpful? Yes No
Archive files using compression formats such as .7z, .rar, .tar.gz, and .zip.
Syntax
# Archive Files v1
# Archive files using compression formats such as .7z, .rar, .tar.gz, and
.zip.
- task: ArchiveFiles@1
inputs:
rootFolder: '$(Build.BinariesDirectory)' # string. Required. Root folder
(or file) to archive. Default: $(Build.BinariesDirectory).
#includeRootFolder: true # boolean. Prefix root folder name to archive
paths. Default: true.
# Archive
archiveType: 'default' # 'default' | '7z' | 'tar' | 'wim'. Required.
Archive type. Default: default.
#tarCompression: 'gz' # 'gz' | 'bz2' | 'xz' | 'none'. Optional. Use when
archiveType = tar. Tar compression. Default: gz.
archiveFile: '$(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip' #
string. Required. Archive file to create. Default:
$(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip.
#replaceExistingArchive: true # boolean. Replace existing archive.
Default: true.
Inputs
rootFolder - Root folder (or file) to archive
string . Required. Default value: $(Build.BinariesDirectory) .
Name of the root folder or file to archive. For folders, everything in the named folder is
added to the archive.
By default, prepends the root folder name to file paths within the archive. When set to
false , all file paths will start one level lower.
For example, if the root folder path is: /home/user/output/classes/ and the file path
com/acme/Main.class . The resulting archive will contain classes/com/acme/Main.class .
string . Required. Allowed values: default (zip), 7z , tar , wim . Default value: default .
Default value: gz .
$(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip .
Overwrites an existing archive. If not specified, files are added to the archive.
Task control options
All tasks have control options in addition to their task inputs. For more information, see
Control options and common task properties.
Output variables
None.
Remarks
There is a newer version of the Archive Files task available.
Archive Files v2
Requirements
ノ Expand table
Requirement Description
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
See also
Archive Files v2
Feedback
Was this page helpful? Yes No
Use this task to deploy an Azure Resource Manager (ARM) template to all deployment
scopes.
Syntax
# ARM template deployment v3
# Deploy an Azure Resource Manager (ARM) template to all the deployment
scopes.
- task: AzureResourceManagerTemplateDeployment@3
inputs:
# Azure Details
deploymentScope: 'Resource Group' # 'Management Group' | 'Subscription'
| 'Resource Group'. Required. Deployment scope. Default: Resource Group.
azureResourceManagerConnection: # string. Alias: ConnectedServiceName.
Required. Azure Resource Manager connection.
#subscriptionId: # string. Alias: subscriptionName. Required when
deploymentScope != Management Group. Subscription.
#action: 'Create Or Update Resource Group' # 'Create Or Update Resource
Group' | 'DeleteRG'. Required when deploymentScope = Resource Group. Action.
Default: Create Or Update Resource Group.
#resourceGroupName: # string. Required when deploymentScope = Resource
Group. Resource group.
#location: # string. Required when action = Create Or Update Resource
Group || deploymentScope != Resource Group. Location.
# Template
#templateLocation: 'Linked artifact' # 'Linked artifact' | 'URL of the
file'. Required when action = Create Or Update Resource Group ||
deploymentScope != Resource Group. Template location. Default: Linked
artifact.
#csmFileLink: # string. Required when templateLocation = URL of the file
&& action = Create Or Update Resource Group || deploymentScope != Resource
Group. Template link.
#csmParametersFileLink: # string. Optional. Use when templateLocation =
URL of the file && action = Create Or Update Resource Group ||
deploymentScope != Resource Group. Template parameters link.
#csmFile: # string. Required when templateLocation = Linked artifact &&
action = Create Or Update Resource Group || deploymentScope != Resource
Group. Template.
#csmParametersFile: # string. Optional. Use when templateLocation =
Linked artifact && action = Create Or Update Resource Group ||
deploymentScope != Resource Group. Template parameters.
#overrideParameters: # string. Optional. Use when action = Create Or
Update Resource Group || deploymentScope != Resource Group. Override
template parameters.
#deploymentMode: 'Incremental' # 'Incremental' | 'Complete' |
'Validation'. Required when action = Create Or Update Resource Group ||
deploymentScope != Resource Group. Deployment mode. Default: Incremental.
# Advanced
#deploymentName: # string. Optional. Use when action = Create Or Update
Resource Group || deploymentScope != Resource Group. Deployment name.
#deploymentOutputs: # string. Optional. Use when action = Create Or
Update Resource Group || deploymentScope != Resource Group. Deployment
outputs.
#addSpnToEnvironment: false # boolean. Optional. Use when action =
Create Or Update Resource Group || deploymentScope != Resource Group. Access
service principal details in override parameters. Default: false.
#useWithoutJSON: false # boolean. Optional. Use when action = Create Or
Update Resource Group || deploymentScope != Resource Group. Use individual
output values without JSON.Stringify applied. Default: false.
Inputs
deploymentScope - Deployment scope
string . Required. Allowed values: Management Group , Subscription , Resource Group .
Specifies the Azure Resource Manager service connection with access to the selected
deployment scope.
subscriptionId - Subscription
) Important
The specified value must be the subscription ID and not the subscription name.
action - Action
string . Required when deploymentScope = Resource Group . Allowed values: Create Or
Update Resource Group , DeleteRG (Delete resource group). Default value: Create Or
Update Resource Group .
location - Location
string . Required when action = Create Or Update Resource Group || deploymentScope
!= Resource Group .
Resource Group deployment scopes: The location to deploy the resource group. If the
resource group already exists in the Azure subscription, then this value will be ignored.
Other deployment scopes: The location to store deployment metadata.
!= Resource Group . Allowed values: Linked artifact , URL of the file . Default value:
Linked artifact .
The location of the Template and the Parameters JSON files. Choose Linked artifact if
the files are part of the linked code/build artifacts. For linked artifacts, you can also
specify the path to a Bicep file. Choose URL of the file if the JSON files are located at
any publicly accessible http/https URLs. To use a file stored in a private storage account,
retrieve and include the shared access signature (SAS) token in the URL of the template.
Example: <blob_storage_url>/template.json? . To upload a parameters file to a storage
account and generate a SAS token, you could use Azure file copy task or follow the
steps using PowerShell or Azure CLI.
string . Required when templateLocation = URL of the file && action = Create Or
simple-windows/azuredeploy.json
To deploy a template stored in a private storage account, retrieve and include the
shared access signature (SAS) token in the URL of the template. Example:
<blob_storage_url>/template.json?<SAStoken> . To upload a template file (or a linked
template) to a storage account and generate a SAS token, use the Azure file copy task or
follow the steps using PowerShell or Azure CLI .
To view the template parameters in a grid, click on ... next to the override template
parameters text box. This feature requires that CORS rules are enabled at the source. If
the templates are in an Azure storage blob, refer to Cross-Origin Resource Sharing to
enable CORS.
string . Optional. Use when templateLocation = URL of the file && action = Create Or
To use a file stored in a private storage account, retrieve and include the shared access
signature (SAS) token in the URL of the template. Example:
<blob_storage_url>/template.json?<SAStoken> . To upload a template file (or a linked
template) to a storage account and generate a SAS token, use the Azure file copy task or
follow the steps using PowerShell or Azure CLI .
To view the template parameters in a grid, click on ... next to Override template
parameters text box. This feature requires that CORS rules are enabled at the source. If
the templates are in an Azure storage blob, refer to Cross-Origin Resource Sharing to
enable CORS.
csmFile - Template
string . Required when templateLocation = Linked artifact && action = Create Or
Specifies the path or a pattern pointing to the Azure Resource Manager template. Learn
more about Azure Resource Manager templates . To get started immediately, use this
sample template . Supports Bicep files when the Azure CLI version > 2.20.0.
Specify the path or a pattern pointing for the parameters file for the Azure Resource
Manager template. Supports Bicep Param files when the Azure CLI version > 2.47.0.
To view the template parameters in a grid, click on ... next to the Override Parameters
textbox. This feature requires that CORS rules are enabled at the source. If the templates
are in the Azure storage blob, reference this string to enable CORS, or type the template
parameters to override in the textbox.
If the parameter value has multiple words, enclose the words in quotes, even if you're
passing the value by using variables. For example, -name "parameter value" -name2
"$(var)" . To override object type parameters, use stringified JSON objects. For example,
Complete mode deletes resources that are not in your template. Complete mode takes
relatively more time than incremental mode. If the task times out, consider increasing
the timeout or changing to the Incremental mode.
2 Warning
Complete mode will delete all the existing resources in the resource group that are
not specified in the template. Do review if the resource group you're deploying to
doesn't contain any necessary resources that are not specified in the template.
Validate mode enables you to find problems with the template before creating
actual resources.
7 Note
The Validate mode always creates a resource group, even if no resources are
deployed. Learn more about deployment modes.
Provides a name for the variable for the output variable, which contains the outputs
section of the current deployment object in string format. You can use the ConvertFrom-
Json PowerShell cmdlet to parse the JSON object and access the individual output
Adds the service principal ID and key of the Azure endpoint chosen to be the script's
execution environment. The variables $servicePrincipalId and $servicePrincipalKey
can be in override parameters, such as -key $servicePrincipalKey .
useWithoutJSON - Use individual output values without JSON.Stringify applied
Individual output values are being converted via JSON.Stringify by default. If you want to
use the output values as it is without converting them via JSON.Stringify, enable this
option. For more details refer to this .
Output variables
None.
Remarks
7 Note
This task supports Bicep files when the Azure CLI version > 2.20.0.
Requirements
ノ Expand table
Requirement Description
Demands None
Requirement Description
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Feedback
Was this page helpful? Yes No
This task creates or updates Azure App Service using Azure PowerShell.
Syntax
YAML
Inputs
ConnectedServiceName - Azure Subscription (Classic)
string . Required.
string . Required.
string . Required.
Specifies the website name or selects it from the list.
Note: Only the websites associated with the default app service plan for the selected
region are listed.
Slot - Slot
string .
string . Required.
The path to the Visual Studio Web Deploy package under the default artifact directory.
When set to true , additional files in the Web Deployment package are preserved while
publishing the website.
Output variables
None.
Requirements
ノ Expand table
Requirement Description
Runs on Agent
Demands Self-hosted agents must have capabilities that match the following demands
to run jobs that use this task: azureps
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Command Any
restrictions
Feedback
Was this page helpful? Yes No
Use this task to deploy to Azure App Service a web, mobile, or API app using Docker,
Java, .NET, .NET Core, Node.js, PHP, Python, or Ruby.
7 Note
Syntax
YAML
Inputs
ConnectionType - Connection type
Specify the service connection type to use to deploy the Web App.
Specify Publish Profile for using Visual Studio created Publish profiles .
It is recommended to store a password in a secret variable and use that variable here
e.g. $(Password) .
Choose from Web App On Windows, Web App On Linux, Web App for Containers,
Function App, Function App on Linux, Function App for Containers and Mobile App.
Specify the name of an existing Azure App Service. App services based on the selected
app type will only be listed when using the task assistant.
Specify the option to deploy to an existing deployment slot or Azure App Service
environment. For both targets, the task requires a Resource Group name. If the
deployment target is a slot, by default the deployment is to the Production slot. Any
other existing slot name can be provided. If the deployment target is an Azure App
Service environment, leave the slot name as Production and specify just the Resource
Group name.
The Resource group name is required when the deployment target is either a
deployment slot or an App Service Environment.
Specify the Azure Resource group that contains the Azure App Service specified above.
SlotName - Slot
string . Required when DeployToSlotOrASEFlag = true . Default value: production .
A globally unique top-level domain name for your specific registry or namespace. Note:
The fully qualified image name will be of the format: {registry or
namespace}/{repository}:{tag} . For example, myregistry.azurecr.io/nginx:latest .
DockerRepository - Image
string . Required when WebAppKind = webAppContainer || WebAppkind =
The name of the repository where the container images are stored. Note: The fully
qualified image name will be of the format: {registry or namespace}/{repository}:
{tag} . For example, myregistry.azurecr.io/nginx:latest .
DockerImageTag - Tag
Tags are the mechanism that registries use to apply version information to Docker
images. Note: The fully qualified image name will be of the format: {registry or
namespace}/{repository}:{tag} . For example, myregistry.azurecr.io/nginx:latest .
Specify the name of the Virtual Application that has been configured in the Azure portal.
This option is not required for deployments to the website root. The Virtual Application
must have been configured before deployment of the web project.
The file path to the package, or to a folder containing app service contents generated by
MSBuild or a compressed zip or war file.
Specify the framework and version. Refer to the Azure Functions runtime versions
overview for supported runtime versions. Old values like DOCKER|microsoft/azure-
functions-* are deprecated. Please use the new values from dropdown.
= webAppHyperVContainer .
dotnet filename.dll .
ScriptType - Deployment script type
string . Optional. Use when ConnectionType = AzureRM && WebAppKind != "" &&
Customizes the deployment by providing a script that runs on the Azure App Service
after successful deployment. Choose inline deployment script or the path and name of a
script file. Learn more about Azure App Service Deployment .
string . Required when ScriptType == Inline Script && ConnectionType = AzureRM &&
can provide your deployment commands here. One command per line. .
The script to execute. You can provide your deployment commands here, one command
per line. See the following example.
string . Required when ScriptType == File Path && ConnectionType = AzureRM &&
WebAppKind != "" && WebAppKind != webAppContainer && WebAppKind !=
Java apps
string . Optional. Use when WebAppKind != webAppContainer && WebAppKind !=
webAppHyperVContainer && WebAppkind != functionAppContainer && WebAppKind !=
A standard Web.config will be generated and deployed to Azure App Service if the
application does not have one. The values in web.config can be edited and vary based
on the application framework. For example, for node.js applications, web.config will
have a Startup file and iis_node module values. This edit feature is only for the
generated web.config . Learn more about Azure App Service Deployment .
AppSettings - App settings
string . Optional. Use when ConnectionType = AzureRM .
Edits web app application settings using the syntax -key value . Values containing
spaces must be enclosed in double quotes. Examples: -Port 5000 -RequestTimeout 5000
and -WEBSITE_TIME_ZONE "Eastern Standard Time" . To provide two or more key values,
the key values must be separated by a space. Example: -key1 "Value1" -Key2 "Value2" .
Edits web app configuration settings using the syntax -key value . Values containing
spaces must be enclosed in double quotes. Example: -phpVersion 5.6 -linuxFxVersion
node|6.11 .
Input alias: UseWebDeploy . boolean . Optional. Use when ConnectionType = AzureRM &&
WebAppKind != webAppLinux && WebAppKind != webAppContainer && WebAppKind !=
webAppHyperVContainer && WebAppkind != functionAppContainer && webAppKind !=
functionAppLinux && WebAppKind != "" && Package NotEndsWith .war && Package
NotEndsWith .jar . Default value: false .
If unchecked or false, the task auto-detects the best deployment method based on the
app type, package format, and other parameters. Check this option in the task assistant
to view the supported deployment methods, and choose one for deploying your app.
functionAppLinux && WebAppKind != "" && Package NotEndsWith .war && Package
NotEndsWith .jar . Allowed values: webDeploy (Web Deploy), zipDeploy (Zip Deploy),
Package NotEndsWith .war && Package NotEndsWith .jar . Default value: true .
Specify this option to take the Azure App Service offline by placing an app_offline.htm
file in the root directory before the synchronization operation begins. The file will be
removed after the synchronization completes successfully.
boolean . Optional. Use when UseWebDeploy == true && DeploymentType == webDeploy &&
Specify 'true' to delete files on the Azure App Service that have no matching files in the
App Service package or folder. This will also remove all files related to any extension
installed on this Azure App Service. To prevent this, select the Exclude files from
App_Data folder checkbox.
Package NotEndsWith .war && Package NotEndsWith .jar . Default value: true .
Specify the option to prevent files in the App_Data folder from being deployed
to/deleted from the Azure App Service.
string . Optional. Use when UseWebDeploy == true && DeploymentType == webDeploy &&
-retryInterval:10000 .
Additional Web Deploy arguments following the syntax -key:value . These will be
applied when deploying the Azure App Service. Examples: -
disableLink:AppPoolExtension -disableLink:ContentExtension . Learn more about Web
Package NotEndsWith .war && Package NotEndsWith .jar . Default value: true .
Variables defined in the build or release pipeline will be matched against the key or
name entries in the configSections , appSettings , applicationSettings , and
connectionStrings sections of any configuration file and parameters.xml file. Variable
If the same variables are defined in the release pipeline and in the stage, the stage
variables will supersede the release pipeline variables. Learn more about [XML variable
substitution]](/azure/devops/pipelines/tasks/transforms-variable-substitution#xml-
variable-substitution).
Provides a newline-separated list of JSON files to substitute the variable values. File
names must be relative to the root folder. To substitute JSON variables that are nested
or hierarchical, specify them using JSONPath expressions. For example, to replace the
value of ConnectionString in the sample below, define a variable named
Data.DefaultConnection.ConnectionString in the build or release pipeline (or release
pipelines stage).
JSON
{
"Data": {
"DefaultConnection": {
"ConnectionString": "Server=
(localdb)\SQLEXPRESS;Database=MyDB;Trusted_Connection=True"
}
}
}
A variable substitution runs after configuration transformations. Note: Build and release
pipeline variables are excluded from substitution. Learn more about JSON variable
substitution.
Task control options
All tasks have control options in addition to their task inputs. For more information, see
Control options and common task properties.
Output variables
This task defines the following output variables, which you can consume in downstream
steps, jobs, and stages.
AppServiceApplicationUrl
Remarks
Prerequisites for the task
Usage notes
Deployment methods
Troubleshooting
FAQs
Use this task to deploy to a range of App Services on Azure. The task works on cross-
platform agents running Windows, Linux, or Mac and uses several different underlying
deployment technologies.
The task works for ASP.NET, ASP.NET Core, PHP, Java, Python, Go, and Node.js based
web applications.
The task can be used to deploy to a range of Azure App Services such as:
App Service instance. The task is used to deploy a Web App project or Azure
Function project to an existing Azure App Service instance, which must exist before
the task runs. The App Service instance can be created from the Azure portal and
configured there. Alternatively, the Azure PowerShell task can be used to run
AzureRM PowerShell scripts to provision and configure the Web App.
Usage notes
The task works with the Azure Resource Manager APIs only.
To ignore SSL errors, define a variable named VSTS_ARM_REST_IGNORE_SSL_ERRORS
with value true in the the pipeline. If you are deploying to a slot configured to
auto-swap, the swap will fail unless you set SCM_SKIP_SSL_VALIDATION or
SCM_SKIP_ASE_SSL_VALIDATION to 1 in the app services configuration settings.
For .NET apps targeting Web App on Windows, avoid deployment failure with the
error ERROR_FILE_IN_USE by ensuring that Rename locked files and Take App
Offline settings are enabled. For zero downtime deployment, use the slot swap
option.
When deploying to an App Service that has Application Insights configured, and
you have enabled Remove additional files at destination, ensure you also enable
Exclude files from the App_Data folder in order to maintain the Application
insights extension in a safe state. This is required because the Application Insights
continuous web job is installed into the App_Data folder.
Deployment methods
Several deployment methods are available in this task. Web Deploy (msdeploy.exe) is
the default. To change the deployment option, expand Additional Deployment Options
and enable Select deployment method to choose from additional package-based
deployment options.
Based on the type of Azure App Service and agent, the task chooses a suitable
deployment technology. The different deployment technologies used by the task are:
Web Deploy
Kudu REST APIs
Container Registry
Zip Deploy
Run From Package
War Deploy
By default, the task tries to select the appropriate deployment technology based on the
input package type, App Service type, and agent operating system.
ノ Expand table
On non-Windows agents (for any App Service type), the task relies on Kudu REST APIs to
deploy the app.
Web Deploy
Web Deploy (msdeploy.exe) can be used to deploy a Web App on Windows or a
Function App to the Azure App Service using a Windows agent. Web Deploy is feature-
rich and offers options such as:
Rename locked files: Rename any file that is still in use by the web server by
enabling the msdeploy flag MSDEPLOY\_RENAME\_LOCKED\_FILES=1 in the Azure App
Service settings. This option, if set, enables msdeploy to rename files that are
locked during app deployment.
Remove additional files at destination: Deletes files in the Azure App Service that
have no matching files in the App Service artifact package or folder being
deployed.
Exclude files from the App_Data folder: Prevent files in the App_Data folder (in
the artifact package/folder being deployed) being deployed to the Azure App
Service
Install Web Deploy on the agent from Web Deploy 3.6 . Web Deploy 3.5 must be
installed without the bundled SQL support. There is no need to choose any custom
settings when installing Web Deploy. Web Deploy is installed at C:/Program Files
(x86)/IIS/Microsoft Web Deploy V3 .
Container Registry
Works on both Windows and Linux automation agents when the target is a Web App for
Containers. The task updates the app by setting the appropriate container registry,
repository, image name, and tag information. You can also use the task to pass a startup
command for the container image.
Zip Deploy
Expects a .zip deployment package and deploys the file contents to the wwwroot folder
of the App Service or Function App in Azure. This option overwrites all existing contents
in the wwwroot folder. For more information, see Zip deployment for Azure Functions.
War Deploy
Expects a .war deployment package and deploys the file content to the wwwroot folder
or webapps folder of the App Service in Azure.
Troubleshooting
The Azure App Service deploy task supports connecting to Microsoft Azure with an ARM
service connection using Microsoft Entra ID, unless the following three conditions are
present:
If these three conditions are present, you will receive an error like App Service is
configured to not use basic authentication. This requires Web Deploy msdeploy.exe
version 7.1.7225.2108 or higher. You need a version of Visual Studio that includes
an updated version of msdeploy.exe. For more information, visit
https://aka.ms/azdo-webapp-msdeploy.
To resolve this issue, you can choose from the following options, in order of preference.
1. Update the agent image. If you are using hosted agents, move from windows-2019
to windows-2022 (or windows-latest). If you are using self-hosted agents, install
Visual Studio 2022 on the agent to get a newer version of msdeploy.exe.
2. If you are dependent on an older agent image and can't update the agent for your
pipeline, consider splitting the job so that the Azure App Service deploy task runs
on windows-2022 (or windows-latest).
3. If neither of these options is possible, you can enable basic authentication for your
Azure App Service.
Error: Could not fetch access token for Azure. Verify if the
Service Principal used is valid and not expired.
The task uses the service principal in the service connection to authenticate with Azure.
If the service principal has expired or doesn't have permissions to the App Service, the
task fails with this error. Verify the validity of the service principal used and that it's
present in the app registration. For more information, see Use role-based access control
to manage access to your Azure subscription resources. This blog post also contains
more information about using service principal authentication.
SSL error
If you want to use a certificate in App Service, the certificate must be signed by a trusted
certificate authority. If your web app gives you certificate validation errors, you're
probably using a self-signed certificate. Set a variable named
VSTS_ARM_REST_IGNORE_SSL_ERRORS to the value true in the build or release pipeline to
/p:publishUrl="$(System.DefaultWorkingDirectory)\\WebAppContent" :
b. Clear the Prepend root folder name to archive paths check box:
This may be because web.config is not present in your app. You can either add a
web.config file to your source or auto-generate one using the File Transforms and
Variable Substitution Options of the task.
Click on the task and go to Generate web.config parameters for Python, Node.js,
Go and Java apps.
Click on the more button Generate web.config parameters for Python, Node.js, Go
and Java apps to edit the parameters.
Select your application type from the drop down.
7 Note
This section is deprecated and has been replaced with the File Transform task.
ERROR_FILE_IN_USE
When deploying .NET apps to Web App on Windows, deployment may fail with error
code ERROR_FILE_IN_USE. To resolve the error, ensure Rename locked files and Take App
Offline options are enabled in the task. For zero downtime deployments, use slot swap.
You can also use Run From Package deployment method to avoid resource locking.
FAQs
The Azure Web App task ( AzureWebApp ) is the simplest way to deploy to an Azure Web
App. By default, your deployment happens to the root application in the Azure Web
App.
The Azure App Service Deploy task (AzureRmWebAppDeployment) can handle more
custom scenarios, such as:
Modify configuration settings inside web packages and XML parameters files.
Deploy with Web Deploy, if you're used to the IIS deployment process.
Deploy to virtual applications.
Deploy to other app types, like Container apps, Function apps, WebJobs, or API
and Mobile apps.
7 Note
File transforms and variable substitution are also supported by the separate File
Transform task for use in Azure Pipelines. You can use the File Transform task to
apply file transformations and variable substitutions on any configuration and
parameters files.
Examples
Deploy to specific app type
Deploy to Azure Web App Linux container
Deploy a web app to a Windows App Service across deployment slots
Sample Post deployment script
Containers - Linux), apiApp (API App), mobileApp (Mobile App). If not mentioned, webApp
is taken as the default value.
yml
pool:
vmImage: ubuntu-latest
variables:
azureSubscriptionEndpoint: Contoso
DockerNamespace: contoso.azurecr.io
DockerRepository: aspnetcore
WebAppName: containersdemoapp
steps:
- task: AzureRMWebAppDeployment@4
displayName: Azure App Service Deploy
inputs:
appType: webAppContainer
ConnectedServiceName: $(azureSubscriptionEndpoint)
WebAppName: $(WebAppName)
DockerNamespace: $(DockerNamespace)
DockerRepository: $(DockerRepository)
DockerImageTag: $(Build.BuildId)
yml
pool:
vmImage: 'windows-latest'
variables:
solution: '**/*.sln'
buildPlatform: 'Any CPU'
buildConfiguration: 'Release'
stages:
- stage: DeployDevStage
displayName: 'Deploy App to Dev Slot'
jobs:
- job: DeployApp
displayName: 'Deploy App'
steps:
- task: DownloadPipelineArtifact@2
inputs:
buildType: 'current'
artifactName: 'drop'
targetPath: '$(System.DefaultWorkingDirectory)'
- task: AzureRmWebAppDeployment@4
inputs:
ConnectionType: 'AzureRM'
azureSubscription: 'Fabrikam Azure Subscription -
PartsUnlimited'
appType: 'webApp'
WebAppName: 'partsunlimited'
deployToSlotOrASE: true
ResourceGroupName: 'rgPartsUnlimited'
SlotName: 'Dev'
packageForLinux: '$(System.DefaultWorkingDirectory)/**/*.zip'
- stage: DeployStagingStage
displayName: 'Deploy App to Staging Slot'
dependsOn: DeployDevStage
jobs:
- job: DeployApp
displayName: 'Deploy App'
steps:
- task: DownloadPipelineArtifact@2
inputs:
buildType: 'current'
artifactName: 'drop'
targetPath: '$(System.DefaultWorkingDirectory)'
- task: AzureRmWebAppDeployment@4
inputs:
appType: webApp
ConnectionType: AzureRM
ConnectedServiceName: 'Fabrikam Azure Subscription -
PartsUnlimited'
ResourceGroupName: 'rgPartsUnlimited'
WebAppName: 'partsunlimited'
Package: '$(System.DefaultWorkingDirectory)/**/*.zip'
deployToSlotOrASE: true
SlotName: 'staging'
This is very useful when you want to restore your application dependencies directly on
the App Service. Restoring packages for Node, PHP, and python apps helps to avoid
timeouts when the application dependency results in a large artifact being copied over
from the agent to the Azure App Service.
@echo off
if NOT exist requirements.txt (
echo No Requirements.txt found.
EXIT /b 0
)
if NOT exist "$(PYTHON_EXT)/python.exe" (
echo Python extension not available >&2
EXIT /b 1
)
echo Installing dependencies
call "$(PYTHON_EXT)/python.exe" -m pip install -U setuptools
if %errorlevel% NEQ 0 (
echo Failed to install setuptools >&2
EXIT /b 1
)
call "$(PYTHON_EXT)/python.exe" -m pip install -r requirements.txt
if %errorlevel% NEQ 0 (
echo Failed to install dependencies>&2
EXIT /b 1
)
Requirements
ノ Expand table
Requirement Description
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
See also
This task is open source on GitHub . Feedback and contributions are welcome.
Feedback
Was this page helpful? Yes No
Use this task to deploy to Azure App Service a web, mobile, or API app using Docker,
Java, .NET, .NET Core, Node.js, PHP, Python, or Ruby.
7 Note
Syntax
YAML
Inputs
azureSubscription - Azure subscription
Input alias: WebAppKind . string . Required. Allowed values: app (Web App), applinux
(Linux Web App), functionapp (Function App (Not Recommended, Use Azure Functions
Task)), api (API App), mobileapp (Mobile App). Default value: app .
Note: Specify Linux Web App for built-in platform images or custom container image
deployments.
WebAppName - App Service name
string . Required.
Specify the name of an existing Azure App Service. App services based on the selected
app type will only be listed when using the task assistant.
Use this option to deploy to an existing slot other than the Production slot. If this option
is not selected, then the Azure App Service will be deployed to the Production slot.
Specify the Azure Resource group that contains the Azure App Service specified above.
SlotName - Slot
values: Registry (Container Registry), Builtin (Built-in Image). Default value: Registry .
App Service on Linux offers two different options to publish your application:
AzureContainerRegistry - Registry
string . Required when ImageSource = AzureContainerRegistry .
Note: A fully qualified image name will be of the format: <registry> / <repository> :
<tag> . For example, myregistry.azurecr.io / nginx:latest .
AzureContainerRegistryLoginServer - Registry Login Server Name
string . Optional. Use when ImageSource = invalidimagesource .
AzureContainerRegistryImage - Image
The name of the repository where the container images are stored.
Note: A fully qualified image name will be of the format: <registry> / <repository> :
<tag> . For example, myregistry.azurecr.io / nginx : latest .
AzureContainerRegistryTag - Tag
string . Optional. Use when ImageSource = AzureContainerRegistry .
This is the mechanism that registries use to give Docker images a version.
Note: A fully qualified image name will be of the format: <registry> / <repository> :
<tag> . For example, myregistry.azurecr.io / nginx : latest .
PrivateRegistryImage - Image
The name of the repository where the container images are stored.
Note: A fully qualified image name will be of the format: <registry> <repository> :
<tag> . For example, myregistry.azurecr.io / nginx : latest .
PrivateRegistryTag - Tag
Tags are the mechanism that registries use to give Docker images a version.
Note: A fully qualified image name will be of the format: ' <registry> / <repository> :
<tag> '. For example, myregistry.azurecr.io / nginx : latest .
string . Required when WebAppKind != app && WebAppKind != functionapp && WebAppKind
!= api && WebAppKind != mobileapp && ImageSource = Registry .
A globally unique top-level domain name for your specific registry or namespace.
DockerRepository - Image
string . Required when WebAppKind != app && WebAppKind != functionapp && WebAppKind
!= api && WebAppKind != mobileapp && ImageSource = Registry .
The name of the repository where the container images are stored.
Note: A fully qualified image name will be of the format: ' <registry or
namespace> / <repository> : <tag> . For example, myregistry.azurecr.io / nginx : latest .
DockerImageTag - Tag
string . Optional. Use when WebAppKind != app && WebAppKind != functionapp &&
WebAppKind != api && WebAppKind != mobileapp && ImageSource = Registry .
This is the mechanism that registries use to give Docker images a version.
Note: A fully qualified image name will be of the format: ' <registry or
namespace> / <repository> : <tag> '. For example, myregistry.azurecr.io / nginx : latest .
VirtualApplication - Virtual application
string . Optional. Use when WebAppKind != linux && WebAppKind != applinux &&
WebAppKind != "" .
Specify the name of the Virtual Application that has been configured in the Azure portal.
The option is not required for deployments to the App Service root.
string . Required when WebAppKind != linux && WebAppKind != applinux && WebAppKind
!= "" . Default value: $(System.DefaultWorkingDirectory)/**/*.zip .
The file path to the package or a folder containing app service contents generated by
MSBuild or a compressed zip or war file.
The file path to the package or a folder containing app service contents generated by
MSBuild or a compressed zip or war file.
string . Required when WebAppKind != app && WebAppKind != functionapp && WebAppKind
Specify a name for the output variable that is generated for the URL of the Azure App
Service. The variable can be used in subsequent tasks.
Customizes the deployment by providing a script that will run on the Azure App service
once the task has completed the deployment successfully . For example, this can restore
packages for Node, PHP, and Python applications. Learn more about Azure App Service
Deployment .
value: :: You can provide your deployment commands here. One command per line. .
A standard Web.config will be generated and deployed to Azure App Service if the
application does not have one. The values in web.config can be edited and vary based
on the application framework. For example, for the node.js application, web.config will
have startup file and iis_node module values. Learn more about Azure App Service
Deployment .
Edits values like startup files in the generated web.config file. This edit feature is only for
the generated web.config . Learn more about Azure App Service Deployment .
string .
Edits web app application settings following the syntax -key value . Values containing
spaces should be enclosed in double quotes. Examples: -Port 5000 -RequestTimeout
5000 -WEBSITE_TIME_ZONE "Eastern Standard Time" .
Edits web app configuration settings following the syntax -key value. Values containing
spaces should be enclosed in double quotes.
boolean . Optional. Use when WebAppKind != linux && WebAppKind != applinux &&
WebAppKind != "" . Default value: false .
Use this option to take the Azure App Service offline by placing an app_offline.htm file
in the root directory of the App Service before the sync operation begins. The file will be
removed after the sync operation completes successfully.
boolean . Optional. Use when WebAppKind != linux && WebAppKind != applinux &&
WebAppKind != "" . Default value: false .
Publish using Web Deploy options are supported only when using Windows agent. On
other platforms, the task relies on Kudu REST APIs to deploy the Azure App Service,
and following options are not supported.
string . Optional. Use when UseWebDeploy == true && WebAppKind != linux &&
WebAppKind != applinux && WebAppKind != "" .
boolean . Optional. Use when UseWebDeploy == true && WebAppKind != linux &&
Use this option to delete files on the Azure App Service that have no matching files in
the App Service package or folder.
Note: This will also remove all files related to any extension installed on this Azure App
Service. To prevent this, select the Exclude files from App_Data folder checkbox.
boolean . Optional. Use when UseWebDeploy == true && WebAppKind != linux &&
WebAppKind != applinux && WebAppKind != "" . Default value: false .
Use this option to prevent files in the App_Data folder from being deployed to/deleted
from the Azure App Service.
These will be applied when deploying the Azure App Service. Examples: -
disableLink:AppPoolExtension -disableLink:ContentExtension .
boolean . Optional. Use when UseWebDeploy == true && WebAppKind != linux &&
Input alias: XmlTransformation . boolean . Optional. Use when WebAppKind != linux &&
WebAppKind != applinux && WebAppKind != "" && Package NotEndsWith .war . Default
value: false .
value: false .
Variables defined in the build or release pipeline will be matched against the key or
name entries in the appSettings , applicationSettings , and connectionStrings sections
of any config file and parameters.xml . Variable Substitution is run after config
transforms.
Note: If the same variables are defined in the release pipeline and in the environment,
then the environment variables will supersede the release pipeline variables.
string . Optional. Use when WebAppKind != linux && WebAppKind != applinux &&
WebAppKind != "" && Package NotEndsWith .war .
Provides a new lines-separated list of JSON files to substitute the variable values. Files
names are to be provided relative to the root folder.
To substitute JSON variables that are nested or hierarchical, specify them using JSONPath
expressions.
For example, to replace the value of ConnectionString in the sample below, you need to
define a variable as Data.DefaultConnection.ConnectionString in the build/release
pipeline (or the release pipeline’s environment).
JSON
{
"Data": {
"DefaultConnection": {
"ConnectionString": "Server=
(localdb)\SQLEXPRESS;Database=MyDB;Trusted_Connection=True"
}
}
}
Output variables
None.
Remarks
There is a newer version of this task available. For more information, see
AzureRmWebAppDeployment@4.
Troubleshooting
If these three conditions are present, you will receive an error like App Service is
configured to not use basic authentication. This requires Web Deploy msdeploy.exe
version 7.1.7225.2108 or higher. You need a version of Visual Studio that includes
https://aka.ms/azdo-webapp-msdeploy.
To resolve this issue, you can choose from the following options, in order of preference.
1. Update the agent image. If you are using hosted agents, move from windows-2019
to windows-2022 (or windows-latest). If you are using self-hosted agents, install
Visual Studio 2022 on the agent to get a newer version of msdeploy.exe.
2. If you are dependent on an older agent image and can't update the agent for your
pipeline, consider splitting the job so that the Azure App Service deploy task runs
on windows-2022 (or windows-latest).
3. If neither of these options is possible, you can enable basic authentication for your
Azure App Service.
Requirements
ノ Expand table
Requirement Description
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Feedback
Was this page helpful? Yes No
Use this task to update Azure App Service using Web Deploy/Kudu REST APIs .
Syntax
# Azure App Service deploy v2
# Update Azure App Service using Web Deploy / Kudu REST APIs.
- task: AzureRmWebAppDeployment@2
inputs:
ConnectedServiceName: # string. Required. Azure Subscription.
WebAppName: # string. Required. App Service name.
#DeployToSlotFlag: false # boolean. Deploy to slot. Default: false.
#ResourceGroupName: # string. Required when DeployToSlotFlag = true.
Resource group.
#SlotName: # string. Required when DeployToSlotFlag = true. Slot.
#VirtualApplication: # string. Virtual Application.
Package: '$(System.DefaultWorkingDirectory)/**/*.zip' # string.
Required. Package or Folder. Default:
$(System.DefaultWorkingDirectory)/**/*.zip.
# Output
#WebAppUri: # string. App Service URL.
# Additional Deployment Options
#UseWebDeploy: true # boolean. Publish using Web Deploy. Default: true.
#SetParametersFile: # string. Optional. Use when UseWebDeploy == true.
SetParameters File.
#RemoveAdditionalFilesFlag: false # boolean. Optional. Use when
UseWebDeploy == true. Remove Additional Files at Destination. Default:
false.
#ExcludeFilesFromAppDataFlag: false # boolean. Optional. Use when
UseWebDeploy == true. Exclude Files from the App_Data Folder. Default:
false.
#AdditionalArguments: # string. Optional. Use when UseWebDeploy == true.
Additional Arguments.
#TakeAppOfflineFlag: false # boolean. Take App Offline. Default: false.
Inputs
ConnectedServiceName - Azure Subscription
string . Required.
string . Required.
Use this option to deploy to an existing slot other than the Production slot.
Specify the Azure Resource group that contains the Azure App Service specified above.
SlotName - Slot
Specify the name of the Virtual Application that has been configured in the Azure portal.
The option is not required for deployments to the App Service root.
The folder or file path to the App Service package or folder. Variables include Build and
Release. Wildcards are supported.
string .
Specify a name for the output variable that is generated for the URL of the App Service.
The variable can be used in subsequent tasks.
Publish using web deploy options are supported only when using a Windows agent. On
other platforms, the task relies on Kudu REST APIs to deploy the App Service, and the
following options are not supported.
Use this option to delete files on the Azure App Service that have no matching files in
the App Service package or folder.
Exclude files in the App_Data folder from being deployed to the Azure App Service.
These will be applied when deploying the Azure App Service. Example: -
disableLink:AppPoolExtension -disableLink:ContentExtension .
Output variables
None.
Requirements
ノ Expand table
Requirement Description
Runs on Agent
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Feedback
Was this page helpful? Yes No
Start, stop, restart, slot swap, slot delete, install site extensions, or enable continuous
monitoring for an Azure App Service.
Syntax
# Azure App Service manage v0
# Start, stop, restart, slot swap, slot delete, install site extensions or
enable continuous monitoring for an Azure App Service.
- task: AzureAppServiceManage@0
inputs:
azureSubscription: # string. Alias: ConnectedServiceName. Required.
Azure subscription.
#Action: 'Swap Slots' # 'Swap Slots' | 'Start Azure App Service' | 'Stop
Azure App Service' | 'Restart Azure App Service' | 'Start Swap With Preview'
| 'Complete Swap' | 'Cancel Swap' | 'Delete Slot' | 'Install Extensions' |
'Enable Continuous Monitoring' | 'Start all continuous webjobs' | 'Stop all
continuous webjobs'. Action. Default: Swap Slots.
WebAppName: # string. Required. App Service name.
#SpecifySlotOrASE: false # boolean. Alias: SpecifySlot. Optional. Use
when Action != Swap Slots && Action != Delete Slot && Action != Start Swap
With Preview && Action != Complete Swap && Action != Cancel Swap. Specify
Slot or App Service Environment. Default: false.
#ResourceGroupName: # string. Required when Action = Swap Slots ||
Action = Delete Slot || SpecifySlot = true || Action = Start Swap With
Preview || Action = Complete Swap || Action = Cancel Swap. Resource group.
#SourceSlot: # string. Required when Action = Swap Slots || Action =
Start Swap With Preview || Action = Complete Swap. Source Slot.
#SwapWithProduction: true # boolean. Optional. Use when Action = Swap
Slots || Action = Start Swap With Preview || Action = Complete Swap. Swap
with Production. Default: true.
#TargetSlot: # string. Required when SwapWithProduction = false. Target
Slot.
#PreserveVnet: false # boolean. Optional. Use when Action = Swap Slots
|| Action = Start Swap With Preview || Action = Complete Swap. Preserve
Vnet. Default: false.
#Slot: 'production' # string. Required when Action = Delete Slot ||
Action = Cancel Swap || SpecifySlot = true. Slot. Default: production.
#ExtensionsList: # string. Required when Action = Install Extensions.
Install Extensions.
#OutputVariable: # string. Optional. Use when Action = Install
Extensions. Output variable.
#AppInsightsResourceGroupName: # string. Required when Action == Enable
Continuous Monitoring. Resource Group name for Application Insights.
#ApplicationInsightsResourceName: # string. Required when Action ==
Enable Continuous Monitoring. Application Insights resource name.
# Advanced Settings
#ApplicationInsightsWebTestName: # string. Optional. Use when Action ==
Enable Continuous Monitoring. Application Insights web test name.
Inputs
azureSubscription - Azure subscription
Action - Action
string . Allowed values: Swap Slots , Start Azure App Service (Start App Service), Stop
Azure App Service (Stop App Service), Restart Azure App Service (Restart App Service),
Start Swap With Preview , Complete Swap (Complete Swap With Preview), Cancel Swap
(Cancel Swap With Preview), Delete Slot , Install Extensions , Enable Continuous
Monitoring , Start all continuous webjobs , Stop all continuous webjobs . Default value:
Swap Slots .
Optional. Defines the action to perform on the App Service. You can start, stop, restart,
slot swap, start swap with a preview, complete swap with a preview, cancel swap with a
preview, install site extensions, or enable continuous monitoring for an Azure App
Service.
Input alias: SpecifySlot . boolean . Optional. Use when Action != Swap Slots && Action
!= Delete Slot && Action != Start Swap With Preview && Action != Complete Swap &&
string . Required when Action = Swap Slots || Action = Delete Slot || SpecifySlot =
true || Action = Start Swap With Preview || Action = Complete Swap || Action =
Cancel Swap .
Enters or selects the Azure Resource Group that contains the Azure App Service
specified above.
Used as source slot when action == Swap Slots . The swap action directs destination
slot's traffic to the source slot.
boolean . Optional. Use when Action = Swap Slots || Action = Start Swap With Preview
|| Action = Complete Swap . Default value: true .
Swaps the traffic of the source slot with production. If you don't select this option, then
you need to provide the source and target slot names.
Use as the destination slot when action == Swap Slots . The swap action directs the
destination slot's traffic to the source slot.
Slot - Slot
string . Required when Action = Delete Slot || Action = Cancel Swap || SpecifySlot
Site extensions run on Microsoft Azure App Service. You can install a set of tools as a
site extension and better manage your Azure App Service. Restart the App Service so the
latest changes take effect.
Provides the variable name for the selected extension's local installation path.
subsequent tasks.
Enters or selects the resource group where your Application Insights resource is
available.
Selects the Application Insights resource where continuous monitoring data is recorded.
If your Application Insights resource is not listed here and you want to create a new
resource, select +New. Once you create the resource in the Azure portal, come back
here and select Refresh.
Optional. Enters the Application Insights web test name you want to create or update.
If you don't provide a web test name, the default test name is used.
Output variables
This task defines the following output variables, which you can consume in downstream
steps, jobs, and stages.
LocalPathsForInstalledExtensions
This input is the local installation paths for the extensions you select.
If you select multiple extensions, the output is a comma-separated list of local paths for
each of the extensions you select. The output lists the paths in the order they appear in
the Install Extensions field.
Remarks
Use this task to start, stop, restart, slot swap, Swap with Preview, install site extensions,
or enable continuous monitoring for an Azure App Service.
Also at any point of the swap (or swap with preview) operation, all work of initializing
the swapped apps happens on the source slot. The target slot remains online while the
source slot is being prepared and warmed up, regardless of where the swap succeeds or
fails.
For more information, see Set up staging environments in Azure App Service.
Requirements
ノ Expand table
Requirement Description
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Feedback
Was this page helpful? Yes No
Updates or adds app service settings in an Azure Web App for Linux or Windows.
Syntax
YAML
Inputs
azureSubscription - Azure subscription
string . Required.
slotName - Slot
Enters or selects an existing slot. If you don't select a slot, changes are made to
production.
string .
Application settings in JSON syntax. Enclose values containing spaces in double quotes.
For more information, see Configure app settings.
JSON
[
{
"name": "key1",
"value": "valueabcd",
"slotSetting": false
},
{
"name": "key2",
"value": "valueefgh",
"slotSetting": true
}
]
General settings in JSON syntax. Enclose values containing spaces in double quotes. For
a list of the available properties, see the App Service SiteConfig object documentation.
For more information, see Configure general settings.
JSON
[
{
"alwaysOn": true,
"webSocketsEnabled": false
}
]
string .
Connection strings in JSON syntax. Enclose values containing spaces in double quotes.
For more information, see Configure connection strings.
JSON
[
{
"name": "key1",
"value": "valueabcd",
"type": "MySql",
"slotSetting": false
},
{
"name": "key2",
"value": "valueefgh",
"type": "Custom",
"slotSetting": true
}
]
Output variables
None.
Remarks
Use this task to configure App settings, connection strings and other general settings in
bulk using JSON syntax on your web app or any of its deployment slots. The task works
on cross platform Azure Pipelines agents running Windows, Linux or Mac. The task
works for ASP.NET, ASP.NET Core, PHP, Java, Python, Go and Node.js based web
applications.
Examples
The following example YAML snippet deploys a web application to an Azure Web App
service running on windows.
YAML
variables:
azureSubscription: Contoso
WebApp_Name: sampleWebApp
# To ignore SSL error uncomment the below variable
# VSTS_ARM_REST_IGNORE_SSL_ERRORS: true
steps:
- task: AzureWebApp@1
displayName: Azure Web App Deploy
inputs:
azureSubscription: $(azureSubscription)
appName: $(WebApp_Name)
package: $(System.DefaultWorkingDirectory)/**/*.zip
- task: AzureAppServiceSettings@1
displayName: Azure App Service Settings
inputs:
azureSubscription: $(azureSubscription)
appName: $(WebApp_Name)
# To deploy the settings on a slot, provide slot name as below. By
default, the settings would be applied to the actual Web App (Production
slot)
# slotName: staging
appSettings: |
[
{
"name": "APPINSIGHTS_INSTRUMENTATIONKEY",
"value": "$(Key)",
"slotSetting": false
},
{
"name": "MYSQL_DATABASE_NAME",
"value": "$(DB_Name)",
"slotSetting": false
}
]
generalSettings: |
[
{
"alwaysOn": true,
"webSocketsEnabled": false
}
]
connectionStrings: |
[
{
"name": "MysqlCredentials",
"value": "$(MySQl_ConnectionString)",
"type": "MySql",
"slotSetting": false
}
]
Requirements
ノ Expand table
Requirement Description
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Feedback
Was this page helpful? Yes No
Run Azure CLI commands against an Azure subscription in a PowerShell Core/shell script
when running on Linux agent. Or, run Azure CLI commands against an Azure
subscription in a PowerShell/PowerShell Core/batch script when running on Windows
agent.
Syntax
YAML
# Azure CLI v2
# Run Azure CLI commands against an Azure subscription in a PowerShell
Core/Shell script when running on Linux agent or PowerShell/PowerShell
Core/Batch script when running on Windows agent.
- task: AzureCLI@2
inputs:
azureSubscription: # string. Alias: connectedServiceNameARM. Required.
Azure Resource Manager connection.
scriptType: # 'ps' | 'pscore' | 'batch' | 'bash'. Required. Script Type.
scriptLocation: 'scriptPath' # 'inlineScript' | 'scriptPath'. Required.
Script Location. Default: scriptPath.
scriptPath: # string. Required when scriptLocation = scriptPath. Script
Path.
#inlineScript: # string. Required when scriptLocation = inlineScript.
Inline Script.
#arguments: # string. Alias: scriptArguments. Script Arguments.
#powerShellErrorActionPreference: 'stop' # 'stop' | 'continue' |
'silentlyContinue'. Optional. Use when scriptType = ps || scriptType =
pscore. ErrorActionPreference. Default: stop.
# Advanced
#addSpnToEnvironment: false # boolean. Access service principal details
in script. Default: false.
#useGlobalConfig: false # boolean. Use global Azure CLI configuration.
Default: false.
#workingDirectory: # string. Alias: cwd. Working Directory.
#failOnStandardError: false # boolean. Fail on Standard Error. Default:
false.
#powerShellIgnoreLASTEXITCODE: false # boolean. Optional. Use when
scriptType = ps || scriptType = pscore. Ignore $LASTEXITCODE. Default:
false.
Inputs
azureSubscription - Azure Resource Manager connection
Type of script. Select a bash or pscore script when running on Linux agent. Or, select a
batch , ps , or pscore script when running on Windows agent. A pscore script can run
string . Required. Allowed values: inlineScript (Inline script), scriptPath (Script path).
Fully qualified path of the script. Use .ps1 , .bat , or .cmd when using Windows-based
agent. Use .ps1 or .sh when using Linux-based agent or a path relative to the the
default working directory.
You can write your scripts inline here. When using Windows agent, use PowerShell,
PowerShell Core, or batch scripting. Use PowerShell Core or shell scripting when using
Linux-based agents. For batch files, use the prefix call before every Azure command.
You can also pass predefined and custom variables to this script by using arguments.
az --version
az account show
call az --version
call az account show
powerShellErrorActionPreference - ErrorActionPreference
Adds the service principal ID, service principal key or workload identity federation token,
and tenant ID of the Azure endpoint you chose to the script's execution environment.
You can use the servicePrincipalId , servicePrincipalKey or idToken , and tenantId
variables in your script.
This is honored only when the Azure endpoint has service principal authentication
scheme or workload identity federation authentication scheme.
The following list shows the syntax to access environment variables based on the script
type.
If this input is false, this task will use its own Azure CLI configuration directory. Use this
task to run Azure CLI tasks in parallel releases.
Current working directory where the script is run. If left blank, this input is the root of
the repo (build) or artifacts (release), which is $(System.DefaultWorkingDirectory) .
If this input is true, this task will fail when any errors are written to the StandardError
stream. Clear the checkbox to ignore standard errors and instead rely on exit codes to
determine the status.
false .
exit code from an external command as the exit code of PowerShell. Otherwise, the line
is not appended to the end of your script.
Output variables
None.
Remarks
Prerequisites
A Microsoft Azure subscription.
Azure Resource Manager service connection to your Azure account.
Microsoft hosted agents have Azure CLI pre-installed. However if you are using
private agents, install Azure CLI on the computer(s) that run the build and release
agent. If an agent is already running on the machine on which the Azure CLI is
installed, restart the agent to ensure all the relevant stage variables are updated.
Examples
The following example lists the version of Azure CLI and gets the details of the
subscription.
YAML
- task: AzureCLI@2
displayName: Azure CLI
inputs:
azureSubscription: <Name of the Azure Resource Manager service
connection>
scriptType: ps
scriptLocation: inlineScript
inlineScript: |
az --version
az account show
YAML
- task: AzureCLI@2
inputs:
azureSubscription: <Azure_Resource_Manager_Service_Connection>
scriptType: 'ps'
scriptLocation: 'inlineScript'
arguments: '$(AZURE_STORAGE_ACCOUNT) $(AZURE_STORAGE_KEY)'
inlineScript: './scripts/publish.ps1 $1 $2'
YAML
- task: AzureCLI@2
inputs:
azureSubscription: <Azure_Resource_Manager_Service_Connection>
scriptType: 'ps'
scriptLocation: 'scriptPath'
arguments: '$(AZURE_STORAGE_ACCOUNT) $(AZURE_STORAGE_KEY)'
scriptPath: './scripts/publish.ps1'
Requirements
ノ Expand table
Requirement Description
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
See also
Azure Resource Group Deployment
Azure Cloud Service Deployment
Azure Web App Deployment
Feedback
Was this page helpful? Yes No
Run Azure CLI commands against an Azure subscription in a shell script when running
on Linux agent or batch script when running on Windows agent.
Syntax
YAML
# Azure CLI v1
# Run Azure CLI commands against an Azure subscription in a Shell script
when running on Linux agent or Batch script when running on Windows agent.
- task: AzureCLI@1
inputs:
azureSubscription: # string. Alias: connectedServiceNameARM. Required.
Azure subscription.
scriptLocation: 'scriptPath' # 'inlineScript' | 'scriptPath'. Required.
Script Location. Default: scriptPath.
scriptPath: # string. Required when scriptLocation = scriptPath. Script
Path.
#inlineScript: # string. Required when scriptLocation = inlineScript.
Inline Script.
#arguments: # string. Alias: args. Arguments.
# Advanced
#addSpnToEnvironment: false # boolean. Access service principal details
in script. Default: false.
#useGlobalConfig: false # boolean. Use global Azure CLI configuration.
Default: false.
#workingDirectory: # string. Alias: cwd. Working Directory.
#failOnStandardError: false # boolean. Fail on Standard Error. Default:
false.
Inputs
azureSubscription - Azure subscription
Fully qualified path of the script or a path relative to the the default working directory.
You can write your scripts inline here. When using Windows agent, use batch scripting.
Use shell scripting when using Linux-based agents. For batch files, use the prefix call
before every Azure command. You can also pass predefined and custom variables to this
script using arguments
See the following examples. The first is a shell example and the second is a batch
example:
arguments - Arguments
Input alias: args . string .
Adds the service principal ID and key of the Azure endpoint that you chose to the
script's execution environment. You can use the $servicePrincipalId and
$servicePrincipalKey variables in your script.
This is honored only when the Azure endpoint has Service Principal authentication
scheme.
If this is false, this task will use its own separate Azure CLI configuration directory. This
can be used to run Azure CLI tasks in parallel releases.
Current working directory where the script is run. If left blank, this input is the root of
the repo (build) or artifacts (release), which is $(System.DefaultWorkingDirectory) .
If this input is true, this task will fail when any errors are written to the StandardError
stream. Clear the checkbox to ignore standard errors and instead rely on exit codes to
determine the status.
Output variables
None.
Remarks
What's new in Version 1.0:
Requirements
ノ Expand table
Requirement Description
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Feedback
Was this page helpful? Yes No
Run a shell or batch script with Azure CLI commands against an Azure subscription.
Syntax
YAML
Inputs
connectedServiceNameSelector - Azure Connection Type
string . Required. Allowed values: connectedServiceName (Azure Classic),
string . Required. Allowed values: inlineScript (Inline Script), scriptPath (Script Path).
Fully qualified path of the script or a path relative to the the default working directory.
You can write your scripts inline here. For batch files, use the prefix call before every
Azure command. You can also pass predefined and custom variables to this script using
arguments.
See the following examples. The first is a shell example and the second is a batch
example:
string .
Current working directory where the script is run. If left blank, this input is the root of
the repo (build) or artifacts (release), which is $(System.DefaultWorkingDirectory) .
If this is true, this task will fail when any errors are written to the StandardError stream.
Output variables
None.
Requirements
ノ Expand table
Requirement Description
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Feedback
Was this page helpful? Yes No
Syntax
# Azure Cloud Service deployment v2
# Deploy an Azure Cloud Service.
- task: AzureCloudPowerShellDeployment@2
inputs:
ARMConnectedServiceName: # string. Required. Azure subscription (ARM).
ResourceGroupName: # string. Required. Resource group.
ARMStorageAccount: # string. Required. Storage account (ARM).
ServiceName: # string. Required. Service name.
ServiceLocation: # string. Required. Service location.
CsCfg: # string. Required. CsCfg.
CsDef: # string. Required. CsDef.
CsPkg: # string. Required. CsPkg.
#KeyVault: # string. Azure KeyVault.
#DeploymentLabel: '$(Build.BuildNumber)' # string. Deployment label.
Default: $(Build.BuildNumber).
#AppendDateTimeToLabel: false # boolean. Append current date and time.
Default: false.
#UpgradeMode: 'Auto' # string. Update mode for the cloud service.
Default: Auto.
#AllowUpgrade: true # boolean. Allow upgrade. Default: true.
#VerifyRoleInstanceStatus: false # boolean. Verify role instance status.
Default: false.
# Advanced Options For Creating New Service
#DiagnosticStorageAccountKeys: # string. Diagnostic storage account
keys.
Inputs
ARMConnectedServiceName - Azure subscription (ARM)
string . Required.
string . Required.
Enter or Select the Azure Resource Group that contains the Azure App Service specified
above.
string . Required.
string . Required.
A region for new service deployment. Options include: East US, East US 2, Central US,
South Central US, West US, North Europe, West Europe, and others.
CsCfg - CsCfg
string . Required.
CsDef - CsDef
string . Required.
CsPkg - CsPkg
string . Required.
string .
Specifies the label name for the new deployment. If not specified, defaults to a Globally
Unique Identifier (GUID).
Causes the task to wait until role instances are in the ready state.
Format storage key string as Role:Storagekey . The diagnostics storage account name
for each role is retrieved from the diagnostic config file (.wadcfgx).
If the .wadcfgx file for a role is not found: The diagnostic extension isn't set for that
role.
If the storage account name is not found in the .wadcfgx file: The default storage
account is used for storing diagnostic results, and storage key parameters from the
deployment task is ignored.
If there is sensitive information in the diagnostic results for your environment, save the
storage_account_key as a secret variable. For example:
WebRole: WebRole_storage_account_key
WorkerRole: WorkerRole_stoarge_account_key
Output variables
None.
Requirements
ノ Expand table
Requirement Description
Runs on Agent
Demands Self-hosted agents must have capabilities that match the following demands
to run jobs that use this task: azureps
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Command Any
restrictions
Feedback
Was this page helpful? Yes No
7 Note
This task does not support Azure Resource Manager authentication with workflow
identity federation.
Syntax
# Azure Cloud Service deployment v1
# Deploy an Azure Cloud Service.
- task: AzureCloudPowerShellDeployment@1
inputs:
azureClassicSubscription: # string. Alias: ConnectedServiceName.
Required. Azure subscription (Classic).
#EnableAdvancedStorageOptions: false # boolean. Enable ARM storage
support. Default: false.
StorageAccount: # string. Required when EnableAdvancedStorageOptions =
false. Storage account (Classic).
#ARMConnectedServiceName: # string. Required when
EnableAdvancedStorageOptions = true. Azure subscription (ARM).
#ARMStorageAccount: # string. Required when EnableAdvancedStorageOptions
= true. Storage account (ARM).
ServiceName: # string. Required. Service name.
ServiceLocation: # string. Required. Service location.
CsPkg: # string. Required. CsPkg.
CsCfg: # string. Required. CsCfg.
slotName: 'Production' # string. Alias: Slot. Required. Environment
(Slot). Default: Production.
#DeploymentLabel: '$(Build.BuildNumber)' # string. Deployment label.
Default: $(Build.BuildNumber).
#AppendDateTimeToLabel: false # boolean. Append current date and time.
Default: false.
#AllowUpgrade: true # boolean. Allow upgrade. Default: true.
#SimultaneousUpgrade: false # boolean. Optional. Use when AllowUpgrade
== true. Simultaneous upgrade. Default: false.
#ForceUpgrade: false # boolean. Optional. Use when AllowUpgrade == true.
Force upgrade. Default: false.
#VerifyRoleInstanceStatus: false # boolean. Verify role instance status.
Default: false.
# Advanced Options For Creating New Service
#DiagnosticStorageAccountKeys: # string. Diagnostic storage account
keys.
#NewServiceCustomCertificates: # string. Custom certificates to import.
#NewServiceAdditionalArguments: # string. Additional arguments.
#NewServiceAffinityGroup: # string. Affinity group.
Inputs
azureClassicSubscription - Azure subscription (Classic)
string . Required.
A region for new service deployment. Options include: East US, East US 2, Central US,
South Central US, West US, North Europe, West Europe, and others.
CsPkg - CsPkg
string . Required.
CsCfg - CsCfg
string . Required.
Specifies the label name for the new deployment. If not specified, defaults to a Globally
Unique Identifier (GUID).
Upgrades all instances at once. Your cloud service is unavailable during this time.
Sets a forced upgrade. Forcing an upgrade can cause loss of local data.
Causes the task to wait until role instances are in the ready state.
Format storage key string as Role:Storagekey . The diagnostics storage account name
for each role is retrieved from the diagnostic config file (.wadcfgx).
If the .wadcfgx file for a role is not found: The diagnostic extension isn't set for that
role.
If the storage account name is not found in the .wadcfgx file: The default storage
account is used for storing diagnostic results, and storage key parameters from the
deployment task is ignored.
NOTE: If there is sensitive information in the diagnostic results for your environment,
save the storage_account_key as a secret variable. For example:
WebRole: WebRole_storage_account_key
WorkerRole: WorkerRole_stoarge_account_key
string .
string .
Passes additional arguments when creating a new service. Arguments are passed to the
New-AzureService cmdlet. For example, -Label 'MyTestService' .
string .
The affinity group used instead of service location when creating a new service.
Output variables
None.
Remarks
Use this task to deploy an Azure Cloud Service.
Requirements
ノ Expand table
Requirement Description
Runs on Agent
Requirement Description
Demands Self-hosted agents must have capabilities that match the following demands
to run jobs that use this task: azureps
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Command Any
restrictions
Feedback
Was this page helpful? Yes No
Syntax
YAML
Inputs
workingDirectory - Working Directory
Current working directory where the script is run. Empty is the root of the repo (build) or
artifacts (release), which is $(System.DefaultWorkingDirectory).
appSourcePath - Application source path
string .
Absolute path on the runner of the source application code to be built. If not provided,
the 'imageToDeploy' argument must be provided to ensure the Container App has an
image to reference.
When pushing a new image to ACR, the acrName and appSourcePath task inputs are
required.
Specify an Azure Resource Manager service connection for the deployment. This service
connection must be linked to the user's Azure Subscription where the Container App will
be created/updated. This service connection must have proper permissions to make
these changes within the subscription, for example Contributor role.
The name of the Azure Container Registry that the runnable application image will be
pushed to.
When pushing a new image to ACR, the acrName and appSourcePath task inputs are
required.
The username used to authenticate push requests to the provided Azure Contrainer
Registry. If not provided, an access token will be generated via 'az acr login' and
provided to 'docker login' to authenticate the requests.
string .
The password used to authenticate push requests to the provided Azure Contrainer
Registry. If not provided, an access token will be generated via 'az acr login' and
provided to 'docker login' to authenticate the requests.
dockerfilePath - Dockerfile path
string .
Relative path (_without file prefixes (see the following Examples) to the Dockerfile in the
provided application source that should be used to build the image that is then pushed
to ACR and deployed to the Container App. If not provided, this task will check if there is
a file named 'Dockerfile' at the root of the provided application source and use that to
build the image. Otherwise, the Oryx++ Builder will be used to create the image.
string .
The custom name of the image that is to be built, pushed to ACR and deployed to the
Container App by this task. Note: this image name should include the ACR server; e.g.,
<acr-name>.azurecr.io/<repo>:<tag> . If this argument is not provided, a default image
The name of the image that has already been pushed to ACR and will be deployed to
the Container App by this task. Note: the image name should include the ACR server;
e.g., <acr-name>.azurecr.io/<repo>:<tag> . If this argument is not provided, the value
provided (or determined) for the 'imageToBuild' argument will be used. If this image is
found in an ACR instance that requires authentication to pull, the acrName argument, or
the acrUsername and acrPassword arguments, can be provided to authenticate requests
to the ACR instance.
The name of the Azure Container App that will be created or updated. If not provided,
this value will be in the form of ado-task-app-<build-id>-<build-number> .
string .
The name of the Azure Container App environment to use with the application. If not
provided, an existing environment in the resource group of the Container App will be
used, otherwise, an environment will be created in the format of <container-app-name>-
env .
The platform version stack used in the final runnable application image that is deployed
to the Container App. The value should be provided in the formation <platform>:
<version> . If not provided, this value is determined by Oryx based on the contents of
the provided application. Please refer to this document for more information on
supported runtime stacks for Oryx.
string .
The target port that the Container App will listen on. If not provided, this value will be
"80" for Python applications and "8080" for all other supported platforms.
string .
The location that the Container App (and other created resources) will be deployed to.
Possible options: external, internal, disabled. If set to external (default value if not
provided when creating a Container App), the Container App will be visible from the
internet or a VNET, depending on the app environment endpoint configured. If set to
internal , the Container App will be visible from within the app environment only. If set
to disabled , ingress will be disabled for this Container App and will not have an HTTP or
TCP endpoint.
string .
Full path (on the executing Azure Pipelines agent) to the YAML file detailing the
configuration of the Container App.
The resourceGroup property in the YAML configuration file will not be used; the value for
this either comes from the resourceGroup argument provided to the task, or the default
resource group name generated by the task. All other properties provided in the YAML
configuration file will override the values provided as arguments to this task; for
example, if the containerAppName argument is provided to the task, and the name
property is set in the YAML configuration file, the name property in the YAML file will be
used when creating or updating the Container App.
Image and application source arguments (e.g., appSourcePath , imageToDeploy ) will still
be used to first build and/or push an image that is used by the Container App; in this
case, the provided YAML configuration file will need to reference the image specified by
imageToDeploy (or imageToBuild , depending on your scenario).
When creating a new Container App, all properties listed in the YAML configuration file
(except resourceGroup as mentioned above) will be set when the Container App is
created. When updating an existing Container App, only the properties listed in the file
will be updated on the Container App.
Currently, the YAML file does not support setting up managed identity authentication
for the container registry used; for more information on this issue, please see this
GitHub issue .
In cases where the yamlConfigPath argument is provided, the YAML file will be passed
through to the corresponding az containerapp command, either create or update
depending on your scenario. For more information on the intended behavior when the
YAML configuration file is provided, please see the documents linked for the
corresponding commands.
For more information on the structure of the YAML configuration file, please visit this
site .
If set to 'true', no telemetry will be collected by this Azure DevOps Task. If set to 'false',
or if this argument is not provided, telemetry will be sent to Microsoft about the
Container App build and deploy scenario targeted by this Azure DevOps Task.
Output variables
None.
Remarks
This Azure Pipelines Task allows users to easily deploy their application source to an
Azure Container App in their Azure Pipelines workflow by either providing a
previously built image, a Dockerfile that an image can be built from, or using a builder
to create a runnable application image for the user.
Pushing an image to ACR - when pushing a new image to ACR, the acrName and
appSourcePath task inputs are required.
Uses the Oryx++ Builder to build the application source using Oryx to produce a
runnable application image
Pushes this runnable application image to the provided Azure Container Registry
Creates or updates a Container App based on this image
If a previously built image has already been pushed to the ACR instance and is provided
to this task, no application source is required and the image will be used when creating
or updating the Container App.
macOS
The macOS runners provided by Microsoft do not come installed with Docker
(more information here ); as a result, this task is not able to run any docker
commands, such as pushing the built runnable application images to ACR.
Windows
The Windows runners provided by Microsoft comes with Docker installed, but
by default, Linux-based images are unable to be pulled down; as a result, this
task is not able to pull down the Oryx builder to create runnable application
images from provided application source.
Please see the below Docker prerequisite section for more information.
If you want to disable data collection, please set the disableTelemetry argument to
true .
Prerequisites
Prior to running this task, Azure resources and an Azure DevOps service connection are
either required or optional depending on the arguments provided to this task.
Create the ARM service endpoint and use the 'Azure Resource Manager' endpoint type;
for more information on creating service connections, please follow this document.
Azure CLI
This task requires that the Azure CLI is installed on the Azure Pipelines agent to execute
a variety of commands throughout the execution of the task. For more information on
how to install the Azure CLI on the agent, please see this document. If an agent is
already running on the machine on which the Azure CLI is installed, ensure that you
restart the agent so that all relevant environment variables are updated.
Docker
This task requires that Docker is installed on the Azure Pipelines agent to push images
to the provided Azure Container Registry. For more information on how to install Docker
on the agent, please see this document .
In addition, users running this task with a Windows agent may encounter an issue with
not being able to pull down Linux-based images; to resolve this, please visit this site
or located the DockerCli.exe file on your agent (typically in the Program
Files\Docker\Docker folder) and run
If Docker is not installed on the agent running this task, the following scenario(s) are still
enabled:
If Docker is on the agent, but unable to work with Linux-based images, the following
scenario(s) are still enabled:
pack CLI
The pack CLI is maintained by the Cloud Native Buildpacks project and is used by this
task to create runnable application images for the user when the application source
code is provided and no additional Dockerfile is provided or found. A builder was
created by Oryx to take in the application source code provided to this task and
produce an image that could then be pushed to an image registry and used within a
Container App to build and run the application.
A stable version of the pack CLI is installed on the Azure Pipelines agent executing the
task, and depending on the base OS of this agent, different tools will be leverage to
assist with the installation:
On Windows runners:
A set of PowerShell commands are executed to do the following:
Creates a pack folder in the agent's temporary folder, if the pack folder
doesn't already exist
Downloads the pack CLI .zip into this pack folder
Unzips the content from this .zip and places them in the pack folder
Deletes the .zip
On non-Windows runners:
curl will be used to pull down the .tgz containing the pack executable
tar will be used to unzip the .tgz and place the pack executable in
/usr/local/bin
An Azure Container Registry must exist that the user is able to push container images
to. This task will leverage the Azure Container Registry to either push a built runnable
application image to and/or deploy a Container App from.
The name of the Azure Container Registry is required via the acrName argument.
The user can also provide values for the acrUsername and acrPassword arguments that
will authenticate calls to the Azure Container Registry instance; if not provided, an
access token will be generated via the Azure CLI that will authenticate the calls instead.
Examples
The following examples outline how to use the AzureContainerApps in different
scenarios.
steps:
- task: AzureContainerApps@1
displayName: Build and deploy Container App
inputs:
connectedServiceNameARM: 'azure-subscription-service-connection'
appSourcePath: '$(System.DefaultWorkingDirectory)'
acrName: 'mytestacr'
steps:
- task: AzureContainerApps@1
displayName: Build and deploy Container App
inputs:
connectedServiceNameARM: 'azure-subscription-service-connection'
imageToDeploy: mcr.microsoft.com/azuredocs/containerapps-
helloworld:latest
steps:
- task: AzureContainerApps@1
displayName: Build and deploy Container App
inputs:
yamlConfigPath: simple-image-container-app.yaml
Container App will be pulled from the simple-image-container-app.yaml file and will
override any additional values that would've been provided to the task as arguments
excluding resourceGroup .
yml
properties:
managedEnvironmentId:
/subscriptions/SUBSCRIPTION_ID/resourceGroup/RESOURCE_GROUP/providers/Micros
oft.App/managedEnvironments/CONTAINER_APP_ENVIRONMENT
configuration:
ingress:
external: true
allowInsecure: false
targetPort: 80
template:
containers:
- image: mcr.microsoft.com/azuredocs/containerapps-helloworld:latest
name: mysampleimagecontainer
steps:
- task: AzureContainerApps@1
displayName: Build and deploy Container App
inputs:
connectedServiceNameARM: 'azure-subscription-service-connection'
appSourcePath: '$(System.DefaultWorkingDirectory)'
acrName: 'mytestacr'
acrUsername: $(ACR_USERNAME_SECRET)
acrPassword: $(ACR_PASSWORD_SECRET)
steps:
- task: AzureContainerApps@1
displayName: Build and deploy Container App
inputs:
connectedServiceNameARM: 'azure-subscription-service-connection'
appSourcePath: '$(System.DefaultWorkingDirectory)'
acrName: 'mytestacr'
containerAppName: 'my-test-container-app'
This will create a new Container App named my-test-container-app in a new resource
group name my-test-container-app-rg .
steps:
- task: AzureContainerApps@1
displayName: Build and deploy Container App
inputs:
connectedServiceNameARM: 'azure-subscription-service-connection'
appSourcePath: '$(System.DefaultWorkingDirectory)'
acrName: 'mytestacr'
resourceGroup: 'my-test-rg'
steps:
- task: AzureContainerApps@1
displayName: Build and deploy Container App
inputs:
connectedServiceNameARM: 'azure-subscription-service-connection'
appSourcePath: '$(System.DefaultWorkingDirectory)'
acrName: 'mytestacr'
containerAppName: 'my-test-container-app'
resourceGroup: 'my-test-rg'
This will create a new Container App named my-test-container-app in a resource group
named my-test-rg . If the my-test-rg resource group does not exist, it will be created as
a part of this task.
steps:
- task: AzureContainerApps@1
displayName: Build and deploy Container App
inputs:
connectedServiceNameARM: 'azure-subscription-service-connection'
appSourcePath: '$(System.DefaultWorkingDirectory)'
acrName: 'mytestacr'
containerAppEnvironment: 'my-test-container-app-env'
steps:
- task: AzureContainerApps@1
displayName: Build and deploy Container App
inputs:
connectedServiceNameARM: 'azure-subscription-service-connection'
appSourcePath: '$(System.DefaultWorkingDirectory)'
acrName: 'mytestacr'
runtimeStack: 'dotnetcore:7.0'
Dockerfile provided
yml
steps:
- task: AzureContainerApps@1
displayName: Build and deploy Container App
inputs:
connectedServiceNameARM: 'azure-subscription-service-connection'
appSourcePath: '$(System.DefaultWorkingDirectory)'
acrName: 'mytestacr'
dockerfilePath: 'test.Dockerfile'
Note: for values provided to dockerfilePath , no file prefixes should be included (e.g.,
./test.Dockerfile should be passed as just test.Dockerfile ). The provided
steps:
- task: AzureContainerApps@1
displayName: Build and deploy Container App
inputs:
connectedServiceNameARM: 'azure-subscription-service-connection'
appSourcePath: '$(System.DefaultWorkingDirectory)'
acrName: 'mytestacr'
imageToBuild: 'mytestacr.azurecr.io/app:latest'
Requirements
ノ Expand table
Requirement Description
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
See also
Deploy to Azure Container Apps from Azure Pipelines
Feedback
Was this page helpful? Yes No
Syntax
YAML
Inputs
workingDirectory - Working Directory
Current working directory where the script is run. Empty is the root of the repo (build) or
artifacts (release), which is $(System.DefaultWorkingDirectory).
appSourcePath - Application source path
string .
Absolute path on the runner of the source application code to be built. If not provided,
the 'imageToDeploy' argument must be provided to ensure the Container App has an
image to reference.
When pushing a new image to ACR, the acrName and appSourcePath task inputs are
required.
Specify an Azure Resource Manager service connection for the deployment. This service
connection must be linked to the user's Azure Subscription where the Container App will
be created/updated. This service connection must have proper permissions to make
these changes within the subscription, for example Contributor role.
The name of the Azure Container Registry that the runnable application image will be
pushed to.
When pushing a new image to ACR, the acrName and appSourcePath task inputs are
required.
The username used to authenticate push requests to the provided Azure Contrainer
Registry. If not provided, an access token will be generated via 'az acr login' and
provided to 'docker login' to authenticate the requests.
string .
The password used to authenticate push requests to the provided Azure Contrainer
Registry. If not provided, an access token will be generated via 'az acr login' and
provided to 'docker login' to authenticate the requests.
dockerfilePath - Dockerfile path
string .
Relative path (_without file prefixes (see the following Examples) to the Dockerfile in the
provided application source that should be used to build the image that is then pushed
to ACR and deployed to the Container App. If not provided, this task will check if there is
a file named 'Dockerfile' at the root of the provided application source and use that to
build the image. Otherwise, the Oryx++ Builder will be used to create the image.
string .
The custom name of the image that is to be built, pushed to ACR and deployed to the
Container App by this task. Note: this image name should include the ACR server; e.g.,
<acr-name>.azurecr.io/<repo>:<tag> . If this argument is not provided, a default image
The name of the image that has already been pushed to ACR and will be deployed to
the Container App by this task. Note: the image name should include the ACR server;
e.g., <acr-name>.azurecr.io/<repo>:<tag> . If this argument is not provided, the value
provided (or determined) for the 'imageToBuild' argument will be used. If this image is
found in an ACR instance that requires authentication to pull, the acrName argument, or
the acrUsername and acrPassword arguments, can be provided to authenticate requests
to the ACR instance.
The name of the Azure Container App that will be created or updated. If not provided,
this value will be in the form of ado-task-app-<build-id>-<build-number> .
string .
The name of the Azure Container App environment to use with the application. If not
provided, an existing environment in the resource group of the Container App will be
used, otherwise, an environment will be created in the format of <container-app-name>-
env .
The platform version stack used in the final runnable application image that is deployed
to the Container App. The value should be provided in the formation <platform>:
<version> . If not provided, this value is determined by Oryx based on the contents of
the provided application. Please refer to this document for more information on
supported runtime stacks for Oryx.
string .
The target port that the Container App will listen on. If not provided, this value will be
"80" for Python applications and "8080" for all other supported platforms.
string .
The location that the Container App (and other created resources) will be deployed to.
Possible options: external, internal, disabled. If set to external (default value if not
provided when creating a Container App), the Container App will be visible from the
internet or a VNET, depending on the app environment endpoint configured. If set to
internal , the Container App will be visible from within the app environment only. If set
to disabled , ingress will be disabled for this Container App and will not have an HTTP or
TCP endpoint.
string .
Full path (on the executing Azure Pipelines agent) to the YAML file detailing the
configuration of the Container App.
The resourceGroup property in the YAML configuration file will not be used; the value for
this either comes from the resourceGroup argument provided to the task, or the default
resource group name generated by the task. All other properties provided in the YAML
configuration file will override the values provided as arguments to this task; for
example, if the containerAppName argument is provided to the task, and the name
property is set in the YAML configuration file, the name property in the YAML file will be
used when creating or updating the Container App.
Image and application source arguments (e.g., appSourcePath , imageToDeploy ) will still
be used to first build and/or push an image that is used by the Container App; in this
case, the provided YAML configuration file will need to reference the image specified by
imageToDeploy (or imageToBuild , depending on your scenario).
When creating a new Container App, all properties listed in the YAML configuration file
(except resourceGroup as mentioned above) will be set when the Container App is
created. When updating an existing Container App, only the properties listed in the file
will be updated on the Container App.
Currently, the YAML file does not support setting up managed identity authentication
for the container registry used; for more information on this issue, please see this
GitHub issue .
In cases where the yamlConfigPath argument is provided, the YAML file will be passed
through to the corresponding az containerapp command, either create or update
depending on your scenario. For more information on the intended behavior when the
YAML configuration file is provided, please see the documents linked for the
corresponding commands.
For more information on the structure of the YAML configuration file, please visit this
site .
If set to 'true', no telemetry will be collected by this Azure DevOps Task. If set to 'false',
or if this argument is not provided, telemetry will be sent to Microsoft about the
Container App build and deploy scenario targeted by this Azure DevOps Task.
Output variables
None.
Remarks
This Azure Pipelines Task allows users to easily deploy their application source to an
Azure Container App in their Azure Pipelines workflow by either providing a
previously built image, a Dockerfile that an image can be built from, or using a builder
to create a runnable application image for the user.
Pushing an image to ACR - when pushing a new image to ACR, the acrName and
appSourcePath task inputs are required.
Uses the Oryx++ Builder to build the application source using Oryx to produce a
runnable application image
Pushes this runnable application image to the provided Azure Container Registry
Creates or updates a Container App based on this image
If a previously built image has already been pushed to the ACR instance and is provided
to this task, no application source is required and the image will be used when creating
or updating the Container App.
macOS
The macOS runners provided by Microsoft do not come installed with Docker
(more information here ); as a result, this task is not able to run any docker
commands, such as pushing the built runnable application images to ACR.
Windows
The Windows runners provided by Microsoft comes with Docker installed, but
by default, Linux-based images are unable to be pulled down; as a result, this
task is not able to pull down the Oryx builder to create runnable application
images from provided application source.
Please see the below Docker prerequisite section for more information.
If you want to disable data collection, please set the disableTelemetry argument to
true .
Prerequisites
Prior to running this task, Azure resources and an Azure DevOps service connection are
either required or optional depending on the arguments provided to this task.
Create the ARM service endpoint and use the 'Azure Resource Manager' endpoint type;
for more information on creating service connections, please follow this document.
Azure CLI
This task requires that the Azure CLI is installed on the Azure Pipelines agent to execute
a variety of commands throughout the execution of the task. For more information on
how to install the Azure CLI on the agent, please see this document. If an agent is
already running on the machine on which the Azure CLI is installed, ensure that you
restart the agent so that all relevant environment variables are updated.
Docker
This task requires that Docker is installed on the Azure Pipelines agent to push images
to the provided Azure Container Registry. For more information on how to install Docker
on the agent, please see this document .
In addition, users running this task with a Windows agent may encounter an issue with
not being able to pull down Linux-based images; to resolve this, please visit this site
or located the DockerCli.exe file on your agent (typically in the Program
Files\Docker\Docker folder) and run
If Docker is not installed on the agent running this task, the following scenario(s) are still
enabled:
If Docker is on the agent, but unable to work with Linux-based images, the following
scenario(s) are still enabled:
pack CLI
The pack CLI is maintained by the Cloud Native Buildpacks project and is used by this
task to create runnable application images for the user when the application source
code is provided and no additional Dockerfile is provided or found. A builder was
created by Oryx to take in the application source code provided to this task and
produce an image that could then be pushed to an image registry and used within a
Container App to build and run the application.
A stable version of the pack CLI is installed on the Azure Pipelines agent executing the
task, and depending on the base OS of this agent, different tools will be leverage to
assist with the installation:
On Windows runners:
A set of PowerShell commands are executed to do the following:
Creates a pack folder in the agent's temporary folder, if the pack folder
doesn't already exist
Downloads the pack CLI .zip into this pack folder
Unzips the content from this .zip and places them in the pack folder
Deletes the .zip
On non-Windows runners:
curl will be used to pull down the .tgz containing the pack executable
tar will be used to unzip the .tgz and place the pack executable in
/usr/local/bin
An Azure Container Registry must exist that the user is able to push container images
to. This task will leverage the Azure Container Registry to either push a built runnable
application image to and/or deploy a Container App from.
The name of the Azure Container Registry is required via the acrName argument.
The user can also provide values for the acrUsername and acrPassword arguments that
will authenticate calls to the Azure Container Registry instance; if not provided, an
access token will be generated via the Azure CLI that will authenticate the calls instead.
Examples
The following examples outline how to use the AzureContainerApps in different
scenarios.
steps:
- task: AzureContainerApps@0
displayName: Build and deploy Container App
inputs:
connectedServiceNameARM: 'azure-subscription-service-connection'
appSourcePath: '$(System.DefaultWorkingDirectory)'
acrName: 'mytestacr'
steps:
- task: AzureContainerApps@0
displayName: Build and deploy Container App
inputs:
connectedServiceNameARM: 'azure-subscription-service-connection'
imageToDeploy: mcr.microsoft.com/azuredocs/containerapps-
helloworld:latest
steps:
- task: AzureContainerApps@0
displayName: Build and deploy Container App
inputs:
yamlConfigPath: simple-image-container-app.yaml
Container App will be pulled from the simple-image-container-app.yaml file and will
override any additional values that would've been provided to the task as arguments
excluding resourceGroup .
yml
properties:
managedEnvironmentId:
/subscriptions/SUBSCRIPTION_ID/resourceGroup/RESOURCE_GROUP/providers/Micros
oft.App/managedEnvironments/CONTAINER_APP_ENVIRONMENT
configuration:
ingress:
external: true
allowInsecure: false
targetPort: 80
template:
containers:
- image: mcr.microsoft.com/azuredocs/containerapps-helloworld:latest
name: mysampleimagecontainer
steps:
- task: AzureContainerApps@0
displayName: Build and deploy Container App
inputs:
connectedServiceNameARM: 'azure-subscription-service-connection'
appSourcePath: '$(System.DefaultWorkingDirectory)'
acrName: 'mytestacr'
acrUsername: $(ACR_USERNAME_SECRET)
acrPassword: $(ACR_PASSWORD_SECRET)
steps:
- task: AzureContainerApps@0
displayName: Build and deploy Container App
inputs:
connectedServiceNameARM: 'azure-subscription-service-connection'
appSourcePath: '$(System.DefaultWorkingDirectory)'
acrName: 'mytestacr'
containerAppName: 'my-test-container-app'
This will create a new Container App named my-test-container-app in a new resource
group name my-test-container-app-rg .
steps:
- task: AzureContainerApps@0
displayName: Build and deploy Container App
inputs:
connectedServiceNameARM: 'azure-subscription-service-connection'
appSourcePath: '$(System.DefaultWorkingDirectory)'
acrName: 'mytestacr'
resourceGroup: 'my-test-rg'
steps:
- task: AzureContainerApps@0
displayName: Build and deploy Container App
inputs:
connectedServiceNameARM: 'azure-subscription-service-connection'
appSourcePath: '$(System.DefaultWorkingDirectory)'
acrName: 'mytestacr'
containerAppName: 'my-test-container-app'
resourceGroup: 'my-test-rg'
This will create a new Container App named my-test-container-app in a resource group
named my-test-rg . If the my-test-rg resource group does not exist, it will be created as
a part of this task.
steps:
- task: AzureContainerApps@0
displayName: Build and deploy Container App
inputs:
connectedServiceNameARM: 'azure-subscription-service-connection'
appSourcePath: '$(System.DefaultWorkingDirectory)'
acrName: 'mytestacr'
containerAppEnvironment: 'my-test-container-app-env'
steps:
- task: AzureContainerApps@0
displayName: Build and deploy Container App
inputs:
connectedServiceNameARM: 'azure-subscription-service-connection'
appSourcePath: '$(System.DefaultWorkingDirectory)'
acrName: 'mytestacr'
runtimeStack: 'dotnetcore:7.0'
Dockerfile provided
yml
steps:
- task: AzureContainerApps@0
displayName: Build and deploy Container App
inputs:
connectedServiceNameARM: 'azure-subscription-service-connection'
appSourcePath: '$(System.DefaultWorkingDirectory)'
acrName: 'mytestacr'
dockerfilePath: 'test.Dockerfile'
Note: for values provided to dockerfilePath , no file prefixes should be included (e.g.,
./test.Dockerfile should be passed as just test.Dockerfile ). The provided
steps:
- task: AzureContainerApps@0
displayName: Build and deploy Container App
inputs:
connectedServiceNameARM: 'azure-subscription-service-connection'
appSourcePath: '$(System.DefaultWorkingDirectory)'
acrName: 'mytestacr'
imageToBuild: 'mytestacr.azurecr.io/app:latest'
Requirements
ノ Expand table
Requirement Description
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
See also
Deploy to Azure Container Apps from Azure Pipelines
Feedback
Was this page helpful? Yes No
Use this task to run your scripts and make changes to your database in Azure Database
for MySQL. The Azure Database for MySQL Deployment task only works with Azure
Database for MySQL Single Server.
Syntax
# Azure Database for MySQL deployment v1
# Run your scripts and make changes to your Azure Database for MySQL.
- task: AzureMysqlDeployment@1
inputs:
azureSubscription: # string. Alias: ConnectedServiceName. Required.
Azure Subscription.
# DB Details
ServerName: # string. Required. Host Name.
#DatabaseName: # string. Database Name.
SqlUsername: # string. Required. Server Admin Login.
SqlPassword: # string. Required. Password.
# Deployment Package
#TaskNameSelector: 'SqlTaskFile' # 'SqlTaskFile' | 'InlineSqlTask'.
Type. Default: SqlTaskFile.
SqlFile: # string. Required when TaskNameSelector = SqlTaskFile. MySQL
Script.
#SqlInline: # string. Required when TaskNameSelector = InlineSqlTask.
Inline MySQL Script.
#SqlAdditionalArguments: # string. Additional MySQL Arguments.
# Firewall
IpDetectionMethod: 'AutoDetect' # 'AutoDetect' | 'IPAddressRange'.
Required. Specify Firewall Rules Using. Default: AutoDetect.
#StartIpAddress: # string. Required when IpDetectionMethod =
IPAddressRange. Start IP Address.
#EndIpAddress: # string. Required when IpDetectionMethod =
IPAddressRange. End IP Address.
#DeleteFirewallRule: true # boolean. Delete Rule After Task Ends.
Default: true.
Inputs
azureSubscription - Azure Subscription
To configure a new service connection, select the Azure subscription from the list and
click Authorize .
If your subscription is not listed or if you want to use an existing Service Principal, you
can setup an Azure service connection using the Add or Manage buttons.
string . Required.
Example: fabrikam.mysql.database.azure.com
The server name is provided in the Azure portal on the 'Overview' blade of your Azure
Database for MySQL server resource.
When you connect using MySQL Workbench, this is the same value that is used for
Hostname in Parameters .
Optional. The name of the database. The script will create a database name if one does
not exist.
If not specified, ensure that the database is referenced in the supplied SQL file or inline
SQL, where needed.
string . Required.
The Azure Database for MySQL server supports native MySQL authentication. You can
connect and authenticate to a server with the server's admin login. Example:
bbo1@fabrikam .
When you connect using MySQL Workbench, this is the same value that is used for
Username in Parameters .
SqlPassword - Password
string . Required.
The administrator password for Azure Database for MySQL. In case you don’t recall the
password, you can change the password from Azure portal.
This string can be defined with a variable in the pipeline. Example: $(password) .
Also, you may mark the variable type as secret to secure it.
TaskNameSelector - Type
string . Allowed values: SqlTaskFile (MySQL Script File), InlineSqlTask (Inline MySQL
Optional. Selects one of the options between Script File & Inline Script.
The full path of the script file on the automation agent or on a UNC path accessible to
the automation agent. For example: \BudgetIT\DeployBuilds\script.sql .
Note: The MySQL client prefers Unix style paths, so from version 1.183.0 on, the task will
convert Windows style paths to Unix style paths. Example: from
c:\foo\bar\myscript.sql to c:/foo/bar/myscript.sql .
When the task is used on Linux platforms, paths remain unchanged. There is no need to
escape special characters in paths.
Optional. The additional options supported by the MySQL client. These options are
applied when executing the given file on the Azure Database for MySQL.
Example: You can change to the default tab separated output format, to HTML, or even
to the XML format. Other examples include:
For the successful execution of the task, we need to enable administrators to access the
Azure Database for MySQL Server from the IP Address of the automation agent.
By selecting auto-detect, you can automatically add a firewall exception for the range of
possible IP addresses of automation agents, or you can explicitly specify the range.
Accepted values:
The starting IP Address of the automation agent machine pool. For example:
196.21.30.50 .
Optional. If selected, the added exception for the IP addresses of the automation agent
will be removed for the corresponding Azure Database for MySQL.
Output variables
None.
Remarks
Use this task to run your scripts and make changes to your database in Azure Database
for MySQL. Note that this is a preview version. The Azure Database for MySQL
Deployment task only works with Azure Database for MySQL Single Server.
Requirements
ノ Expand table
Requirement Description
Runs on Agent
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Feedback
Was this page helpful? Yes No
This version of the task supports Workload Identity Federation and uses Azure RBAC to
access Azure Storage. As a result of us using Azure RBAC, SAS tokens are no longer
used. For more information, see the Remarks section.
Syntax
# Azure file copy v6
# Copy files to Azure Blob Storage or virtual machines.
- task: AzureFileCopy@6
inputs:
SourcePath: # string. Required. Source.
azureSubscription: # string. Alias: ConnectedServiceNameARM. Required.
Azure Subscription.
Destination: # 'AzureBlob' | 'AzureVMs'. Required. Destination Type.
storage: # string. Alias: StorageAccountRM. Required. RM Storage
Account.
#ContainerName: # string. Required when Destination = AzureBlob.
Container Name.
#BlobPrefix: # string. Optional. Use when Destination = AzureBlob. Blob
Prefix.
#resourceGroup: # string. Alias: EnvironmentNameRM. Required when
Destination = AzureVMs. Resource Group.
#ResourceFilteringMethod: 'machineNames' # 'machineNames' | 'tags'.
Optional. Use when Destination = AzureVMs. Select Machines By. Default:
machineNames.
#MachineNames: # string. Optional. Use when Destination = AzureVMs.
Filter Criteria.
#vmsAdminUserName: # string. Required when Destination = AzureVMs. Admin
Login.
#vmsAdminPassword: # string. Required when Destination = AzureVMs.
Password.
#TargetPath: # string. Required when Destination = AzureVMs. Destination
Folder.
#AdditionalArgumentsForBlobCopy: # string. Optional Arguments (for
uploading files to blob).
#AdditionalArgumentsForVMCopy: # string. Optional. Use when Destination
= AzureVMs. Optional Arguments (for downloading files to VM).
#enableCopyPrerequisites: false # boolean. Optional. Use when
Destination = AzureVMs. Enable Copy Prerequisites. Default: false.
#CopyFilesInParallel: true # boolean. Optional. Use when Destination =
AzureVMs. Copy in Parallel. Default: true.
#CleanTargetBeforeCopy: false # boolean. Clean Target. Default: false.
#skipCACheck: true # boolean. Optional. Use when Destination = AzureVMs.
Test Certificate. Default: true.
Inputs
SourcePath - Source
string . Required.
The location of source files. Supported values include YAML Pipelines and Classic
Release support predefined system variables like Build.Repository.LocalPath.
Release variables are supported only in classic releases. The wild card symbol (*) is
supported anywhere in the file path or file name.
Specify the name of an Azure Resource Manager service connection configured for the
subscription where the target Azure service, virtual machine, or storage account is
located. See Azure Resource Manager overview for more details.
string . Required. Allowed values: AzureBlob (Azure Blob), AzureVMs (Azure VMs).
Specify a pre-existing ARM storage account. This is the storage account used as an
intermediary for copying files to Azure VMs.
The name of the container into which files are copied. If the specified container does not
exist in the storage account, it will be created.
To create a virtual directory inside the container, use the blob prefix input. For example,
for the target location https://myaccount.blob.core.windows.net/mycontainer/vd1/vd2/ ,
specify container name mycontainer and blob prefix: vd1/vd2 .
Specify a prefix for the destination virtual directory within the Azure Blob container. This
applies when the SourcePath contains a wildcard that may match multiple items.
Example: You can append a build number to prefix the files from all blobs with the same
build number.
Example: If you specify a blob prefix myvd1 , a virtual directory is created inside the
container. Files are copied from the source to
https://myaccount.blob.core.windows.net/mycontainer/myvd1/ .
In the case that the SourcePath is a single item with no wildcard, this blob prefix will
function as the destination blob name.
Specify the name of the target Resource Group into which the files will be copied.
Specify a VM host name or tag that identifies a subset of VMs in a resource group. Tags
are supported for resources created via the Azure Resource Manager only.
Provide a list of VM names or tag names that identify the VMs the task will target. Valid
filter criteria includes:
Provide the user name of an account with administrative permissions on all of the target
VMs.
vmsAdminPassword - Password
To find the variable, locate the Admin Login parameter. Select the padlock icon for a
variable defined in the Variables tab to protect the value and insert the variable name
here.
Specify the path to the folder in the Azure VMs into which files will be copied.
string .
Provide additional arguments to AzCopy.exe for use when uploading to the Blob and
downloading to the VMs. See Transfer data with the AzCopy Command-Line Utility for
details.
For Premium storage accounts that support only Azure page Blobs use --blob-
type=PageBlob as an additional argument.
Default arguments include --log-level=INFO (default) and --recursive (if the container
name is not $root ).
--log-level=INFO
--log-level=DEBUG (If the pipeline is running in debug mode set)
--recursive
When enabled, this option uses a self-signed certificate to configure the Windows
Remote Management (WinRM) listener over the HTTPS protocol on port 5986. This
configuration is required for performing copy operations on Azure VMs. Applicable only
for ARM VMs.
If the target VMs are accessed through a load balancer, configure an inbound NAT
rule to allow access on port 5986.
If the target VMs are associated with a Network Security Group (NSG), configure an
inbound security rule to allow access on port 5986.
WinRM requires a certificate for the HTTPS transfer when copying files from the
intermediate storage Blob into the Azure VMs.
If you use a self-signed certificate, specify true to prevent the process from validating
the certificate with a trusted CA.
Output variables
This task defines the following output variables, which you can consume in downstream
steps, jobs, and stages.
StorageContainerUri
Uri of the container where the files were copied to. Valid only when the selected
destination is Azure Blob.
Remarks
AzureFileCopy@6 supports Workload Identity Federation and uses Azure RBAC to access
Azure Storage. As a result of using Azure RBAC, SAS tokens are no longer used and the
sasTokenTimeOutInMinutes task input is removed.
You might block the use of storage account keys and SAS tokens on your storage
accounts. In these situations the AzureFileCopy@5 task, which relies on SAS tokens,
can't be used.
The AzureFileCopy@6 task uses Azure RBAC to access blob storage instead. This requires
the identity of the service connection used to have the appropriate RBAC role e.g.
Storage Blob Data Contributor. See Assign an Azure role for access to blob data.
The AzureFileCopy@6 task also supports service connections that use workload identity
federation .
7 Note
This task is written in PowerShell and works only when run on Windows agents. If
your pipelines require Linux agents and need to copy files to an Azure Storage
Account, consider running az storage blob commands in the Azure CLI task as an
alternative.
The task is used to copy application files and other artifacts that are required in order to
install the app; such as PowerShell scripts, PowerShell-DSC modules, and more.
When the target is Azure VMs, the files are first copied to an automatically generated
Azure blob container and then downloaded into the VMs. The container is deleted after
the files are successfully copied to the VMs.
The task uses AzCopy, the command-line utility built for fast copying data from and to
Azure storage accounts. Version 6 of the Azure File Copy task uses AzCopy V10.
Azure File Copy version 6 require Azure Storage to be authorized via Microsoft Entra ID.
Authentication using a service principal and managed identity are available. For
managed identities, only system-wide managed identity is supported. The level of
authorization required is shown in Option 1: Use Microsoft Entra ID.
To dynamically deploy Azure Resource Groups that contain virtual machines, use the
Azure Resource Group Deployment task. This task has a sample template that can
perform the required operations to set up the WinRM HTTPS protocol on the VMs, open
port 5986 in the firewall, and install the test certificate.
7 Note
If you are deploying to Azure Static Websites as a container in Blob storage, use
Version 2 or higher of the task in order to preserve the $web container name.
1. Configure an inbound access rule to allow HTTPS on port 5986 of each VM.
2. Disable UAC remote restrictions .
3. Specify the credentials for the task to access the VMs using an administrator-level
login in the simple form username without any domain part.
4. Install a certificate on the machine that runs the automation agent.
5. If you are using a self-signed certificate, set the Test Certificate parameter of the
task.
While using an Azure Resource Manager service connection type, the task
automatically filters appropriate newer Azure Resource Manager storage accounts,
and other fields. For example, the Resource Group or cloud service, and the VMs.
1. Use the Azure portal to create a new user account in Azure Active Directory.
2. Add the Azure Active Directory user account to the co-administrators group in
your Azure subscription.
3. Sign into the Azure portal with this user account and change the password.
4. Use the credentials of this account in the service connection. Deployments are
then processed using this account.
If the task fails, will the copy resume?
Since AzCopy V10 does not support journal files, the task cannot resume the copy. You
must run the task again to copy all the files.
Are the log files and plan files cleaned after the copy?
The log and plan files are not deleted by the task. To explicitly clean-up the files, add a
CLI step in the workflow using azcopy jobs clean.
1. Add a build step using Azure CLI to identify the IP address of the Microsoft Hosted
Build agent at runtime. It will add the IP address to the Network rule on the Azure
Storage Account.
2. Run the build step for your Azure Storage Account.
3. Add another build step using Azure CLI to remove the IP address of the build
agent from the Azure Storage Account network rule.
Requirements
ノ Expand table
Requirement Description
Demands Self-hosted agents must have capabilities that match the following demands
to run jobs that use this task: azureps
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Command Any
restrictions
Feedback
Was this page helpful? Yes No
7 Note
This task does not support Azure Resource Manager authentication with workflow
identity federation.
Syntax
YAML
Inputs
SourcePath - Source
string . Required.
The location of source files. Supported values include YAML Pipelines and Classic
Release support predefined system variables like Build.Repository.LocalPath.
Release variables are supported only in classic releases. The wild card symbol (*) is
supported anywhere in the file path or file name.
Specify the name of an Azure Resource Manager service connection configured for the
subscription where the target Azure service, virtual machine, or storage account is
located. See Azure Resource Manager overview for more details.
Specify a pre-existing ARM storage account. This is the storage account used as an
intermediary for copying files to Azure VMs.
ContainerName - Container Name
string . Required when Destination = AzureBlob .
The name of the container into which files are copied. If the specified container does not
exist in the storage account, it will be created.
To create a virtual directory inside the container, use the blob prefix input. For example,
for the target location https://myaccount.blob.core.windows.net/mycontainer/vd1/vd2/ ,
specify container name mycontainer and blob prefix: vd1/vd2 .
Specify a prefix for the destination virtual directory within the Azure Blob container. This
applies when the SourcePath contains a wildcard that may match multiple items.
Example: You can append a build number to prefix the files from all blobs with the same
build number.
Example: If you specify a blob prefix myvd1 , a virtual directory is created inside the
container. Files are copied from the source to
https://myaccount.blob.core.windows.net/mycontainer/myvd1/ .
In the case that the SourcePath is a single item with no wildcard, this blob prefix will
function as the destination blob name.
Specify the name of the target Resource Group into which the files will be copied.
Specify a VM host name or tag that identifies a subset of VMs in a resource group. Tags
are supported for resources created via the Azure Resource Manager only.
Provide the user name of an account with administrative permissions on all of the target
VMs.
vmsAdminPassword - Password
string . Required when Destination = AzureVMs .
To find the variable, locate the Admin Login parameter. Select the padlock icon for a
variable defined in the Variables tab to protect the value and insert the variable name
here.
Specify the path to the folder in the Azure VMs into which files will be copied.
Provide additional arguments to AzCopy.exe for use when uploading to the Blob and
downloading to the VMs. See Transfer data with the AzCopy Command-Line Utility for
details.
For Premium storage accounts that support only Azure page Blobs use --blob-
type=PageBlob as an additional argument.
Default arguments include --log-level=INFO (default) and --recursive (if the container
name is not $root ).
--log-level=INFO
--log-level=DEBUG (If the pipeline is running in debug mode set)
--recursive
Specify the time in minutes after which the SAS token for the container will expire. By
default, this token expires after 4 hours.
When enabled, this option uses a self-signed certificate to configure the Windows
Remote Management (WinRM) listener over the HTTPS protocol on port 5986. This
configuration is required for performing copy operations on Azure VMs. Applicable only
for ARM VMs.
If the target VMs are accessed through a load balancer, configure an inbound NAT
rule to allow access on port 5986.
If the target VMs are associated with a Network Security Group (NSG), configure an
inbound security rule to allow access on port 5986.
WinRM requires a certificate for the HTTPS transfer when copying files from the
intermediate storage Blob into the Azure VMs.
If you use a self-signed certificate, specify true to prevent the process from validating
the certificate with a trusted CA.
Output variables
This task defines the following output variables, which you can consume in downstream
steps, jobs, and stages.
StorageContainerUri
Uri of the container where the files were copied to. Valid only when the selected
destination is Azure Blob.
StorageContainerSasToken
SasToken for the container where the files were copied to. Valid only when the selected
destination is Azure Blob.
Remarks
AzureFileCopy@5 supports AzCopy.exe version 10.12.2.
7 Note
You might block the use of storage account keys and SAS tokens on your storage
accounts. In these situations the AzureFileCopy@5 task, which relies on SAS
tokens, can't be used.
The AzureFileCopy@6 task uses Azure RBAC to access blob storage instead. This
requires the identity of the service connection used to have the appropriate RBAC
role e.g. Storage Blob Data Contributor. See Assign an Azure role for access to
blob data.
The AzureFileCopy@6 task also supports service connections that use workload
identity federation .
7 Note
This task is written in PowerShell and works only when run on Windows agents. If
your pipelines require Linux agents and need to copy files to an Azure Storage
Account, consider running az storage blob commands in the Azure CLI task as an
alternative.
The task is used to copy application files and other artifacts that are required in order to
install the app; such as PowerShell scripts, PowerShell-DSC modules, and more.
When the target is Azure VMs, the files are first copied to an automatically generated
Azure blob container and then downloaded into the VMs. The container is deleted after
the files are successfully copied to the VMs.
The task uses AzCopy, the command-line utility built for fast copying data from and to
Azure storage accounts. Version 5 of the Azure File Copy task uses AzCopy V10.
Azure File Copy version 3 and lower would retrieve the Azure Storage key to provide
access. Azure File Copy version 4 and higher require Azure Storage to be authorized via
Microsoft Entra ID or SAS token. Authentication using a service principal and managed
identity are available. For managed identities, only system-wide managed identity is
supported. The level of authorization required is shown in Option 1: Use Microsoft Entra
ID.
To dynamically deploy Azure Resource Groups that contain virtual machines, use the
Azure Resource Group Deployment task. This task has a sample template that can
perform the required operations to set up the WinRM HTTPS protocol on the VMs, open
port 5986 in the firewall, and install the test certificate.
7 Note
If you are deploying to Azure Static Websites as a container in Blob storage, use
Version 2 or higher of the task in order to preserve the $web container name.
1. Configure an inbound access rule to allow HTTPS on port 5986 of each VM.
2. Disable UAC remote restrictions .
3. Specify the credentials for the task to access the VMs using an administrator-level
login in the simple form username without any domain part.
4. Install a certificate on the machine that runs the automation agent.
5. If you are using a self-signed certificate, set the Test Certificate parameter of the
task.
What type of service connection should I choose?
For Azure Resource Manager storage accounts and Azure Resource Manager VMs,
use an Azure Resource Manager service connection type. See Automating Azure
Resource Group deployment using a Service Principal .
While using an Azure Resource Manager service connection type, the task
automatically filters appropriate newer Azure Resource Manager storage accounts,
and other fields. For example, the Resource Group or cloud service, and the VMs.
1. Use the Azure portal to create a new user account in Azure Active Directory.
2. Add the Azure Active Directory user account to the co-administrators group in
your Azure subscription.
3. Sign into the Azure portal with this user account and change the password.
4. Use the credentials of this account in the service connection. Deployments are
then processed using this account.
Are the log files and plan files cleaned after the copy?
The log and plan files are not deleted by the task. To explicitly clean-up the files, add a
CLI step in the workflow using azcopy jobs clean.
1. Add a build step using Azure CLI to identify the IP address of the Microsoft Hosted
Build agent at runtime. It will add the IP address to the Network rule on the Azure
Storage Account.
2. Run the build step for your Azure Storage Account.
3. Add another build step using Azure CLI to remove the IP address of the build
agent from the Azure Storage Account network rule.
Examples
yml
trigger:
- main
pool:
vmImage: windows-latest
steps:
- task: AzureFileCopy@5
inputs:
SourcePath: 'Readme.md'
azureSubscription: 'MyAzureSubscription'
Destination: 'AzureBlob'
storage: 'MyStorage'
ContainerName: 'MyContainerName'
name: AzureFileCopy
- script: |
echo $(AzureFileCopy.StorageContainerUri)
echo $(AzureFileCopy.StorageContainerSasToken)
Requirements
ノ Expand table
Requirement Description
Demands Self-hosted agents must have capabilities that match the following demands
to run jobs that use this task: azureps
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Command Any
restrictions
Feedback
Was this page helpful? Yes No
7 Note
This task does not support Azure Resource Manager authentication with workflow
identity federation.
Syntax
YAML
Inputs
SourcePath - Source
string . Required.
The location of source files. Supported values include YAML Pipelines and Classic
Release support predefined system variables like Build.Repository.LocalPath.
Release variables are supported only in classic releases. The wild card symbol (*) is
supported anywhere in the file path or file name.
Specify the name of an Azure Resource Manager service connection configured for the
subscription where the target Azure service, virtual machine, or storage account is
located. See Azure Resource Manager overview for more details.
Specify a pre-existing ARM storage account. This is the storage account used as an
intermediary for copying files to Azure VMs.
ContainerName - Container Name
string . Required when Destination = AzureBlob .
The name of the container into which files are copied. If the specified container does not
exist in the storage account, it will be created.
To create a virtual directory inside the container, use the blob prefix input. For example,
for the target location https://myaccount.blob.core.windows.net/mycontainer/vd1/vd2/ ,
specify container name mycontainer and blob prefix: vd1/vd2 .
Example: You can append a build number to filter the files from all blobs with the same
build number.
Example: If you specify a blob prefix myvd1 , a virtual directory is created inside the
container. Files are copied from the source to
https://myaccount.blob.core.windows.net/mycontainer/myvd1/ .
Specify the name of the target Resource Group into which the files will be copied.
Specify a VM host name or tag that identifies a subset of VMs in a resource group. Tags
are supported for resources created via the Azure Resource Manager only.
Provide a list of VM names or tag names that identify the VMs the task will target. Valid
filter criteria includes:
The name of an Azure Resource Group.
An output variable from a previous task.
A comma-delimited list of tag names or VM names.
Format VM names using a comma-separated list of FQDNs or IP addresses.
Format tag names for a filter as {TagName}:{Value} Example: Role:DB;OS:Win8.1
Provide the user name of an account with administrative permissions on all of the target
VMs.
vmsAdminPassword - Password
string . Required when Destination = AzureVMs .
To find the variable, locate the Admin Login parameter. Select the padlock icon for a
variable defined in the Variables tab to protect the value and insert the variable name
here.
Specify the path to the folder in the Azure VMs into which files will be copied.
string .
Provide additional arguments to AzCopy.exe for use when uploading to the Blob and
downloading to the VMs. See Transfer data with the AzCopy Command-Line Utility for
details.
For Premium storage accounts that support only Azure page Blobs use --blob-
type=PageBlob as an additional argument.
Default arguments include --log-level=INFO (default) and --recursive (if the container
name is not $root ).
--log-level=INFO
--recursive
Specify the time in minutes after which the SAS token for the container will expire. By
default, this token expires after 4 hours.
When enabled, this option uses a self-signed certificate to configure the Windows
Remote Management (WinRM) listener over the HTTPS protocol on port 5986. This
configuration is required for performing copy operations on Azure VMs.
If the target VMs are accessed through a load balancer, configure an inbound NAT
rule to allow access on port 5986.
If the target VMs are associated with a Network Security Group (NSG), configure an
inbound security rule to allow access on port 5986.
CopyFilesInParallel - Copy in Parallel
WinRM requires a certificate for the HTTPS transfer when copying files from the
intermediate storage Blob into the Azure VMs.
If you use a self-signed certificate, specify true to prevent the process from validating
the certificate with a trusted CA.
Output variables
This task defines the following output variables, which you can consume in downstream
steps, jobs, and stages.
StorageContainerUri
URI of the container to which the files were copied. Valid only when the selected
destination is an Azure Blob.
StorageContainerSasToken
SasToken for the container to which the files were copied. Valid only when the selected
destination is an Azure Blob.
Remarks
AzureFileCopy@4 supports AzCopy.exe version 10.8.0.
7 Note
This task is written in PowerShell and works only when run on Windows agents. If
your pipelines require Linux agents and need to copy files to an Azure Storage
Account, consider running az storage blob commands in the Azure CLI task as an
alternative.
The task is used to copy application files and other artifacts that are required in order to
install the app; such as PowerShell scripts, PowerShell-DSC modules, and more.
When the target is Azure VMs, the files are first copied to an automatically generated
Azure blob container and then downloaded into the VMs. The container is deleted after
the files are successfully copied to the VMs.
The task uses AzCopy, the command-line utility built for fast copying data from and to
Azure storage accounts. Version 4 of the Azure File Copy task uses AzCopy V10.
Azure File Copy version 3 and lower would retrieve the Azure Storage key to provide
access. Azure File Copy version 4 and higher require Azure Storage to be authorized via
Microsoft Entra ID or SAS token. Authentication using a service principal and managed
identity are available. For managed identities, only system-wide managed identity is
supported. The level of authorization required is shown in Option 1: Use Microsoft Entra
ID.
To dynamically deploy Azure Resource Groups that contain virtual machines, use the
Azure Resource Group Deployment task. This task has a sample template that can
perform the required operations to set up the WinRM HTTPS protocol on the VMs, open
port 5986 in the firewall, and install the test certificate.
7 Note
If you are deploying to Azure Static Websites as a container in Blob storage, use
Version 2 or higher of the task in order to preserve the $web container name.
The task supports authentication based on Azure Active Directory. Authentication using
a service principal and managed identity are available. For managed identities, only
system-wide managed identity is supported.
What are the Azure PowerShell prerequisites for using
this task?
The task requires that Azure PowerShell is installed on the machine running the
automation agent. The recommended version is 1.0.2, but the task will work with version
0.9.8 and higher. You can use the Azure PowerShell Installer v1.0.2 to obtain this.
1. Configure an inbound access rule to allow HTTPS on port 5986 of each VM.
2. Disable UAC remote restrictions .
3. Specify the credentials for the task to access the VMs using an administrator-level
login in the simple form username without any domain part.
4. Install a certificate on the machine that runs the automation agent.
5. If you are using a self-signed certificate, set the Test Certificate parameter of the
task.
While using an Azure Resource Manager service connection type, the task
automatically filters appropriate newer Azure Resource Manager storage accounts,
and other fields. For example, the Resource Group or cloud service, and the VMs.
Are the log files and plan files cleaned after the copy?
The log and plan files are not deleted by the task. To explicitly clean-up the files, add a
CLI step in the workflow using azcopy jobs clean.
1. Add a build step using Azure CLI to identify the IP address of the Microsoft Hosted
Build agent at runtime. It will add the IP address to the Network rule on the Azure
Storage Account.
2. Run the build step for your Azure Storage Account.
3. Add another build step using Azure CLI to remove the IP address of the build
agent from the Azure Storage Account network rule.
Examples
yml
- task: AzureFileCopy@4
inputs:
SourcePath: 'Readme.md'
azureSubscription: 'Azure'
Destination: 'AzureBlob'
storage: 'storageAccount'
ContainerName: 'containerName'
BlobPrefix: ''
name: AzureFileCopy
- script: |
echo $(AzureFileCopy.StorageContainerUri)
echo $(AzureFileCopy.StorageContainerSasToken)
Requirements
ノ Expand table
Requirement Description
Demands Self-hosted agents must have capabilities that match the following demands
to run jobs that use this task: azureps
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Command Any
restrictions
Feedback
Was this page helpful? Yes No
Provide product feedback
AzureFileCopy@3 - Azure file copy v3
task
Article • 04/29/2024
7 Note
This task does not support Azure Resource Manager authentication with workflow
identity federation.
Syntax
YAML
Inputs
SourcePath - Source
string . Required.
Specify the absolute path of the source folder, or file on the local machine, or a UNC
share. You can use pre-defined system variables such as $(Build.Repository.LocalPath) .
Names containing wildcards such as *.zip are not supported. The value or expression
you specify should return a single folder or a file name.
Specify the name of an Azure Resource Manager service connection configured for the
subscription where the target Azure service, virtual machine, or storage account is
located. See Azure Resource Manager overview for more details.
Specify a pre-existing ARM storage account. This is the storage account used as an
intermediary for copying files to Azure VMs.
ContainerName - Container Name
string . Required when Destination = AzureBlob .
The name of the container into which files are copied. If the specified container does not
exist in the storage account, it will be created.
To create a virtual directory inside the container, use the blob prefix input. For example,
for the target location https://myaccount.blob.core.windows.net/mycontainer/vd1/vd2/ ,
specify container name mycontainer and blob prefix: vd1/vd2 .
Example: You can append a build number to filter the files from all blobs with the same
build number.
Example: If you specify a blob prefix myvd1 , a virtual directory is created inside the
container. Files are copied from the source to
https://myaccount.blob.core.windows.net/mycontainer/myvd1/ .
Specify the name of the target Resource Group into which files will be copied.
Specify a VM host name or tag that identifies a subset of VMs in a resource group. Tags
are supported for resources created via the Azure Resource Manager only.
Provide a list of VM names or tag names that identify the VMs the task will target. Valid
filter criteria includes:
The name of an Azure Resource Group.
An output variable from a previous task.
A comma-delimited list of tag names or VM names.
Format VM names using a comma-separated list of FQDNs or IP addresses.
Format tag names for a filter as {TagName}:{Value} . Example: Role:DB;OS:Win8.1 ,
ffweb , ffdb , or tags like Role:DB , Web , OS:Win8.1 .
Note: Valid delimiters for tags include ,(comma), :(colon) and ;(semicolon). When
providing multiple tags, the task will run only in the VMs that contain the specified tags.
By default, the task runs in all VMs.
Provide the user name of an account with administrative permissions on all of the target
VMs.
vmsAdminPassword - Password
Specify the path to the folder in the Azure VMs into which files will be copied.
If no optional arguments are specified, the following arguments are added by default.
/Y
/SetContentType
/Z
/V
optional arguments.
/Y
/S
/Z
/V
Specify true to copy files in parallel to the target VMs. Using this value can reduce the
overall time taken to perform the action.
Setting this value to true cleans the destination folder before performing the copy
action.
The default value will not validate if the server certificate was signed by a trusted CA
before connecting over HTTPS.
string .
Specify the name of the variable used for the storage container URI to which files were
copied. Valid only when the selected destination is an Azure Blob.
string .
Specify the name of the variable used for the storage container SAS token that accesses
the files that were copied. Use this variable as an input to subsequent tasks. By default,
the SAS token expires after 4 hours.
Specify the time in minutes after which the SAS token will expire. Valid only when the
selected destination is Azure Blob.
Task control options
All tasks have control options in addition to their task inputs. For more information, see
Control options and common task properties.
Output variables
None.
Remarks
What's new in Version AzureFileCopy@3
The task is used to copy application files and other artifacts that are required to
install the app such as PowerShell scripts, PowerShell-DSC modules, and more.
When the target is Azure VMs, the files are first copied to an automatically
generated Azure Blob container and then downloaded into the VMs. The container
is deleted after the files are successfully copied to the VMs.
The task uses AzCopy, the command-line utility built to quickly copy of data from
and into Azure storage accounts. The task version 3 or below uses AzCopy V7.
To dynamically deploy Azure Resource Groups that contain virtual machines, use
the Azure Resource Group Deployment task. This task has a sample template that
can perform the required operations to set up the WinRM HTTPS protocol on VMs,
open port 5986 in the firewall, and install the test certificate.
7 Note
FAQ
What are the Azure PowerShell prerequisites for using this task?
The task requires that Azure PowerShell is installed on the machine running the
automation agent. The recommended version is 1.0.2, but the task works with version
0.9.8 and higher. Use Azure PowerShell Installer v1.0.2 to get the recommended
version.
The task uses the WinRM HTTPS protocol to copy the files from the storage Blob
container to the Azure VMs. The WinRM HTTPS service must be configured on the VMs,
and a suitable certificate installed.
If the VMs are created without opening the WinRM HTTPS ports, follow these steps:
1. Configure an inbound access rule to allow HTTPS on port 5986 of each VM.
2. Disable UAC remote restrictions .
3. Specify the credentials for the task to access the VMs using an administrator-level
login formatted as username without any domain reference.
4. Install a certificate on the machine that runs the automation agent.
5. Set the Test Certificate parameter of the task for a self-signed certificate.
ノ Expand table
For Azure classic resources, use an Azure service connection type with certificate or
credentials-based authentication. If you're using credentials-based authentication,
ensure that the credentials are for a school or work account . Microsoft accounts
such as [email protected] and [email protected] are not supported.
For Azure Resource Manager VMs, use an Azure Resource Manager service
connection type. For more details, see Automating Azure Resource Group
deployment using a Service Principal .
7 Note
Copy the app identity from the existing inherited entry as Contributor that you'll see in
the IAM pane and search explicitly for it in the Add role assignment UI. The identity is
not listed in the dropdown, you must search for its identifier.
1. Use the Azure portal to create a new user account in Azure Active Directory.
2. Add the Azure Active Directory user account to the co-administrators group in
your Azure subscription.
3. Sign into the Azure portal with this user account and change the password.
4. Use the new credentials for this account in the service connection. Deployments
will be processed using this account.
Examples
yml
Requirements
ノ Expand table
Requirement Description
Demands Self-hosted agents must have capabilities that match the following demands
to run jobs that use this task: azureps
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Requirement Description
Command Any
restrictions
Feedback
Was this page helpful? Yes No
7 Note
This task does not support Azure Resource Manager authentication with workflow
identity federation.
Syntax
# Azure file copy v2
# Copy files to Azure Blob Storage or virtual machines.
- task: AzureFileCopy@2
inputs:
SourcePath: # string. Required. Source.
#azureConnectionType: 'ConnectedServiceNameARM' # 'ConnectedServiceName'
| 'ConnectedServiceNameARM'. Alias: ConnectedServiceNameSelector. Azure
Connection Type. Default: ConnectedServiceNameARM.
#azureClassicSubscription: # string. Alias: ConnectedServiceName.
Required when ConnectedServiceNameSelector = ConnectedServiceName. Azure
Classic Subscription.
azureSubscription: # string. Alias: ConnectedServiceNameARM. Required
when ConnectedServiceNameSelector = ConnectedServiceNameARM. Azure
Subscription.
Destination: # 'AzureBlob' | 'AzureVMs'. Required. Destination Type.
#classicStorage: # string. Alias: StorageAccount. Required when
ConnectedServiceNameSelector = ConnectedServiceName. Classic Storage
Account.
storage: # string. Alias: StorageAccountRM. Required when
ConnectedServiceNameSelector = ConnectedServiceNameARM. RM Storage Account.
#ContainerName: # string. Required when Destination = AzureBlob.
Container Name.
#BlobPrefix: # string. Optional. Use when Destination = AzureBlob. Blob
Prefix.
#cloudService: # string. Alias: EnvironmentName. Required when
ConnectedServiceNameSelector = ConnectedServiceName && Destination =
AzureVMs. Cloud Service.
#resourceGroup: # string. Alias: EnvironmentNameRM. Required when
ConnectedServiceNameSelector = ConnectedServiceNameARM && Destination =
AzureVMs. Resource Group.
#ResourceFilteringMethod: 'machineNames' # 'machineNames' | 'tags'.
Optional. Use when Destination = AzureVMs. Select Machines By. Default:
machineNames.
#MachineNames: # string. Optional. Use when Destination = AzureVMs.
Filter Criteria.
#vmsAdminUserName: # string. Required when Destination = AzureVMs. Admin
Login.
#vmsAdminPassword: # string. Required when Destination = AzureVMs.
Password.
#TargetPath: # string. Required when Destination = AzureVMs. Destination
Folder.
#AdditionalArgumentsForBlobCopy: # string. Optional Arguments (for
uploading files to blob).
#AdditionalArgumentsForVMCopy: # string. Optional. Use when Destination
= AzureVMs. Optional Arguments (for downloading files to VM).
#enableCopyPrerequisites: false # boolean. Optional. Use when
ConnectedServiceNameSelector = ConnectedServiceNameARM && Destination =
AzureVMs. Enable Copy Prerequisites. Default: false.
#CopyFilesInParallel: true # boolean. Optional. Use when Destination =
AzureVMs. Copy in Parallel. Default: true.
#CleanTargetBeforeCopy: false # boolean. Optional. Use when Destination
= AzureVMs. Clean Target. Default: false.
#skipCACheck: true # boolean. Optional. Use when Destination = AzureVMs.
Test Certificate. Default: true.
# Output
#outputStorageUri: # string. Storage Container URI.
#outputStorageContainerSasToken: # string. Storage Container SAS Token.
Inputs
SourcePath - Source
string . Required.
Specify the absolute path to the source folder, file on the local machine, or a UNC share.
The specified value or expression should return either a single folder name or a file
name.
Specify a pre-existing classic storage account. This is the storage account used as an
intermediary for copying files to Azure VMs.
Specify a pre-existing ARM storage account. This is the storage account used as an
intermediary for copying files to Azure VMs.
Specify the name of the container into which files are copied. If the specified container
does not exist in the storage account, it will be created.
To create a virtual directory inside the container, use the Blob prefix input. For example,
for target location https://myaccount.blob.core.windows.net/mycontainer/vd1/vd2/ ,
specify the container name mycontainer and Blob prefix vd1/vd2 .
BlobPrefix - Blob Prefix
string . Optional. Use when Destination = AzureBlob .
Example: You can append a build number to filter the files from all Blobs with the same
build number.
Example: If you specify a Blob prefix myvd1 , a virtual directory is created inside the
container. Files are copied from the source to
https://myaccount.blob.core.windows.net/mycontainer/myvd1/ .
Specify the VM host name or tag that identifies a subset of VMs in a resource group.
Tags are supported for resources created via the Azure Resource Manager only.
Provide a list of Azure VM host names such as ffweb , ffdb , or tags such as Role:DB ,
Web , OS:Win8.1 .
Note: Valid delimiters for tags include ,(comma), :(colon) and ;(semicolon). When
providing multiple tags, the task will run in all the VMs that contains the specified tags.
By default, the task runs in all the VMs.
vmsAdminUserName - Admin Login
vmsAdminPassword - Password
string . Required when Destination = AzureVMs .
string .
If no optional arguments are specified, the following arguments are added by default.
/Y
/SetContentType
/Z
/V
/S - Added when the container name is not $root .
/Pattern - Added when the source path is a file. Included with any other specified
optional arguments.
AdditionalArgumentsForVMCopy - Optional Arguments (for downloading files to VM)
string . Optional. Use when Destination = AzureVMs .
/Y
/S
/Z
/V
Accepting the default setting copies files in parallel to the target VMs.
Setting this value to true cleans the destination folder before performing the copy
action.
The default value will not validate that the server certificate was signed by a trusted CA
before connecting over HTTPS.
outputStorageUri - Storage Container URI
string .
Specify the name of the variable used for the storage container URI to which files were
copied. Valid only when the selected destination is an Azure Blob.
Specify the name of the variable used for the storage container SAS token that accesses
the files that were copied. Valid only when the selected destination is an Azure Blob.
Output variables
None.
Remarks
What's new in Version 2.0: Using newer version of AzCopy.
Requirements
ノ Expand table
Requirement Description
Demands Self-hosted agents must have capabilities that match the following demands
to run jobs that use this task: azureps
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Requirement Description
Command Any
restrictions
Feedback
Was this page helpful? Yes No
7 Note
This task does not support Azure Resource Manager authentication with workflow
identity federation.
Syntax
# Azure file copy v1
# Copy files to Azure Blob Storage or virtual machines.
- task: AzureFileCopy@1
inputs:
SourcePath: # string. Required. Source.
#azureConnectionType: 'ConnectedServiceNameARM' # 'ConnectedServiceName'
| 'ConnectedServiceNameARM'. Alias: ConnectedServiceNameSelector. Azure
Connection Type. Default: ConnectedServiceNameARM.
#azureClassicSubscription: # string. Alias: ConnectedServiceName.
Required when ConnectedServiceNameSelector = ConnectedServiceName. Azure
Classic Subscription.
azureSubscription: # string. Alias: ConnectedServiceNameARM. Required
when ConnectedServiceNameSelector = ConnectedServiceNameARM. Azure
Subscription.
Destination: # 'AzureBlob' | 'AzureVMs'. Required. Destination Type.
#classicStorage: # string. Alias: StorageAccount. Required when
ConnectedServiceNameSelector = ConnectedServiceName. Classic Storage
Account.
storage: # string. Alias: StorageAccountRM. Required when
ConnectedServiceNameSelector = ConnectedServiceNameARM. RM Storage Account.
#ContainerName: # string. Required when Destination = AzureBlob.
Container Name.
#BlobPrefix: # string. Optional. Use when Destination = AzureBlob. Blob
Prefix.
#cloudService: # string. Alias: EnvironmentName. Required when
ConnectedServiceNameSelector = ConnectedServiceName && Destination =
AzureVMs. Cloud Service.
#resourceGroup: # string. Alias: EnvironmentNameRM. Required when
ConnectedServiceNameSelector = ConnectedServiceNameARM && Destination =
AzureVMs. Resource Group.
#ResourceFilteringMethod: 'machineNames' # 'machineNames' | 'tags'.
Optional. Use when Destination = AzureVMs. Select Machines By. Default:
machineNames.
#MachineNames: # string. Optional. Use when Destination = AzureVMs.
Filter Criteria.
#vmsAdminUserName: # string. Required when Destination = AzureVMs. Admin
Login.
#vmsAdminPassword: # string. Required when Destination = AzureVMs.
Password.
#TargetPath: # string. Required when Destination = AzureVMs. Destination
Folder.
#AdditionalArguments: # string. Additional Arguments.
#enableCopyPrerequisites: false # boolean. Optional. Use when
ConnectedServiceNameSelector = ConnectedServiceNameARM && Destination =
AzureVMs. Enable Copy Prerequisites. Default: false.
#CopyFilesInParallel: true # boolean. Optional. Use when Destination =
AzureVMs. Copy in Parallel. Default: true.
#CleanTargetBeforeCopy: false # boolean. Optional. Use when Destination
= AzureVMs. Clean Target. Default: false.
#skipCACheck: true # boolean. Optional. Use when Destination = AzureVMs.
Test Certificate. Default: true.
# Output
#outputStorageUri: # string. Storage Container URI.
#outputStorageContainerSasToken: # string. Storage Container SAS Token.
Inputs
SourcePath - Source
string . Required.
Specify the absolute path of the source folder, file on the local machine, or a UNC share.
The specified value or expression should return either a single folder name or a file
name.
Specify a pre-existing classic storage account. This is the storage account used as an
intermediary for copying files to Azure VMs.
Specify a pre-existing ARM storage account. This is the storage account used as an
intermediary for copying files to Azure VMs.
Specify the name of the container into which files are copied. If the specified container
does not exist in the storage account, it will be created.
To create a virtual directory inside the container use the Blob prefix input.
Example: You can append a build number to filter the files from all Blobs with the same
build number.
Example: If you specify a Blob prefix myvd1 , a virtual directory is created inside the
container. Files are copied from the source to
https://myaccount.blob.core.windows.net/mycontainer/myvd1/ .
Specify a VM host name or tag that identifies a subset of VMs in a resource group. Tags
are supported for resources created via the Azure Resource Manager only.
Provide a list of Azure VM host names such as ffweb , ffdb , or tags such as Role:DB ,
Web , OS:Win8.1 .
Note: Valid delimiters for tags include ,(comma), :(colon) and ;(semicolon). When
providing multiple tags, the task will run only in the VMs that contain the specified tags.
By default, the task runs in all VMs.
vmsAdminUserName - Admin Login
string . Required when Destination = AzureVMs .
vmsAdminPassword - Password
Specify the local path on the target VMs for copying files from the source.
Accepting the default setting copies files in parallel to the target VMs.
CleanTargetBeforeCopy - Clean Target
Setting to true cleans the destination folder before performing the copy action.
The default value will not validate if the server certificate was signed by a trusted CA
before connecting over HTTPS.
Specify the name of the variable used for the storage container URI to which files were
copied. Valid only when the selected destination is an Azure Blob.
Specify the name of the variable used for the storage container SAS token that accesses
the files that were copied. Valid only when the selected destination is an Azure Blob.
Output variables
None.
Requirements
ノ Expand table
Requirement Description
Demands Self-hosted agents must have capabilities that match the following demands
to run jobs that use this task: azureps
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Command Any
restrictions
Feedback
Was this page helpful? Yes No
Syntax
# Azure Function on Kubernetes v1
# Deploy Azure function to Kubernetes cluster.
- task: AzureFunctionOnKubernetes@1
inputs:
# Service Connections
connectionType: 'Kubernetes Service Connection' # 'Azure Resource
Manager' | 'Kubernetes Service Connection'. Required. Service connection
type. Default: Kubernetes Service Connection.
dockerRegistryServiceConnection: # string. Required. Docker registry
service connection.
#kubernetesServiceConnection: # string. Alias:
kubernetesServiceEndpoint. Required when connectionType = Kubernetes Service
Connection. Kubernetes service connection.
#azureSubscriptionConnection: # string. Alias:
azureSubscriptionEndpoint. Required when connectionType = Azure Resource
Manager. Azure subscription.
#azureResourceGroup: # string. Required when connectionType = Azure
Resource Manager. Resource group.
#kubernetesCluster: # string. Required when connectionType = Azure
Resource Manager. Kubernetes cluster.
# Commands
#namespace: # string. Kubernetes namespace.
#secretName: # string. Secret Name.
#dockerHubNamespace: # string. Docker Hub namespace.
appName: # string. Required. Application Name.
#functionRootDirectory: # string. Function root directory.
#waitForStability: true # boolean. Wait for stability. Default: true.
#arguments: # string. Arguments.
Inputs
connectionType - Service connection type
string . Required. Allowed values: Azure Resource Manager , Kubernetes Service
Service Account, or import an AKS instance with the Azure Subscription option.
Importing an AKS instance with the Azure Subscription option requires Kubernetes
cluster access at Service Connection configuration time.
Azure Resource Manager - Lets you select an AKS instance. Does not access
string . Required.
Select the Azure Resource Manager subscription, which contains Azure Container
Registry.Note: To configure new service connection, select the Azure subscription from
the list and click 'Authorize'. If your subscription is not listed or if you want to use an
existing Service Principal, you can setup an Azure service connection using 'Add' or
'Manage' button.
string .
Kubernetes namespace.
Kubernetes secret containing function config data (for ex. AzureWebJobsStorage: Azure
storage connection string ).
string . Required.
Application Name. The Kubernetes objects created use this name. This should follow
Kubernetes naming conventions for resource names.
string .
Function root directory. Should contain host.json. Docker build and push is performed
from this directory.
arguments - Arguments
string .
Pass arguments to command. Ex:
--no-docker --service-type NodePort.
Output variables
None.
Remarks
You can create a Kubernetes service connection with any of the following options.
KubeConfig
Service Account
Azure Subscription
Starting with Kubernetes 1.24, long-lived tokens are no longer created by default .
Kubernetes recommends not using long-lived tokens. As a result, tasks using a
Kubernetes service connection created with the Azure Subscription option don't have
access to the permanent token required to authenticate and can’t access your
Kubernetes cluster. This also results in the frozen Loading namespaces dialog.
Access to a (private) AKS cluster can be performed from a self-hosted or scale set
agent with line of sight to the cluster.
A token is created for every task that uses an Azure Resource Manager service
connection. This ensures you are connecting to Kubernetes with a short-lived
token, which is the Kubernetes recommendation .
AKS can be accessed even when local accounts are disabled.
I receive the following error message: Could not find any secret
associated with the service account. What is happening?
You are using the Kubernetes service connection with Azure Subscription option. We are
updating this method to create long-lived tokens. This is expected to be available mid-
May. However, it is recommended to start using the Azure service connection type and
not o use long-lived tokens as per Kubernetes guidance .
I'm using AKS and don't want to change anything, can I continue
to use tasks with the Kubernetes service connection?
Our Kubernetes tasks work with any Kubernetes cluster, regardless where they are
running. The Kubernetes service connection will continue to exist.
There is no need to change anything. If you are using the Kubernetes service connection
and selected Azure Subscription during creation, you should be aware of the Kubernetes
guidance on using long-lived tokens .
In case you can’t access your AKS during environment creation time, you can use an
empty environment and set the connectionType input to an Azure Resource Manager
service connection.
Requirements
ノ Expand table
Requirement Description
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Feedback
Was this page helpful? Yes No
Syntax
# Azure Function on Kubernetes v0
# Deploy Azure function to Kubernetes cluster.
- task: AzureFunctionOnKubernetes@0
inputs:
# Service Connections
dockerRegistryServiceConnection: # string. Required. Docker registry
service connection.
kubernetesServiceConnection: # string. Required. Kubernetes service
connection.
# Commands
#namespace: # string. Kubernetes namespace.
#secretName: # string. Secret Name.
#dockerHubNamespace: # string. Docker Hub namespace.
appName: # string. Required. Application Name.
#functionRootDirectory: # string. Function root directory.
#waitForStability: true # boolean. Wait for stability. Default: true.
#arguments: # string. Arguments.
Inputs
dockerRegistryServiceConnection - Docker registry service connection
string . Required.
string . Required.
Kubernetes secret containing function config data (for ex. AzureWebJobsStorage: Azure
storage connection string ).
string . Required.
Application Name. The Kubernetes objects created use this name. This should follow
Kubernetes naming conventions for resource names.
string .
Function root directory. Should contain host.json. Docker build and push is performed
from this directory.
arguments - Arguments
string .
Output variables
None.
Remarks
7 Note
There is a newer version of this task available that provides additional support for
targetting a Kubernetes cluster in different ways, using the connectionType
property. For more information, see AzureFunctionOnKubernetes@1 and
AzureFunctionOnKubernetes@1 remarks
Requirements
ノ Expand table
Requirement Description
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Feedback
Was this page helpful? Yes No
Update a function app with .NET, Python, JavaScript, PowerShell, Java based web
applications.
Syntax
YAML
Inputs
connectedServiceNameARM - Azure Resource Manager connection
Specify the name of an existing Azure Functions App. The Function Apps listed will be
based on the selected app type.
Deploys to an existing deployment slot or Azure App Service Environment. For both
targets, the task needs a Resource group name.
If the deployment target is a slot, it will default to the production slot. Any other
existing slot name can also be provided.
If the deployment target is an Azure App Service Environment, leave the slot name as
production and specify the Resource group name.
The Resource group name is required when the deployment target is either a
deployment slot or an App Service Environment.
Enters or selects the Azure Resource group that contains the Azure App Service
specified above.
slotName - Slot
The file path to the package or folder that contains App Service content generated by
MSBuild or a compressed zip file. Variables ( Build | Release) and wildcards are
supported. For example, $(System.DefaultWorkingDirectory)/**/*.zip .
PYTHON|3.10 , PYTHON|3.11 .
Specify the framework and version your function app will run on. You can use any of the
supported runtime versions. Old values like DOCKER|microsoft/azure-functions-* are
deprecated. New values are listed in the drop-down list in the task assistant. If there is a
newer version of a framework available in the supported runtime versions you can
specify it even if it is not in the list.
Enter the application settings using the syntax -key value (for example: -Port 5000 -
RequestTimeout 5000 -WEBSITE_TIME_ZONE ). Enclose values that contain spaces in double
quotes (for example: "Eastern Standard Time" ).
string . Required when appType != "" && package NotEndsWith .war && Package
NotEndsWith .jar . Allowed values: auto (Auto-detect), zipDeploy (Zip Deploy),
runFromPackage (Zip Deploy with Run From Package). Default value: auto .
Specifies the deployment method for the app. Linux Consumption apps do not support
this configuration.
AppServiceApplicationUrl
Remarks
The Azure Function Deployment task is used to update Azure Functions to deploy
Functions to Azure. The task works on cross platform Azure Pipelines agents running
Windows, Linux or Mac and uses the underlying deployment technologies of
RunFromPackage, Zip Deploy and Kudu REST APIs .
Azure Function
The task is used to deploy an Azure Functions project to an existing Azure Function. The
Azure Function app should exist prior to running the task. The Azure Function App can
be created from the Azure portal. Alternatively, the Azure PowerShell task can be used
to run AzureRM PowerShell scripts to provision and configure the Azure Function app.
Azure Subscription
To deploy to Azure, an Azure subscription has to be linked to Azure Pipelines using the
Services tab in the Account Administration section. Add the Azure subscription to use in
the Build or Release Management definition by opening the Account Administration
screen (gear icon on the top-right of the screen) and then click on the Services Tab.
Create the ARM service endpoint and use Azure Resource Manager endpoint type. For
more details, follow the steps listed in the link here.
The task does not work with the Azure Classic service endpoint and it will not list these
connections in the parameters in the task.
Deployment methods
Several deployment methods are available in this task.
Based on the type of Azure App Service and Azure Pipelines agent, the task uses a
suitable deployment technology. The deployment technologies used by tasks are as
follows:
By default, the task attempts to select the appropriate deployment technology based on
the input package, App Service type, and agent OS.
On a non-Windows agent (for any App Service type), the task relies on the Kudu REST
API to deploy the web app.
Zip Deploy
Zip Deploy creates a .zip deployment package from the chosen package or folder. It
then deploys the file contents to the wwwroot folder of the App Service name function
app in Azure. This option overwrites all existing content in the wwwroot folder. For more
information, see Zip deployment for Azure Functions.
Run From Package
Run From Package creates the same deployment package as Zip Deploy. Instead of
deploying files to the wwwroot folder, the Functions runtime mounts the entire package.
When you use this option, files in the wwwroot folder become read-only. For more
information, see Run your Azure Functions from a package file.
Troubleshooting
Error: Could not fetch access token for Azure. Verify if the
Service Principal used is valid and not expired.
The task uses the service principal in the service connection to authenticate with Azure.
If the service principal has expired or doesn't have permissions to the App Service, the
task fails with this error. Verify the validity of the service principal used and that it's
present in the app registration. For more information, see Use role-based access control
to manage access to your Azure subscription resources. This blog post also contains
more information about using service principal authentication.
SSL error
If you want to use a certificate in App Service, the certificate must be signed by a trusted
certificate authority. If your web app gives you certificate validation errors, you're
probably using a self-signed certificate. Set a variable named
VSTS_ARM_REST_IGNORE_SSL_ERRORS to the value true in the build or release pipeline to
/p:publishUrl="$(System.DefaultWorkingDirectory)\\WebAppContent" :
b. Clear the Prepend root folder name to archive paths check box:
Function app deployment on Windows succeeds but the app
doesn't work
This problem could occur if a web.config file isn't present in your app. You can either
add a web.config file to your source or automatically generate one by using the
Application and Configuration Settings of the task.
1. Select the task and go to Generate web.config parameters for Python, Node.js,
Go and Java apps:
2. Select the More button (...) under Generate web.config parameters for Python,
Node.js, Go and Java apps to edit the parameters:
3. Select your application type in the Application framework list.
4. Select OK. Doing so will populate the web.config parameters required to generate
the web.config file.
FAQs
Examples
Here's a sample YAML snippet that deploys Azure functions on Windows:
YAML
variables:
azureSubscription: Contoso
# To ignore SSL error, uncomment the below variable
# VSTS_ARM_REST_IGNORE_SSL_ERRORS: true
steps:
- task: AzureFunctionApp@2
displayName: Azure Function App Deploy
inputs:
azureSubscription: $(azureSubscription)
appName: samplefunctionapp
appType: functionApp
package: $(System.DefaultWorkingDirectory)/**/*.zip
To deploy a function on Linux, add the appType parameter and set it to appType:
functionAppLinux . If you don't specify a value, functionApp is the default.
To explicitly specify the deployment method as Zip Deploy, add the parameter
deploymentMethod: zipDeploy . Another supported value for this parameter is
For a walkthrough that shows how to create a CI/CD pipeline, see Build and deploy Java
to Azure Functions.
Requirements
ノ Expand table
Requirement Description
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Feedback
Was this page helpful? Yes No
Update a function app with .NET, Python, JavaScript, PowerShell, Java based web
applications.
Syntax
YAML
string . Required.
string . Required.
Enters or selects the name of an existing Azure Functions App. The Function Apps listed
will be based on the selected app type.
Deploys to an existing deployment slot or Azure App Service Environment. For both
targets, the task needs a Resource group name.
If the deployment target is a slot, it will default to the production slot. Any other
existing slot name can also be provided.
If the deployment target is an Azure App Service Environment, leave the slot name as
production and specify the Resource group name.
The Resource group name is required when the deployment target is either a
deployment slot or an App Service Environment.
Enters or selects the Azure Resource group that contains the Azure App Service
specified above.
slotName - Slot
string . Required when deployToSlotOrASE = true . Default value: production .
The file path to the package or folder that contains App Service content generated by
MSBuild, a compressed zip file, or a war file. Variables ( Build | Release) and wildcards are
supported. For example, $(System.DefaultWorkingDirectory)/**/*.zip or
$(System.DefaultWorkingDirectory)/**/*.war .
PYTHON|3.10 , PYTHON|3.11 .
Specify the framework and version your function app will run on. You can use any of the
supported runtime versions. Old values like DOCKER|microsoft/azure-functions-* are
deprecated. New values are listed in the drop-down list in the task assistant. If there is a
newer version of a framework available in the supported runtime versions you can
specify it even if it is not in the list.
dotnet run
dotnet filename.dll
apps
string . Optional. Use when appType != functionAppLinux && package NotEndsWith .war .
A standard Web.config will be generated and deployed to Azure App Service if the
application does not have one. The values in web.config vary based on the application
framework, and they can be edited. For example, for the node.js application, web.config
will have a startup file and iis_node module values. This edit feature is only for the
generated web.config .
string .
Enter the application settings using the syntax -key value (for example: -Port 5000 -
RequestTimeout 5000 -WEBSITE_TIME_ZONE ). Enclose values that contain spaces in double
Enter the configuration strings using the syntax -key value (for example: -phpVersion
5.6 -linuxFxVersion: node|6.11 ). Enclose values that contain spaces in double quotes.
NotEndsWith .war && Package NotEndsWith .jar . Allowed values: auto (Auto-detect),
zipDeploy (Zip Deploy), runFromPackage (Zip Deploy with Run From Package). Default
value: auto .
Output variables
This task defines the following output variables, which you can consume in downstream
steps, jobs, and stages.
AppServiceApplicationUrl
Deployment methods
Several deployment methods are available in this task. The default value is auto .
Based on the type of Azure App Service and Azure Pipelines agent, the task uses a
suitable deployment technology. The deployment technologies used by tasks are as
follows:
By default, the task attempts to select the appropriate deployment technology based on
the input package, App Service type, and agent OS.
On a non-Windows agent (for any App Service type), the task relies on the Kudu REST
API to deploy the web app.
Zip Deploy
Zip Deploy creates a .zip deployment package from the chosen package or folder. It
then deploys the file contents to the wwwroot folder of the App Service name function
app in Azure. This option overwrites all existing content in the wwwroot folder. For more
information, see Zip deployment for Azure Functions.
Run From Package creates the same deployment package as Zip Deploy. Instead of
deploying files to the wwwroot folder, the Functions runtime mounts the entire package.
When you use this option, files in the wwwroot folder become read-only. For more
information, see Run your Azure Functions from a package file.
Troubleshooting
Error: Could not fetch access token for Azure. Verify if the
Service Principal used is valid and not expired.
The task uses the service principal in the service connection to authenticate with Azure.
If the service principal has expired or doesn't have permissions to the App Service, the
task fails with this error. Verify the validity of the service principal used and that it's
present in the app registration. For more information, see Use role-based access control
to manage access to your Azure subscription resources. This blog post also contains
more information about using service principal authentication.
SSL error
If you want to use a certificate in App Service, the certificate must be signed by a trusted
certificate authority. If your web app gives you certificate validation errors, you're
probably using a self-signed certificate. Set a variable named
VSTS_ARM_REST_IGNORE_SSL_ERRORS to the value true in the build or release pipeline to
/p:publishUrl="$(System.DefaultWorkingDirectory)\\WebAppContent" :
b. Clear the Prepend root folder name to archive paths check box:
Function app deployment on Windows succeeds but the app
doesn't work
This problem could occur if a web.config file isn't present in your app. You can either
add a web.config file to your source or automatically generate one by using the
Application and Configuration Settings of the task.
1. Select the task and go to Generate web.config parameters for Python, Node.js,
Go and Java apps:
2. Select the More button (...) under Generate web.config parameters for Python,
Node.js, Go and Java apps to edit the parameters:
3. Select your application type in the Application framework list.
4. Select OK. Doing so will populate the web.config parameters required to generate
the web.config file.
FAQs
Examples
Here's a sample YAML snippet that deploys Azure functions on Windows:
YAML
variables:
azureSubscription: Contoso
# To ignore SSL error, uncomment the below variable
# VSTS_ARM_REST_IGNORE_SSL_ERRORS: true
steps:
- task: AzureFunctionApp@1
displayName: Azure Function App Deploy
inputs:
azureSubscription: $(azureSubscription)
appName: samplefunctionapp
appType: functionApp
package: $(System.DefaultWorkingDirectory)/**/*.zip
To deploy a function on Linux, add the appType parameter and set it to appType:
functionAppLinux . If you don't specify a value, functionApp is the default.
To explicitly specify the deployment method as Zip Deploy, add the parameter
deploymentMethod: zipDeploy . Another supported value for this parameter is
For a walkthrough that shows how to create a CI/CD pipeline, see Build and deploy Java
to Azure Functions.
Requirements
ノ Expand table
Requirement Description
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Feedback
Was this page helpful? Yes No
Syntax
YAML
Inputs
azureSubscription - Azure subscription
string . Required.
string . Required.
Set this input to true to deploy to an existing deployment slot or Azure App Service
Environment. The task needs a Resource Group name for both targets. For the
deployment slot option, the default deploys to the production slot, or you can specify
any other existing slot name. If the deployment target is an Azure App Service
Environment, leave the slot name as production and specify the Resource Group name.
The name of the Resource Group that contains the Function App for Containers.
slotName - Slot
string . Required when deployToSlotOrASE = true . Default value: production .
string . Required.
A globally unique top-level domain name for your specific registry or namespace.
Note: A fully qualified image name will be of the format: <registry or namespace>
<repository> <tag> . For example, myregistry.azurecr.io/nginx:latest .
The startup command that executes after deployment. For example, dotnet run dotnet
filename.dll.
Enter the application settings using the syntax -key value (for example: -Port 5000 -
RequestTimeout 5000 -WEBSITE_TIME_ZONE ). Enclose values that contain spaces in double
quotes (for example: "Eastern Standard Time" ).
Enter the configuration strings using the syntax -key value (for example: -phpVersion
5.6 -linuxFxVersion: node|6.11 ). Enclose values that contain spaces in double quotes.
Output variables
This task defines the following output variables, which you can consume in downstream
steps, jobs, and stages.
AppServiceApplicationUrl
Remarks
Use this task to deploy an Azure Function on Linux using a custom image.
Error: Could not fetch access token for Azure. Verify if the
Service Principal used is valid and not expired.
The task uses the service principal in the service connection to authenticate with Azure.
If the service principal has expired or doesn't have permissions to the App Service, the
task fails with this error. Verify the validity of the service principal used and that it's
present in the app registration. For more information, see Use role-based access control
to manage access to your Azure subscription resources. This blog post also contains
more information about using service principal authentication.
SSL error
If you want to use a certificate in App Service, the certificate must be signed by a trusted
certificate authority. If your web app gives you certificate validation errors, you're
probably using a self-signed certificate. Set a variable named
VSTS_ARM_REST_IGNORE_SSL_ERRORS to the value true in the build or release pipeline to
Insights extension in a safe state. This step is required because the Application Insights
continuous WebJob is installed into the App_Data folder.
How should I configure my agent if it's behind a proxy
while I'm deploying to App Service?
If your self-hosted agent requires a web proxy, you can inform the agent about the
proxy during configuration. Doing so allows your agent to connect to Azure Pipelines or
Azure DevOps Server through the proxy. Learn more about running a self-hosted agent
behind a web proxy.
Examples
This example deploys Azure Functions on Linux using containers:
YAML
variables:
imageName: contoso.azurecr.io/azurefunctions-containers:$(build.buildId)
azureSubscription: Contoso
# To ignore SSL error uncomment the following variable
# VSTS_ARM_REST_IGNORE_SSL_ERRORS: true
steps:
- task: AzureFunctionAppContainer@1
displayName: Azure Function App on Container deploy
inputs:
azureSubscription: $(azureSubscription)
appName: functionappcontainers
imageName: $(imageName)
Requirements
ノ Expand table
Requirement Description
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Feedback
Was this page helpful? Yes No
Use this task to build and deploy images quickly and efficiently to Azure IoT Edge.
This task supports custom variables. If you're not familiar with how to use variables in
Pipelines, see define variables.
7 Note
This task does not support Azure Resource Manager authentication with workflow
identity federation.
Syntax
YAML
Inputs
action - Action
string . Required. Allowed values: Build module images , Push module images , Generate
deployment manifest , Deploy to IoT Edge devices . Default value: Build module images .
Build module images only builds modules (you can use it to check compilation errors).
Deploy to IoT Edge devices deploys the generated deployment file to IoT Hub. (We
$(System.DefaultWorkingDirectory)/config/deployment.json .
Selects the deployment json file. If this task is in release pipeline , you need to set the
location of the deployment file in artifact. (The default value works for most conditions.)
If this task is in a build pipeline, you must specify the deployment manifest output path.
string . Required when action = Deploy to IoT Edge devices . Default value:
$(System.TeamProject)-devops-deployment .
Inputs the IoT Edge Deployment ID. If the ID already exists, it will be overridden. This has
up to 128 lowercase letters and numbers, and the following characters are allowed:
-:+%_#*?!(),=@;' . For more information, see Azure IoT Edge deployment.
string . Required when action = Deploy to IoT Edge devices . Default value: 0 .
Sets the priority to a positive integer to resolve deployment conflicts. When this task is
targeted by multiple deployments, a device will use the one with the highest priority or,
in the case of two deployments with the same priority, the latest creation time. For more
information, see Azure IoT Edge deployment.
string . Required when action == Deploy to IoT Edge devices . Allowed values: Single
Inputs the target condition of devices you would like to deploy. Do not use double
quotes. Example: tags.building=9 and tags.environment='test' . For more information,
see Azure IoT Edge deployment.
Selects a Container Registry Type . Azure Container Registry is for ACR, and Generic
Container Registry is for generic registries including docker hub.
Selects a generic Docker registry connection. This is required for build and push.
Specifies an Azure Container Registry. This value should be specified in json format.
yml
azureContainerRegistry: '{"loginServer": "contoso.azurecr.io"}
string . Required when action = Build module images || action = Push module images
|| action = Generate deployment manifest . Default value: deployment.template.json .
The path of Azure IoT Edge solution .template.json . This file defines the modules and
routes in Azure IoT Edge solution. The file name must end with .template.json .
In your .template.json , you can leave the modules platform unspecified. For these
modules, the default platform will be used.
string . Required when action = Push module images . Allowed values: true , false .
Default value: true .
Adds the registry credential for pushing docker images to the deployment manifest.
manifest
string . Required when action = Generate deployment manifest . Allowed values: true ,
Fail this step if the generated deployment manifest does not pass schema validation.
Search Azure IoT Edge deployment in JSON Schema Store to find latest schema.
bypassModules - Bypass module(s)
string . Optional. Use when action = Push module images .
Selects the module(s) that you do not need to build or push in .template.json , specifies
the module names, and separates them with commas. Example: if you have
SampleModule1 and SampleModule2 in your .template.json and you want to only build or
push SampleModule1 , then you set the bypass modules as SampleModule2 . Leave this
empty if you would like to build all the modules in .template.json .
Output variables
This task defines the following output variables, which you can consume in downstream
steps, jobs, and stages.
DEPLOYMENT_FILE_PATH
Remarks
Use this task to build, test, and deploy applications quickly and efficiently to Azure IoT
Edge.
This task supports custom variables. If you're not familiar with how to use variables in
Pipelines, see Define variables.
Examples
YAML
- task: AzureIoTEdge@2
displayName: AzureIoTEdge - Build module images
inputs:
action: Build module images
templateFilePath: deployment.template.json
defaultPlatform: amd64
YAML
variables:
azureSubscriptionEndpoint: Contoso
azureContainerRegistry: contoso.azurecr.io
steps:
- task: AzureIoTEdge@2
displayName: AzureIoTEdge - Push module images
inputs:
action: Push module images
containerregistrytype: Azure Container Registry
azureSubscriptionEndpoint: $(azureSubscriptionEndpoint)
azureContainerRegistry: {"loginServer":"$(azureContainerRegistry)"}
templateFilePath: deployment.template.json
defaultPlatform: amd64
fillRegistryCredential: true
YAML
steps:
- task: AzureIoTEdge@2
displayName: AzureIoTEdge - Generate deployment manifest
inputs:
action: Generate deployment manifest
templateFilePath: deployment.template.json
defaultPlatform: amd64
deploymentManifestOutputPath:
$(System.DefaultWorkingDirectory)/config/deployment.json
validateGeneratedDeploymentManifest: false
steps:
- task: AzureIoTEdge@2
displayName: 'Azure IoT Edge - Deploy to IoT Edge devices'
inputs:
action: 'Deploy to IoT Edge devices'
deploymentFilePath:
$(System.DefaultWorkingDirectory)/config/deployment.json
azureSubscription: $(azureSubscriptionEndpoint)
iothubname: iothubname
deploymentid: '$(System.TeamProject)-devops-deployment'
priority: '0'
deviceOption: 'Single Device'
deviceId: deviceId
More examples
For step-by-step examples of how to use these actions in Azure Pipelines, see the
following articles:
Requirements
ノ Expand table
Requirement Description
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Use this task to download secrets, such as authentication keys, storage account keys,
data encryption keys, .PFX files, and passwords from an Azure Key Vault instance. The
task can be used to fetch the latest values of all or a subset of secrets from the vault and
set them as variables that can be used in subsequent tasks of a pipeline. The task is
Node-based and works with agents on Linux, macOS, and Windows.
Syntax
YAML
Inputs
azureSubscription - Azure subscription
Select the service connection for the Azure subscription containing the Azure Key Vault
instance, or create a new connection. Learn more.
string . Required.
The name of the Azure Key Vault that contains the secrets to download.
SecretsFilter - Secrets filter
string . Required. Default value: * .
Downloads secret names according to the entered value. The value can be the default
value to download all secrets from the selected key vault, or a comma-separated list of
secret names.
Runs the task before the job execution begins. Exposes secrets to all tasks in the job, not
just tasks that follow this one.
Output variables
None.
Remarks
What's new in Version 2.0: Added support for %3B, %5D in secrets.
Use this task to download secrets, such as authentication keys, storage account keys,
data encryption keys, .PFX files, and passwords from an Azure Key Vault instance. The
task can be used to fetch the latest values of all or a subset of secrets from the vault and
set them as variables that can be used in subsequent tasks of a pipeline. The task is
Node-based and works with agents on Linux, macOS, and Windows.
By using the Azure CLI. To add a secret to a key vault, for example a secret named
SQLPassword with the value PlaceholderPassword, type:
Azure CLI
Ensure the Azure service connection has at least Get and List permissions on the
vault. You can set these permissions in the Azure portal :
Open the Settings blade for the vault, choose Access policies, then Add new.
In the Add access policy blade, choose Select principal and select the service
principal for your client account.
In the Add access policy blade, choose Secret permissions and ensure that Get
and List are checked (ticked).
Choose OK to save the changes.
7 Note
If you're using a Microsoft-hosted agent, you must add the IP range of the
Microsoft-hosted agent to your firewall. Get the weekly list of IP ranges from the
weekly JSON file , which is published every Wednesday. The new IP ranges
become effective the following Monday. For more information, see Microsoft-
hosted agents. To find the IP ranges that are required for your Azure DevOps
organization, learn how to identify the possible IP ranges for Microsoft-hosted
agents.
7 Note
If the value fetched from the vault is a certificate (for example, a PFX file), the task
variable will contain the contents of the PFX in string format. You can use the following
PowerShell code to retrieve the PFX file from the task variable:
PowerShell
$kvSecretBytes = [System.Convert]::FromBase64String("$(PfxSecret)")
$certCollection = New-Object
System.Security.Cryptography.X509Certificates.X509Certificate2Collection
$certCollection.Import($kvSecretBytes,$null,
[System.Security.Cryptography.X509Certificates.X509KeyStorageFlags]::Exporta
ble)
If the certificate file will be stored locally on the machine, it is good practice to encrypt it
with a password:
PowerShell
For more information, see Get started with Azure Key Vault certificates.
Requirements
ノ Expand table
Requirement Description
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Feedback
Was this page helpful? Yes No
Use this task to download secrets, such as authentication keys, storage account keys,
data encryption keys, .PFX files, and passwords from an Azure Key Vault instance. The
task can be used to fetch the latest values of all or a subset of secrets from the vault and
set them as variables that can be used in subsequent tasks of a pipeline. The task is
Node-based and works with agents on Linux, macOS, and Windows.
Syntax
# Azure Key Vault v1
# Download Azure Key Vault secrets.
- task: AzureKeyVault@1
inputs:
azureSubscription: # string. Alias: ConnectedServiceName. Required.
Azure subscription.
KeyVaultName: # string. Required. Key vault.
SecretsFilter: '*' # string. Required. Secrets filter. Default: *.
#RunAsPreJob: false # boolean. Make secrets available to whole job.
Default: false.
Inputs
azureSubscription - Azure subscription
The service connection for the Azure subscription that either contains the Azure Key
Vault instance or creates a new connection. Learn more about connecting to Azure.
string . Required.
The name of the Azure Key Vault that contains the secrets to download.
Runs the task before the job execution begins. Exposes secrets to all tasks in the job, not
just tasks that follow this one.
Output variables
None.
Remarks
Works with cross-platform agents (Linux, macOS, or Windows).
Requirements
ノ Expand table
Requirement Description
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
See also
Azure Key Vault v2
Feedback
Was this page helpful? Yes No
Syntax
YAML
Inputs
azureSubscription - Azure subscription
string . Required.
The path to the load test YAML configuration file relative from the repo root. See Test
configuration YAML reference. The path must be fully qualified or relative to the default
working directory.
string .
secrets - Secrets
string .
An array of JSON objects that consist of the name and value for each secret. The name
should match the secret name used in the Apache JMeter test script. Add or update the
secret parameters using the json syntax as shown in the following example.
JSON
[
{
"name": "key1",
"value": $(secret1)
},
{
"name": "key2",
"value": $(secret2)
}
]
env - env
string .
An array of JSON objects that consist of the name and value for each environment
variable. The name should match the variable name used in the Apache JMeter test
script. Add or update the environment variables using the JSON syntax as shown in the
following example.
JSON
[
{
"name": "env1",
"value": "value1"
},
{
"name": "env2",
"value": "value2"
}
]
Output variables
None.
Remarks
Use this task to run an Apache JMeter script by using Azure Load Testing. Azure Load
Testing is a fully managed load testing service that enables you to generate high-scale
load.
The task succeeds if the load test finishes successfully and all test criteria pass.
Although Azure PowerShell isn't listed in the demands for AzureLoadTest@1 , the agent
must have Azure PowerShell installed. Azure PowerShell is installed on Windows and
Linux hosted agent images.
7 Note
AzureLoadTest@1 is part of the Azure Load Testing marketplace extension. For more
information on installing and using this task, see Identify performance regressions
with Azure Load Testing and Azure Pipelines.
Examples
For an example using this task, see the Azure Load Testing documentation article
Continuous regression testing with Azure Pipelines.
Requirements
ノ Expand table
Requirement Description
Runs on Agent
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
See also
For more information about using this task, see the Azure Load Testing documentation
article Continuous regression testing with Azure Pipelines.
Feedback
Was this page helpful? Yes No
7 Note
This task does not support Azure Resource Manager authentication with workflow
identity federation.
Syntax
# Azure Monitor alerts (Deprecated) v0
# Configure alerts on available metrics for an Azure resource (Deprecated).
- task: AzureMonitorAlerts@0
inputs:
azureSubscription: # string. Alias: ConnectedServiceName. Required.
Azure Subscription.
ResourceGroupName: # string. Required. Resource Group.
ResourceType: 'Microsoft.Insights/components' #
'Microsoft.Insights/components' | 'Microsoft.Web/sites' |
'Microsoft.Storage/storageAccounts' | 'Microsoft.Compute/virtualMachines'.
Required. Resource Type. Default: Microsoft.Insights/components.
ResourceName: # string. Required. Resource name.
AlertRules: # string. Required. Alert rules.
# Notify via email
#NotifyServiceOwners: # boolean. Subscription owners, contributors and
readers.
#NotifyEmails: # string. Additional administrator emails.
Inputs
azureSubscription - Azure Subscription
Note: To configure new service connection, select the Azure subscription from the list
and click Authorize .
If your subscription is not listed or if you want to use an existing service principal, you
can setup an Azure service connection using the Add or Manage button.
string . Required.
Selects the Azure Resource Group that contains the Azure resource where you want to
configure an alert.
Selects the name of the Azure resource where you want to configure an alert.
string . Required.
The list of Azure monitor alerts that are configured on the selected Azure resource.
Optional. Sends an email notification to everyone who has access to the specified
resource group.
Output variables
None.
Remarks
Use this task to configure alerts on available metrics for an Azure resource.
Requirements
ノ Expand table
Requirement Description
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Feedback
Was this page helpful? Yes No
Use this task to connect or disconnect an Azure virtual machine's network interface to a
load balancer's back-end address pool.
7 Note
This task does not support Azure Resource Manager authentication with workflow
identity federation.
Syntax
YAML
Inputs
azureSubscription - Azure Subscription
Action - Action
Disconnect: Removes the virtual machine’s primary network interface from the load
balancer’s back-end pool so it stops receiving network traffic.
Connect: Adds the virtual machine’s primary network interface to load balancer back-
end pool so it starts receiving network traffic based on the load balancing rules for the
load balancer resource.
Output variables
None.
Remarks
Use this task to connect or disconnect an Azure virtual machine's network interface to a
load balancer's address pool.
Requirements
ノ Expand table
Requirement Description
Runs on DeploymentGroup
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Feedback
Was this page helpful? Yes No
Use this task to run a PowerShell script within an Azure environment. The Azure context
is authenticated with the provided Azure Resource Manager service connection.
7 Note
By default, Azure PowerShell v5 uses PowerShell Core for Linux agents and
Windows PowerShell for Windows agents. To use the latest version of PowerShell
on Windows agents, set the pwsh parameter to true . PowerShell Core will then be
used instead.
Syntax
YAML
# Azure PowerShell v5
# Run a PowerShell script within an Azure environment.
- task: AzurePowerShell@5
inputs:
azureSubscription: # string. Alias: ConnectedServiceNameARM. Required.
Azure Subscription.
#ScriptType: 'FilePath' # 'FilePath' | 'InlineScript'. Script Type.
Default: FilePath.
#ScriptPath: # string. Optional. Use when ScriptType = FilePath. Script
Path.
#Inline: # string. Optional. Use when ScriptType = InlineScript. Inline
Script.
#ScriptArguments: # string. Optional. Use when ScriptType = FilePath.
Script Arguments.
#errorActionPreference: 'stop' # 'stop' | 'continue' |
'silentlyContinue'. ErrorActionPreference. Default: stop.
#FailOnStandardError: false # boolean. Fail on Standard Error. Default:
false.
# Azure PowerShell version options
#azurePowerShellVersion: 'OtherVersion' # 'LatestVersion' |
'OtherVersion'. Alias: TargetAzurePs. Azure PowerShell Version. Default:
OtherVersion.
preferredAzurePowerShellVersion: # string. Alias: CustomTargetAzurePs.
Required when TargetAzurePs = OtherVersion. Preferred Azure PowerShell
Version.
# Advanced
#pwsh: false # boolean. Use PowerShell Core. Default: false.
#validateScriptSignature: false # boolean. Optional. Use when ScriptType
= FilePath. Validate script signature. Default: false.
#workingDirectory: # string. Working Directory.
Inputs
azureSubscription - Azure Subscription
string . Allowed values: FilePath (Script File Path), InlineScript (Inline Script). Default
value: FilePath .
The path of the script. This should be a fully qualified path or one relative to the default
working directory.
string . Optional. Use when ScriptType = InlineScript . Default value: # You can write
your azure powershell scripts inline here. \n# You can also pass predefined and
custom variables to this script using arguments .
Specifes the script to execute. The maximum supported inline script length is 5000
characters. Use a script from a file if you want to use a longer script.
The additional parameters to pass to PowerShell. These can be either ordinal or named
parameters. Not applicable for an inline script option.
errorActionPreference - ErrorActionPreference
string . Allowed values: stop , continue , silentlyContinue . Default value: stop .
Selects the value of the ErrorActionPreference variable for executing the script.
When this is true, this task will fail if any errors are written to the error pipeline or if any
data is written to the standard error stream.
In case of hosted agents, the supported Azure PowerShell Versions are 1.0.0 , 1.6.0 ,
2.3.2 , 2.6.0 , and 3.1.0 (Hosted VS2017 Queue). To pick the latest version available on
For private agents you can specify a preferred version of Azure PowerShell using
OtherVersion (Specify other version).
The preferred Azure PowerShell Version needs to be a proper semantic version eg.
1.2.3 . Regex like 2.\*,2.3.\* is not supported. The Hosted VS2017 Pool currently
If this is true, then tasks running on Windows agents will use pwsh.exe from your path
instead of powershell.exe .
string .
Output variables
None.
Remarks
Troubleshooting
To resolve this issue, ensure the service principle/ authentication credentials have the
required permissions. For more information, see Use Role-Based Access Control to
manage access to your Azure subscription resources.
Error: Could not find the modules: '<module name>' with Version:
'<version>'. If the module was recently installed, retry after
restarting the Azure Pipelines task agent
Azure PowerShell task uses Azure/AzureRM/Az PowerShell Module to interact with
Azure Subscription. This issue occurs when the PowerShell module is not available on
the Hosted Agent. Hence, for a particular task version, Preferred Azure PowerShell
version must be specified in the Azure PowerShell version options from the list of
available versions. The installed software can be found in the Software table in
Microsoft-hosted agents.
Examples
The following example shows how to invoke a script from a file and pass script
arguments to it.
yml
- task: AzurePowerShell@5
inputs:
azureSubscription: my-arm-service-connection
scriptType: filePath
scriptPath: $(Build.SourcesDirectory)\myscript.ps1
scriptArguments:
-Arg1 val1 `
-Arg2 val2 `
-Arg3 val3
azurePowerShellVersion: latestVersion
pwsh: true
yml
- task: AzurePowerShell@5
inputs:
azureSubscription: 'Azure subscription connection placeholder'
azurePowerShellVersion: LatestVersion
ScriptType: 'InlineScript'
Inline: |
# You can write your azure powershell scripts inline here.
# You can also pass predefined and custom variables to this script
using arguments
Write-Host 'Hello'
Write-Host 'World!'
Requirements
ノ Expand table
Requirement Description
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Feedback
Was this page helpful? Yes No
Use this task to run a PowerShell script within an Azure environment. The Azure context
is authenticated with the provided Azure Resource Manager service connection.
Syntax
# Azure PowerShell v4
# Run a PowerShell script within an Azure environment.
- task: AzurePowerShell@4
inputs:
azureSubscription: # string. Alias: ConnectedServiceNameARM. Required.
Azure Subscription.
#ScriptType: 'FilePath' # 'FilePath' | 'InlineScript'. Script Type.
Default: FilePath.
#ScriptPath: # string. Optional. Use when ScriptType = FilePath. Script
Path.
#Inline: # string. Optional. Use when ScriptType = InlineScript. Inline
Script.
#ScriptArguments: # string. Optional. Use when ScriptType = FilePath.
Script Arguments.
#errorActionPreference: 'stop' # 'stop' | 'continue' |
'silentlyContinue'. ErrorActionPreference. Default: stop.
#FailOnStandardError: false # boolean. Fail on Standard Error. Default:
false.
#RestrictContextToCurrentTask: false # boolean. Restrict scope of
context to current task. Default: false.
# Azure PowerShell version options
#azurePowerShellVersion: 'OtherVersion' # 'LatestVersion' |
'OtherVersion'. Alias: TargetAzurePs. Azure PowerShell Version. Default:
OtherVersion.
preferredAzurePowerShellVersion: # string. Alias: CustomTargetAzurePs.
Required when TargetAzurePs = OtherVersion. Preferred Azure PowerShell
Version.
# Advanced
#pwsh: false # boolean. Use PowerShell Core. Default: false.
#validateScriptSignature: false # boolean. Optional. Use when ScriptType
= FilePath. Validate script signature. Default: false.
#workingDirectory: # string. Working Directory.
Inputs
azureSubscription - Azure Subscription
string . Allowed values: FilePath (Script File Path), InlineScript (Inline Script). Default
value: FilePath .
The path of the script. This should be a fully qualified path or one relative to the default
working directory.
string . Optional. Use when ScriptType = InlineScript . Default value: # You can write
your azure powershell scripts inline here. \n# You can also pass predefined and
Specifes the script to execute. The maximum supported inline script length is 5000
characters. Use a script from a file if you want to use a longer script.
errorActionPreference - ErrorActionPreference
Selects the value of the ErrorActionPreference variable for executing the script.
When this is true, this task will restrict the scope of context to the current task only, and
the context will not be available to other tasks in the pipeline when using a private
agent.
In case of hosted agents, the supported Azure PowerShell Version is: 1.0.0 (Hosted
VS2017 Queue). To pick the latest version available on the agent, select LatestVersion
(Latest installed version).
For private agents you can specify a preferred version of Azure PowerShell using
OtherVersion (Specify other version).
The preferred Azure PowerShell Version needs to be a proper semantic version eg.
1.2.3. Regex like 2.\*,2.3.\* is not supported. The Hosted VS2017 Pool currently
If this is true, then on Windows the task will use pwsh.exe from your path instead of
powershell.exe .
string .
Output variables
None.
Remarks
Added support for Az Module and cross platform agents.
Requirements
ノ Expand table
Requirement Description
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Use this task to run a PowerShell script within an Azure environment. The Azure context
is authenticated with the provided Azure Resource Manager service connection.
Syntax
# Azure PowerShell v3
# Run a PowerShell script within an Azure environment.
- task: AzurePowerShell@3
inputs:
#azureConnectionType: 'ConnectedServiceNameARM' # 'ConnectedServiceName'
| 'ConnectedServiceNameARM'. Alias: ConnectedServiceNameSelector. Azure
Connection Type. Default: ConnectedServiceNameARM.
#azureClassicSubscription: # string. Alias: ConnectedServiceName.
Required when ConnectedServiceNameSelector = ConnectedServiceName. Azure
Classic Subscription.
azureSubscription: # string. Alias: ConnectedServiceNameARM. Required
when ConnectedServiceNameSelector = ConnectedServiceNameARM. Azure
Subscription.
#ScriptType: 'FilePath' # 'FilePath' | 'InlineScript'. Script Type.
Default: FilePath.
#ScriptPath: # string. Optional. Use when ScriptType = FilePath. Script
Path.
#Inline: # string. Optional. Use when ScriptType = InlineScript. Inline
Script.
#ScriptArguments: # string. Optional. Use when ScriptType = FilePath.
Script Arguments.
#errorActionPreference: 'stop' # 'stop' | 'continue' |
'silentlyContinue'. ErrorActionPreference. Default: stop.
#FailOnStandardError: false # boolean. Fail on Standard Error. Default:
false.
# Azure PowerShell version options
#azurePowerShellVersion: 'OtherVersion' # 'LatestVersion' |
'OtherVersion'. Alias: TargetAzurePs. Azure PowerShell Version. Default:
OtherVersion.
preferredAzurePowerShellVersion: # string. Alias: CustomTargetAzurePs.
Required when TargetAzurePs = OtherVersion. Preferred Azure PowerShell
Version.
# Advanced
#validateScriptSignature: false # boolean. Optional. Use when ScriptType
= FilePath. Validate script signature. Default: false.
Inputs
azureConnectionType - Azure Connection Type
string . Allowed values: FilePath (Script File Path), InlineScript (Inline Script). Default
value: FilePath .
The path of the script. This should be a fully qualified path or one relative to the default
working directory.
string . Optional. Use when ScriptType = InlineScript . Default value: # You can write
your azure powershell scripts inline here. \n# You can also pass predefined and
Specifes the script to execute. The maximum supported inline script length is 5000
characters. Use a script from a file if you want to use a longer script.
ScriptArguments - Script Arguments
The additional parameters to pass to PowerShell. These can be either ordinal or named
parameters.
errorActionPreference - ErrorActionPreference
Selects the value of the ErrorActionPreference variable for executing the script.
When this is true, this task will fail if any errors are written to the error pipeline or if any
data is written to the standard error stream.
In case of hosted agents, the supported Azure PowerShell Versions are 2.1.0 , 3.8.0 ,
4.2.1 , 5.1.1 and 6.7.0 . To pick the latest version available on the agent, select
For private agents, you can specify a preferred version of Azure PowerShell using
OtherVersion (Specify other version).
The preferred Azure PowerShell Version needs to be a proper semantic version eg.
1.2.3. . Regex like 2.\*,2.3.\* is not supported. Hosted agents currently supports
Azure module versions 2.1.0 , 3.8.0 , 4.2.1 , 5.1.1 and AzureRM module versions
2.1.0 , 3.8.0 , 4.2.1 , 5.1.1 , 6.7.0 .
validateScriptSignature - Validate script signature
boolean . Optional. Use when ScriptType = FilePath . Default value: false .
If this is true, then the task will first check to make sure specified script is signed and
valid before executing it.
Output variables
None.
Remarks
Added support for Fail on standard error and ErrorActionPreference.
Requirements
ノ Expand table
Requirement Description
Demands Self-hosted agents must have capabilities that match the following demands
to run jobs that use this task: azureps
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Command Any
restrictions
Use this task to run a PowerShell script within an Azure environment. The Azure context
is authenticated with the provided Azure Resource Manager service connection.
Syntax
# Azure PowerShell v2
# Run a PowerShell script within an Azure environment.
- task: AzurePowerShell@2
inputs:
#azureConnectionType: 'ConnectedServiceNameARM' # 'ConnectedServiceName'
| 'ConnectedServiceNameARM'. Alias: ConnectedServiceNameSelector. Azure
Connection Type. Default: ConnectedServiceNameARM.
#azureClassicSubscription: # string. Alias: ConnectedServiceName.
Required when ConnectedServiceNameSelector = ConnectedServiceName. Azure
Classic Subscription.
azureSubscription: # string. Alias: ConnectedServiceNameARM. Required
when ConnectedServiceNameSelector = ConnectedServiceNameARM. Azure
Subscription.
ScriptType: 'FilePath' # 'FilePath' | 'InlineScript'. Required. Script
Type. Default: FilePath.
#ScriptPath: # string. Optional. Use when ScriptType = FilePath. Script
Path.
#Inline: # string. Optional. Use when ScriptType = InlineScript. Inline
Script.
#ScriptArguments: # string. Script Arguments.
#azurePowerShellVersion: 'OtherVersion' # 'LatestVersion' |
'OtherVersion'. Alias: TargetAzurePs. Azure PowerShell Version. Default:
OtherVersion.
preferredAzurePowerShellVersion: # string. Alias: CustomTargetAzurePs.
Required when TargetAzurePs = OtherVersion. Preferred Azure PowerShell
Version.
Inputs
azureConnectionType - Azure Connection Type
The path of the script. This should be a fully qualified path or one relative to the default
working directory.
your azure powershell scripts inline here. \n# You can also pass predefined and
custom variables to this script using arguments .
Specifes the script to execute. The maximum supported inline script length is 5000
characters. Use a script from a file if you want to use a longer script.
The additional parameters to pass to PowerShell. These can be either ordinal or named
parameters.
azurePowerShellVersion - Azure PowerShell Version
In case of hosted agents, the supported Azure PowerShell Versions are 2.1.0 , 3.8.0 ,
4.2.1 , 5.1.1 and 6.7.0 . To pick the latest version available on the agent, select
For private agents you can specify a preferred version of Azure PowerShell using
OtherVersion (Specify other version).
The preferred Azure PowerShell Version needs to be a proper semantic version eg.
1.2.3. . Regex like 2.\*,2.3.\* is not supported. Hosted agents currently supports
Azure module versions 2.1.0 , 3.8.0 , 4.2.1 , 5.1.1 and AzureRM module versions
2.1.0 , 3.8.0 , 4.2.1 , 5.1.1 , 6.7.0 .
Output variables
None.
Requirements
ノ Expand table
Requirement Description
Demands Self-hosted agents must have capabilities that match the following demands
to run jobs that use this task: azureps
Requirement Description
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Command Any
restrictions
Feedback
Was this page helpful? Yes No
Use this task to run a PowerShell script within an Azure environment. The Azure context
is authenticated with the provided Azure Resource Manager service connection.
Syntax
YAML
# Azure PowerShell v1
# Run a PowerShell script within an Azure environment.
- task: AzurePowerShell@1
inputs:
#ConnectedServiceNameSelector: 'ConnectedServiceName' #
'ConnectedServiceName' | 'ConnectedServiceNameARM'. Azure Connection Type.
Default: ConnectedServiceName.
ConnectedServiceName: # string. Required when
ConnectedServiceNameSelector = ConnectedServiceName. Azure Classic
Subscription.
#ConnectedServiceNameARM: # string. Required when
ConnectedServiceNameSelector = ConnectedServiceNameARM. Azure Subscription.
ScriptType: 'FilePath' # 'FilePath' | 'InlineScript'. Required. Script
Type. Default: FilePath.
#ScriptPath: # string. Optional. Use when ScriptType = FilePath. Script
Path.
#Inline: # string. Optional. Use when ScriptType = InlineScript. Inline
Script.
#ScriptArguments: # string. Script Arguments.
Inputs
ConnectedServiceNameSelector - Azure Connection Type
string . Required. Allowed values: FilePath (Script File Path), InlineScript (Inline
The path of the script. This should be a fully qualified path or one relative to the default
working directory.
string . Optional. Use when ScriptType = InlineScript . Default value: # You can write
your azure powershell scripts inline here. \n# You can also pass predefined and
Specifes the script to execute. The maximum supported inline script length is 500
characters. Use a script from a file if you want to use a longer script.
string .
The additional parameters to pass to PowerShell. These can be either ordinal or named
parameters.
Output variables
None.
Requirements
ノ Expand table
Requirement Description
Demands Self-hosted agents must have capabilities that match the following demands
to run jobs that use this task: azureps
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Command Any
restrictions
Feedback
Was this page helpful? Yes No
Deploy an Azure Resource Manager (ARM) template to a resource group and manage
virtual machines.
Syntax
# Azure resource group deployment v2
# Deploy an Azure Resource Manager (ARM) template to a resource group and
manage virtual machines.
- task: AzureResourceGroupDeployment@2
inputs:
# Azure Details
azureSubscription: # string. Alias: ConnectedServiceName. Required.
Azure subscription.
action: 'Create Or Update Resource Group' # 'Create Or Update Resource
Group' | 'Select Resource Group' | 'Start' | 'Stop' | 'StopWithDeallocate' |
'Restart' | 'Delete' | 'DeleteRG'. Required. Action. Default: Create Or
Update Resource Group.
resourceGroupName: # string. Required. Resource group.
#location: # string. Required when action = Create Or Update Resource
Group. Location.
# Template
#templateLocation: 'Linked artifact' # 'Linked artifact' | 'URL of the
file'. Required when action = Create Or Update Resource Group. Template
location. Default: Linked artifact.
#csmFileLink: # string. Required when templateLocation = URL of the file
&& action = Create Or Update Resource Group. Template link.
#csmParametersFileLink: # string. Optional. Use when templateLocation =
URL of the file && action = Create Or Update Resource Group. Template
parameters link.
#csmFile: # string. Required when templateLocation = Linked artifact &&
action = Create Or Update Resource Group. Template.
#csmParametersFile: # string. Optional. Use when templateLocation =
Linked artifact && action = Create Or Update Resource Group. Template
parameters.
#overrideParameters: # string. Optional. Use when action = Create Or
Update Resource Group. Override template parameters.
#deploymentMode: 'Incremental' # 'Incremental' | 'Complete' |
'Validation'. Required when action = Create Or Update Resource Group.
Deployment mode. Default: Incremental.
# Advanced deployment options for virtual machines
#enableDeploymentPrerequisites: 'None' # 'None' | 'ConfigureVMwithWinRM'
| 'ConfigureVMWithDGAgent'. Optional. Use when action = Create Or Update
Resource Group || action = Select Resource Group. Enable prerequisites.
Default: None.
#teamServicesConnection: # string. Alias: deploymentGroupEndpoint.
Required when enableDeploymentPrerequisites = ConfigureVMWithDGAgent &&
action = Create Or Update Resource Group || action = Select Resource Group.
Azure Pipelines service connection.
#teamProject: # string. Alias: project. Required when
enableDeploymentPrerequisites = ConfigureVMWithDGAgent && action = Create Or
Update Resource Group || action = Select Resource Group. Team project.
#deploymentGroupName: # string. Required when
enableDeploymentPrerequisites = ConfigureVMWithDGAgent && action = Create Or
Update Resource Group || action = Select Resource Group. Deployment Group.
#copyAzureVMTags: true # boolean. Optional. Use when
enableDeploymentPrerequisites = ConfigureVMWithDGAgent && action = Create Or
Update Resource Group || action = Select Resource Group. Copy Azure VM tags
to agents. Default: true.
#runAgentServiceAsUser: false # boolean. Optional. Use when
enableDeploymentPrerequisites = ConfigureVMWithDGAgent && action = Create Or
Update Resource Group || action = Select Resource Group. Run agent service
as a user. Default: false.
#userName: # string. Required when enableDeploymentPrerequisites =
ConfigureVMWithDGAgent && runAgentServiceAsUser = true && action = Create Or
Update Resource Group || action = Select Resource Group. User name.
#password: # string. Optional. Use when enableDeploymentPrerequisites =
ConfigureVMWithDGAgent && runAgentServiceAsUser = true && action = Create Or
Update Resource Group || action = Select Resource Group. Password.
#outputVariable: # string. Optional. Use when
enableDeploymentPrerequisites = ConfigureVMwithWinRM ||
enableDeploymentPrerequisites = None && action = Create Or Update Resource
Group || action = Select Resource Group. VM details for WinRM.
# Advanced
#deploymentName: # string. Optional. Use when action = Create Or Update
Resource Group. Deployment name.
#deploymentOutputs: # string. Optional. Use when action = Create Or
Update Resource Group. Deployment outputs.
#addSpnToEnvironment: false # boolean. Optional. Use when action =
Create Or Update Resource Group. Access service principal details in
override parameters. Default: false.
#useWithoutJSON: false # boolean. Optional. Use when action = Create Or
Update Resource Group. Use individual output values without JSON.Stringify
applied. Default: false.
Inputs
azureSubscription - Azure subscription
Input alias: ConnectedServiceName . string . Required.
Selects the service connection that contains an Azure Subscription for the deployment.
action - Action
string . Required. Allowed values: Create Or Update Resource Group , Select Resource
Group (Configure virtual machine deployment options), Start (Start virtual machines),
Stop (Stop virtual machines), StopWithDeallocate (Stop and deallocate virtual
string . Required.
location - Location
string . Required when action = Create Or Update Resource Group .
The location to deploy the resource group. If the resource group already exists in the
subscription, then this value will be ignored.
simple-windows/azuredeploy.json
To deploy a template stored in a private storage account, retrieve and include the
shared access signature (SAS) token in the URL of the template. Example:
<blob_storage_url>/template.json?<SAStoken>
To upload a template file (or a linked template) to a storage account and generate a SAS
token, use the Azure file copy task or follow the steps using PowerShell or Azure
CLI .
To view the template parameters in a grid, click on ... next to the override template
parameters text box. This feature requires that CORS rules are enabled at the source. If
the templates are in an Azure storage blob, see Understanding CORS requests to enable
CORS.
string . Optional. Use when templateLocation = URL of the file && action = Create Or
To use a file stored in a private storage account, retrieve and include the shared access
signature (SAS) token in the URL of the template. Example:
<blob_storage_url>/template.json?<SAStoken> To upload a parameters file to a storage
account and generate a SAS token, you could use Azure file copy task or follow the
steps using PowerShell or Azure CLI .
To view the template parameters in a grid, click on ... next to the override template
parameters text box. This feature requires that CORS rules are enabled at the source. If
the templates are in an Azure storage blob, see Understanding CORS requests to enable
CORS.
csmFile - Template
Specifies the path or a pattern pointing to the Azure Resource Manager template. Learn
more about Azure Resource Manager templates . To get started immediately, use this
sample template .
string . Optional. Use when templateLocation = Linked artifact && action = Create Or
simple-windows/azuredeploy.parameters.json
To use a file stored in a private storage account, retrieve and include the shared access
signature (SAS) token in the URL of the template. Example:
<blob_storage_url>/template.json?<SAStoken> To upload a parameters file to a storage
account and generate a SAS token, use the Azure file copy task or follow the steps
using PowerShell or Azure CLI .
To view the template parameters in a grid, click on ... next to the override template
parameters text box. This feature requires that CORS rules are enabled at the source. If
the templates are in an Azure storage blob, see Understanding CORS requests to enable
CORS.
To view the template parameters in a grid, click on ... next to the override parameters
textbox. This feature requires that CORS rules are enabled at the source. If the templates
are in the Azure storage blob, reference this string to enable CORS, or type the template
parameters to override in the textbox.
azureKeyVaultName $(fabrikamFibre) .
If the parameter value has multiple words, enclose the words in quotes, even if you're
passing the value by using variables. For example, -name "parameter value" -name2
"$(var)" . To override object type parameters, use stringified JSON objects. For example,
string . Required when action = Create Or Update Resource Group . Allowed values:
Incremental , Complete , Validation (Validation only). Default value: Incremental .
relatively more time than incremental mode. If the task times out, consider increasing
the timeout or changing to the Incremental mode.
2 Warning
Complete mode will delete all the existing resources in the resource group that are
not specified in the template. Do review if the resource group you're deploying to
doesn't contain any necessary resources that are not specified in the template.
Validate mode enables you to find problems with the template before creating actual
resources.
7 Note
The Validate mode always creates a resource group, even if no resources are
deployed.
string . Optional. Use when action = Create Or Update Resource Group || action =
Select Resource Group . Allowed values: None , ConfigureVMwithWinRM (Configure with
Choosing the Deployment Group option configures the Deployment Group agent on
each of the virtual machines.
Selecting the WinRM option configures the Windows Remote Management (WinRM)
listener over HTTPS protocol on port 5986 using a self-signed certificate. This
configuration is required for performing deployment operation on Azure machines. If
the target virtual machines are backed by a load balancer, ensure the Inbound NAT rules
are configured for target port (5986).
You can create a service connection using +New and then selecting Token-based
authentication . You need a personal access token(PAT) to setup a service connection.
Specifies the deployment group against which the agent(s) will be registered. Learn
more about deployment groups.
&& action = Create Or Update Resource Group || action = Select Resource Group .
By default, all Azure tags are copied following the format: Key: Value . Example: A Role
: Web Azure tag would be copied as-is to the agent machine.
Runs the agent service as a user other than the default user if the value is set to true .
It is assumed that the same domain user or a local user with the same name,
respectively, is present on all the virtual machines in the resource group.
password - Password
string . Optional. Use when enableDeploymentPrerequisites = ConfigureVMWithDGAgent
The password for the user to run the agent service on the Windows VMs.
It is assumed that the password is the same for the specified user on all the VMs.
Required when an existing resource group is selected. Provides a name for the resource
group variable. The variable can be used as $(variableName) to refer to the resource
group in subsequent tasks, such as in PowerShell on Target Machines task for deploying
applications.
Provides a name for the output variable, which contains the outputs section of the
current deployment object in string format. Use the ConvertFrom-Json PowerShell
cmdlet to parse the JSON object and access the individual output values.
boolean . Optional. Use when action = Create Or Update Resource Group . Default value:
false .
Adds the service principal ID and key of the Azure endpoint chosen to be the script's
execution environment. The variables $servicePrincipalId and $servicePrincipalKey
can be in override parameters, such as -key $servicePrincipalKey .
boolean . Optional. Use when action = Create Or Update Resource Group . Default value:
false .
Individual output values are being converted via JSON.Stringify by default. If you want to
use the output values as it is without converting them via JSON.Stringify, enable this
option. For more details refer to this .
Remarks
There is a new version of this task available at
AzureResourceManagerTemplateDeployment@3 - ARM template deployment v3 task.
Troubleshooting
Azure Pipelines service itself is going through maintenance. Keep an eye out on
https://status.dev.azure.com/ for downtimes.
However, we've seen some instances where this is due to an error in the ARM template,
such as the Azure service you're trying to deploy doesn't support the region you've
chosen for the resource.
Error: Timeout
Timeout issues could be coming from two places:
You can identify if the timeout is from portal, by checking for the portal deployment link
that'll be in the task logs. If there's no link, this is likely due to Azure Pipelines agent. If
there's a link, follow the link to see if there's a timeout that has happened in the portal
deployment.
This feature requires the CORS rules to be enabled at the source. If templates are in
Azure storage blob, see Cross-origin resource sharing support to enable CORS.
Besides enabling CORS, ensure that the SAS token specified in the link of the template is
"srt-sco". This token is required for you to download the file and proceed.
If the issue is coming from Azure Pipelines agent, you can increase the timeout by
setting timeoutInMinutes as key in the YAML to 0. For more information, see Specify
jobs in your pipeline.
Portal Deployment
Check out this doc on how to identify if the error came from the Azure portal: View
deployment history with Azure Resource Manager.
In case of portal deployment, try setting "timeoutInMinutes" in the ARM template to "0".
If not specified, the value assumed is 60 minutes. 0 makes sure the deployment will run
for as long as it can to succeed.
This could also be happening because of transient issues in the system. Keep an eye on
https://status.dev.azure.com/ to check if there's a downtime in Azure Pipelines service.
Error: Azure Resource Manager (ARM) template failed validation
This issue happens mostly because of an invalid parameter in the ARM template, such as
an unsupported SKU or region. If the validation fails, check the error message. It should
point you to the resource and parameter that's invalid.
This issue also might occur because of multiline strings. Currently, the Azure Resource
Group Deployment task doesn't support multiline strings in an ARM template or
parameter JSON file.
In addition, refer to this article regarding structure and syntax of ARM Templates:
Understand the structure and syntax of ARM templates.
Requirements
ノ Expand table
Requirement Description
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Feedback
Was this page helpful? Yes No
Use this task to deploy, start, stop, and delete Azure Resource Groups.
Syntax
# Azure Resource Group Deployment v1
# Deploy, start, stop, delete Azure Resource Groups.
- task: AzureResourceGroupDeployment@1
inputs:
#ConnectedServiceNameSelector: 'ConnectedServiceName' #
'ConnectedServiceName' | 'ConnectedServiceNameClassic'. Azure Connection
Type. Default: ConnectedServiceName.
ConnectedServiceName: # string. Required when
ConnectedServiceNameSelector = ConnectedServiceName. Azure Subscription.
#ConnectedServiceNameClassic: # string. Required when
ConnectedServiceNameSelector = ConnectedServiceNameClassic. Azure Classic
Subscription.
action: 'Create Or Update Resource Group' # 'Create Or Update Resource
Group' | 'Select Resource Group' | 'Start' | 'Stop' | 'Restart' | 'Delete' |
'DeleteRG'. Required when ConnectedServiceNameSelector =
ConnectedServiceName. Action. Default: Create Or Update Resource Group.
#actionClassic: 'Select Resource Group' # 'Select Resource Group'.
Required when ConnectedServiceNameSelector = ConnectedServiceNameClassic.
Action. Default: Select Resource Group.
resourceGroupName: # string. Required when ConnectedServiceNameSelector
= ConnectedServiceName. Resource Group.
#cloudService: # string. Required when ConnectedServiceNameSelector =
ConnectedServiceNameClassic. Cloud Service.
#location: 'East US' # 'Australia East' | 'Australia Southeast' |
'Brazil South' | 'Canada Central' | 'Canada East' | 'Central India' |
'Central US' | 'East Asia' | 'East US' | 'East US 2 ' | 'Japan East' |
'Japan West' | 'North Central US' | 'North Europe' | 'South Central US' |
'South India' | 'Southeast Asia' | 'UK South' | 'UK West' | 'West Central
US' | 'West Europe' | 'West India' | 'West US' | 'West US 2'. Required when
action = Create Or Update Resource Group. Location. Default: East US.
#csmFile: # string. Required when action = Create Or Update Resource
Group. Template.
#csmParametersFile: # string. Optional. Use when action = Create Or
Update Resource Group. Template Parameters.
#overrideParameters: # string. Optional. Use when action = Create Or
Update Resource Group. Override Template Parameters.
#deploymentMode: 'Incremental' # 'Validation' | 'Incremental' |
'Complete'. Required when action = Create Or Update Resource Group.
Deployment Mode. Default: Incremental.
#enableDeploymentPrerequisitesForCreate: false # boolean. Optional. Use
when action = Create Or Update Resource Group. Enable Deployment
Prerequisites. Default: false.
#enableDeploymentPrerequisitesForSelect: false # boolean. Optional. Use
when action = Select Resource Group. Enable Deployment Prerequisites.
Default: false.
# Output
#outputVariable: # string. Resource Group.
Inputs
ConnectedServiceNameSelector - Azure Connection Type
Required. Selects the service connection that contains an Azure Subscription for the
deployment.
Required. Selects the service connection that contains an Azure Subscription for the
deployment.
action - Action
string . Required when ConnectedServiceNameSelector = ConnectedServiceName . Allowed
values: Create Or Update Resource Group , Select Resource Group , Start (Start Virtual
Machines), Stop (Stop Virtual Machines), Restart (Restart Virtual Machines), Delete
(Delete Virtual Machines), DeleteRG (Delete Resource Group). Default value: Create Or
Update Resource Group .
Allowed values: Select Resource Group (Select Cloud Service). Default value: Select
Resource Group .
location - Location
string . Required when action = Create Or Update Resource Group . Allowed values:
Australia East , Australia Southeast , Brazil South , Canada Central , Canada East ,
Central India , Central US , East Asia , East US , East US 2 , Japan East , Japan West ,
North Central US , North Europe , South Central US , South India , Southeast Asia , UK
South , UK West , West Central US , West Europe , West India , West US , West US 2 . Default
value: East US .
The location to deploy the resource group. If the resource group already exists in the
subscription, then this value will be ignored.
csmFile - Template
string . Required when action = Create Or Update Resource Group .
Specifies the path or a pattern pointing to the Azure Resource Manager template. Learn
more about Azure Resource Manager templates . To get started immediately, use this
sample template .
simple-windows/azuredeploy.parameters.json
To use a file stored in a private storage account, retrieve and include the shared access
signature (SAS) token in the URL of the template. Example:
<blob_storage_url>/template.json?<SAStoken> To upload a parameters file to a storage
account and generate a SAS token, use the Azure file copy task or follow the steps
using PowerShell or Azure CLI .
To view the template parameters in a grid, click on … next to the override template
parameters text box. This feature requires that CORS rules are enabled at the source. If
templates are in Azure storage blob, refer to Cross-Origin Resource Sharing to enable
CORS.
To view the template parameters in a grid, click on ... next to the Override Parameters
textbox. This feature requires that CORS rules are enabled at the source. If the templates
are in the Azure storage blob, reference this string to enable CORS, or type the template
parameters to override in the textbox.
azureKeyVaultName $(fabrikamFibre) .
If the parameter value has multiple words, enclose the words in quotes, even if you're
passing the value by using variables. For example, -name "parameter value" -name2
"$(var)" . To override object type parameters, use stringified JSON objects. For example,
string . Required when action = Create Or Update Resource Group . Allowed values:
Validation (Validation Only), Incremental , Complete . Default value: Incremental .
relatively more time than incremental mode. If the task times out, consider increasing
the timeout or changing to the Incremental mode.
2 Warning
Complete mode will delete all the existing resources in the resource group that are
not specified in the template. Do review if the resource group you're deploying to
doesn't contain any necessary resources that are not specified in the template.
Validate mode enables you to find problems with the template before creating actual
resources.
7 Note
The Validate mode always creates a resource group, even if no resources are
deployed.
boolean . Optional. Use when action = Create Or Update Resource Group . Default value:
false .
Choosing the Deployment Group option configures the Deployment Group agent on
each of the virtual machines.
Selecting the WinRM option configures the Windows Remote Management (WinRM)
listener over HTTPS protocol on port 5986 using a self-signed certificate. This
configuration is required for performing deployment operation on Azure machines. If
the target virtual machines are backed by a load balancer, ensure the Inbound NAT rules
are configured for the target port (5986).
boolean . Optional. Use when action = Select Resource Group . Default value: false .
Selecting the WinRM option configures the Windows Remote Management (WinRM)
listener over HTTPS protocol on port 5986 using a self-signed certificate. This
configuration is required for performing deployment operation on Azure machines. If
the target virtual machines are backed by a load balancer, ensure the Inbound NAT rules
are configured for the target port (5986).
string .
Required when an existing resource group is selected. Provides a name for the resource
group variable. The variable can be used as $(variableName) to refer to the resource
group in subsequent tasks, such as in PowerShell on Target Machines task for deploying
applications.
Output variables
None.
Requirements
ノ Expand table
Requirement Description
Demands Self-hosted agents must have capabilities that match the following demands
to run jobs that use this task: azureps
Requirement Description
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Command Any
restrictions
Feedback
Was this page helpful? Yes No
This task deploys applications to Azure Spring Apps and manages those deployments.
) Important
This task is supported on Azure Spring Apps Basic/Standard and Enterprise plans.
For more information, see Automate application deployments to Azure Spring
Apps.
Syntax
YAML
Inputs
azureSubscription - Azure subscription
Action - Action
string . Required. Allowed values: Deploy , Set Production (Set Production Deployment),
Delete Staging Deployment . Default value: Deploy .
string . Required.
AppName - App
string . Required.
The name of the Azure Spring Apps app to deploy. The app must exist prior to the task
execution.
To deploy with source code or Java package, choose "Artifacts"; To deploy with
container image, choose "Custom Container".
boolean . Optional. Use when Action = Deploy || Action = Set Production . Default
value: true .
At the time the task runs, this input automatically selects the deployment that's set as
staging .
If set to true , apply the task to the deployment that is set as the staging deployment at
time of execution. If omitted, the DeploymentName parameter must be set.
value: false .
If set to true , and the deployment specified by DeploymentName does not exist at
execution time, it will be created. If omitted, the DeploymentName parameter must be set.
DeploymentName - Deployment
string . Optional. Use when UseStagingDeployment = false && Action != Delete Staging
Deployment .
The deployment to which this task will apply. If not using blue-green deployments, set
this field to default . The value must start with a letter and consist of lowercase letters
and numbers only.
string . Optional. Use when Action = Deploy && DeploymentType = Artifacts . Default
value: $(System.DefaultWorkingDirectory)/**/*.jar .
The file path to the package or folder containing the Azure Spring Apps app contents
( .jar file for Java, .zip for .NET Core).
Variables ( Build | Release) and wildcards are supported.
For example, $(System.DefaultWorkingDirectory)/**/*.jar
Builder - Builder
string . Optional. Use when Action = Deploy && DeploymentType = Artifacts .
Select a builder of VMware Tanzu® Build Service™, this can be used in enterprise tier.
For detailed description, please check Use Tanzu Build Service.
The environment variables to be entered using the syntax -key value (for example: -
CUSTOMER_NAME Contoso -WEBSITE_TIME_ZONE ). Values containing spaces should be
Edits the app's JVM options. A string containing JVM options, such as -Xms1024m -
Xmx2048m .
string . Optional. Use when Action = Deploy && DeploymentType = Artifacts . Allowed
values: Java_8 (Java 8), Java_11 (Java 11), Java_17 (Java 17), Java_21 (Java 21),
NetCore_31 (.Net Core 3.1). Default value: Java_11 .
Version - Version
string . Optional. Use when Action = Deploy .
The deployment version. If not set, the version is left unchanged.
Output variables
This task defines the following output variables, which you can consume in downstream
steps, jobs, and stages.
testEndpoint
After the 'Deploy' action only. Contains private URL for accessing the updated
deployment.
Remarks
Use this task to deploy applications to Azure Spring Apps and to manage Azure Spring
Cloud deployments.
) Important
This task is supported on Azure Spring Apps Basic/Standard and Enterprise plans.
For more information, see Automate application deployments to Azure Spring
Apps.
Examples
The following examples demonstrate common usage scenarios. For more information,
see Automate application deployments to Azure Spring Apps.
variables:
azureSubscription: Contoso
steps:
- task: AzureSpringCloud@0
continueOnError: true # Don't fail the pipeline if a staging deployment
doesn't already exist.
inputs:
continueOnError: true
inputs:
azureSubscription: $(azureSubscription)
Action: 'Delete Staging Deployment'
AppName: customer-api
AzureSpringCloud: contoso-dev-az-spr-cld
Deploying
To production
The following example deploys to the default production deployment in Azure Spring
Apps. This is the only possible deployment scenario when using the Basic SKU:
7 Note
The package search pattern should only return exactly one package. If the build
task produces multiple JAR packages such as sources.jar and javadoc.jar, you need
to refine the search pattern so that it only matches the application binary artifact.
yml
variables:
azureSubscription: Contoso
steps:
- task: AzureSpringCloud@0
inputs:
azureSubscription: $(azureSubscription)
Action: 'Deploy'
AzureSpringCloud: contoso-dev-az-spr-cld
AppName: customer-api
UseStagingDeployment: false
DeploymentName: default
Package: '$(System.DefaultWorkingDirectory)/**/*customer-api*.jar'
Blue-green
The following example deploys to a pre-existing staging deployment. This deployment
will not receive production traffic until it is set as a production deployment.
yml
variables:
azureSubscription: Contoso
steps:
- task: AzureSpringCloud@0
inputs:
azureSubscription: $(azureSubscription)
Action: 'Deploy'
AzureSpringCloud: contoso-dev-az-spr-cld
AppName: customer-api
UseStagingDeployment: true
Package: '$(System.DefaultWorkingDirectory)/**/*customer-api*.jar'
yml
variables:
azureSubscription: Contoso
steps:
- task: AzureSpringCloud@0
inputs:
azureSubscription: $(azureSubscription)
Action: 'Set Production'
AzureSpringCloud: contoso-dev-az-spr-cld
AppName: customer-api
UseStagingDeployment: true
Requirements
ノ Expand table
Requirement Description
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Feedback
Was this page helpful? Yes No
Use this task to deploy an Azure SQL Database using DACPAC, or run scripts using
SQLCMD.
Syntax
# Azure SQL Database deployment v1
# Deploy an Azure SQL Database using DACPAC or run scripts using SQLCMD.
- task: SqlAzureDacpacDeployment@1
inputs:
#azureConnectionType: 'ConnectedServiceNameARM' # 'ConnectedServiceName'
| 'ConnectedServiceNameARM'. Alias: ConnectedServiceNameSelector. Azure
Service Connection Type. Default: ConnectedServiceNameARM.
#azureClassicSubscription: # string. Alias: ConnectedServiceName.
Required when ConnectedServiceNameSelector = ConnectedServiceName. Azure
Classic Subscription.
azureSubscription: # string. Alias: ConnectedServiceNameARM. Required
when ConnectedServiceNameSelector = ConnectedServiceNameARM. Azure
Subscription.
# SQL Database
AuthenticationType: 'server' # 'server' | 'aadAuthenticationPassword' |
'aadAuthenticationIntegrated' | 'connectionString' | 'servicePrincipal'.
Required. Authentication Type. Default: server.
#ServerName: # string. Required when AuthenticationType = server ||
AuthenticationType = aadAuthenticationPassword || AuthenticationType =
aadAuthenticationIntegrated || AuthenticationType = servicePrincipal. Azure
SQL Server.
#DatabaseName: # string. Required when AuthenticationType = server ||
AuthenticationType = aadAuthenticationPassword || AuthenticationType =
aadAuthenticationIntegrated || AuthenticationType = servicePrincipal.
Database.
SqlUsername: # string. Required when AuthenticationType = server. Login.
SqlPassword: # string. Required when AuthenticationType = server.
Password.
#aadSqlUsername: # string. Required when AuthenticationType =
aadAuthenticationPassword. Login.
#aadSqlPassword: # string. Required when AuthenticationType =
aadAuthenticationPassword. Password.
#ConnectionString: # string. Required when AuthenticationType =
connectionString. Connection String.
# Deployment Package
deployType: 'DacpacTask' # 'DacpacTask' | 'SqlTask' | 'InlineSqlTask'.
Alias: TaskNameSelector. Required. Deploy type. Default: DacpacTask.
DeploymentAction: 'Publish' # 'Publish' | 'Extract' | 'Export' |
'Import' | 'Script' | 'DriftReport' | 'DeployReport'. Required when
TaskNameSelector = DacpacTask. Action. Default: Publish.
#DacpacFile: # string. Required when DeploymentAction = Publish ||
DeploymentAction = Script || DeploymentAction = DeployReport. DACPAC File.
#BacpacFile: # string. Required when DeploymentAction = Import. BACPAC
File.
#SqlFile: # string. Required when TaskNameSelector = SqlTask. SQL
Script.
#SqlInline: # string. Required when TaskNameSelector = InlineSqlTask.
Inline SQL Script.
#PublishProfile: # string. Optional. Use when TaskNameSelector =
DacpacTask || DeploymentAction = Script || DeploymentAction = DeployReport.
Publish Profile.
#AdditionalArguments: # string. Optional. Use when TaskNameSelector =
DacpacTask || DeploymentAction = Extract || DeploymentAction = Export ||
DeploymentAction = Import || DeploymentAction = Script || DeploymentAction =
DeployReport || DeploymentAction = DriftReport. Additional SqlPackage.exe
Arguments.
#SqlAdditionalArguments: # string. Optional. Use when TaskNameSelector =
SqlTask. Additional Invoke-Sqlcmd Arguments.
#InlineAdditionalArguments: # string. Optional. Use when
TaskNameSelector = InlineSqlTask. Additional Invoke-Sqlcmd Arguments.
# Firewall
IpDetectionMethod: 'AutoDetect' # 'AutoDetect' | 'IPAddressRange'.
Required. Specify Firewall Rules Using. Default: AutoDetect.
#StartIpAddress: # string. Required when IpDetectionMethod =
IPAddressRange. Start IP Address.
#EndIpAddress: # string. Required when IpDetectionMethod =
IPAddressRange. End IP Address.
#DeleteFirewallRule: true # boolean. Delete Rule After Task Ends.
Default: true.
Inputs
azureConnectionType - Azure Service Connection Type
Specifies the target Azure classic subscription for deploying SQL files.
Specifies the target Azure Resource Manager subscription for deploying SQL files.
Specifies the type of database authentication. It can be an SQL Server, Active Directory
(integrated), Active Directory (password), connection string, or service principal
authentication. Integrated authentication means that the agent accesses the database
using its current Active Directory account context.
Specify the option to connect to the Azure SQL Server database. You can provide the
Azure SQL Server database details, the SQL Server connection string, AD Authentication
(password or integrated), or use a service principal. For SQL Server authentication, use
the SQL Server's user credentials. For AD authentication, use the credentials for the AD
user configured to the SQL Server.
DatabaseName - Database
Specifies the name of the Azure SQL database where the files are deployed.
SqlUsername - Login
SqlPassword - Password
string . Required when AuthenticationType = server .
Specifies the password for the Azure SQL Server administrator. Variables defined in the
build or release pipelines as $(passwordVariable) are accepted. You can mark the
variable type as secret to secure it.
aadSqlUsername - Login
aadSqlPassword - Password
string . Required when AuthenticationType = aadAuthenticationPassword .
Specifies the password for the Active Directory user. Variables defined in the build or
release pipelines as $(passwordVariable) are accepted. You can mark the variable type
as secret to secure it.
ID=AccountPlaceholder;Password=$(securePassword); .
DeploymentAction - Action
string . Required when TaskNameSelector = DacpacTask . Allowed values: Publish ,
DeploymentAction = DeployReport .
Specifies the location of the DACPAC file on the automation agent or on a UNC path
that's accessible to the automation agent, like
\\BudgetIT\Web\Deploy\FabrikamDB.dacpac . Predefined system variables, like
$(agent.releaseDirectory) , can also be used.
Specifies the location of the BACPAC file on the automation agent or on a UNC path
that's accessible to the automation agent, like
\\BudgetIT\Web\Deploy\FabrikamDB.bacpac . Predefined system variables, like
Specifies the location of the SQL script file on the automation agent or on a UNC path
that's accessible to the automation agent, like \\BudgetIT\Web\Deploy\FabrikamDB.sql .
Predefined system variables, like $(agent.releaseDirectory) , can also be used.
DriftReport .
Specifies the additional SqlPackage.exe arguments that will be applied when deploying
the Azure SQL database if the DACPAC option is selected, like /p:IgnoreAnsiNulls=True
/p:IgnoreComments=True . These arguments will override the settings in the publish profile
Specifies the additional Invoke-Sqlcmd arguments that are applied when executing the
given SQL query on the Azure SQL database, like -ConnectionTimeout 100 -
OutputSqlErrors .
Specifies the additional Invoke-Sqlcmd arguments that are applied when executing the
given SQL query on the Azure SQL Database, like -ConnectionTimeout 100 -
OutputSqlErrors .
AutoDetect .
For the task to run, the IP address of the automation agent must be added to the
Allowed IP Addresses in the Azure SQL Server's firewall. Select auto-detect to
automatically add the firewall exception for the range of the possible IP address of the
automation agent, or specify the range explicitly.
StartIpAddress - Start IP Address
Specifies the starting IP address of the automation agent machine pool, like
196.21.30.50 .
Specifies the ending IP address of the automation agent machine pool, like
196.21.30.65 .
If selected, after the task ends, the IP addresses specified here are deleted from the
Allowed IP Addresses list in the Azure SQL Server's firewall.
Output variables
This task defines the following output variables, which you can consume in downstream
steps, jobs, and stages.
SqlDeploymentOutputFile
The generated output file path when the deployment package action is Extract ,
Export , Script , DriftReport , or DeployReport .
Remarks
Use this task to deploy an Azure SQL database using a DACPAC, or run scripts using
SQLCMD.
) Important
This task is only supported in a Windows environment. If you are trying to use
Azure Active Directory (Azure AD) integrated authentication, you must create a
private agent. Azure AD integrated authentication is not supported for hosted
agents.
Requirements
ノ Expand table
Requirement Description
Runs on Agent
Demands Self-hosted agents must have capabilities that match the following demands
to run jobs that use this task: sqlpackage
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Command Any
restrictions
Feedback
Was this page helpful? Yes No
Syntax
YAML
Inputs
azureSubscription - Azure subscription
action - Action
string . Required. Allowed values: Update image (Update VM Scale set by using an
Updates a VM scale set by the chosen method, using a VHD image and/or by running
deployment/install scripts using the Custom Script VM Extension.
The VHD image approach is better for scaling quickly and doing rollback. When a VM
scale set is created by using a custom image, it can be updated by a VHD image. The
update will fail if the VM scale set was created by using a platform/gallery image
available in Azure.
The Custom Script VM Extension approach is useful for post deployment configuration,
software installation, or any other configuration/management task. The Custom Script
VM Extension approach can be used for a VM scale set created by using either a custom
image or a platform/gallery image.
Specifies the name of the VM scale setting to update. Use either a VHD image or a
Custom Script VM Extension.
vmssOsType - OS type
string . Required. Allowed values: Windows , Linux .
Specifies the URL of the VHD image. If it's an Azure storage blob URL, the storage
account location is the same as the scale set location.
Optional. The path to the directory containing the custom script(s) that are run by using
the Custom Script VM Extension. The extension approach is useful for post deployment
configuration, application/software installation, or any other application
configuration/management task. For example, the script can set a machine level
environment variable which the application uses, like database connection strings.
customScript - Command
string . Optional. Use when action = Configure application startup || action =
Optional. The script that is run by using the Custom Script VM Extension. This script can
invoke other scripts in the directory and is invoked with the arguments passed below.
In conjunction with such arguments, this script can be used to execute commands.
For example:
application.
2. install-secrets.sh --key-vault-type prod -key serviceprincipalkey creates an
encrypted file containing a service principal key.
customScriptArguments - Arguments
string . Optional. Use when action = Configure application startup || action =
Optional. The custom script will be invoked with arguments passed. Build/release
variables can be used, which makes it easy to use secrets.
uploaded
string . Optional. Use when action = Configure application startup || action =
Optional. The Custom Script Extension downloads and executes the provided scripts on
each virtual machine in the VM scale set. These scripts will be stored in the pre-existing
ARM storage account specified here.
skipArchivingCustomScripts - Skip Archiving custom scripts
Optional. By default, this task creates a compressed archive of the directory containing
the custom scripts. This improves performance and reliability while uploading to Azure
storage. If not selected, archiving will not be done and all files will be individually
uploaded.
Output variables
None.
Remarks
Use this task to deploy a Virtual Machine scale set image.
name>
yml
customScript: 'test.sh'
Next, try adding a command line task before the virtual machine scale set task:
yml
- task: CmdLine@2
inputs:
script: 'chmod 777 $(System.DefaultWorkingDirectory)/test.sh'
Requirements
ノ Expand table
Requirement Description
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Feedback
Was this page helpful? Yes No
Syntax
YAML
Inputs
azureSubscription - Azure subscription
string . Required.
Specifies the Azure Resource Manager subscription connection for the deployment.
string . Required. Allowed values: webApp (Web App on Windows), webAppLinux (Web
App on Linux).
string . Required.
Specifies the name of an existing Azure App Service. Only app services that are based on
the selected app type will be listed.
Selects the option to deploy to an existing deployment slot or an Azure App Service
Environment.
For both targets, the task needs a resource group name.
If the deployment target is a slot, the default is the production slot. Any other existing
slot name can also be provided.
If the deployment target is an Azure App Service Environment, leave the slot name as
‘production’, and specify the resource group name.
The resource group name is required when the deployment target is either a
deployment slot or an Azure App Service Environment.
Specifies the Azure resource group that contains the Azure App Service indicated above.
slotName - Slot
The file path to the package or folder that contains App Service content generated by
MSBuild, a compressed zip file, or a war file. Variables ( Build | Release) and wildcards are
supported. For example, $(System.DefaultWorkingDirectory)/**/*.zip or
$(System.DefaultWorkingDirectory)/**/*.war .
Web App on Linux offers two different options to publish your application: custom
image deployment (Web App for Containers) and app deployment with a built-in
platform image (Web App on Linux). This parameter is only available when Linux Web
App is selected as an app type in the task.
apps
string . Optional. Use when appType != webAppLinux && package NotEndsWith .war .
A standard web.config will be generated and deployed to Azure App Service if the
application does not have one. The values in web.config vary based on the application
framework, and they can be edited. For example, for the node.js application, web.config
will have a startup file and iis_node module values. This edit feature is only for the
generated web.config .
string .
Specify the web app application settings using the syntax -key value (for example: -
Port 5000 -RequestTimeout 5000 -WEBSITE_TIME_ZONE ). Enclose values that contain
Specify the web app configuration settings using the syntax -key value (for example: -
phpVersion 5.6 -linuxFxVersion: node|6.11 ). Enclose values that contain spaces in
double quotes.
string . Required when appType != webAppLinux && appType != "" && package
NotEndsWith .war && package NotEndsWith .jar . Allowed values: auto (Auto-detect),
zipDeploy (Zip Deploy), runFromPackage (Run From Package). Default value: auto .
Choose the deployment method for the app. Acceptable values are auto, zipDeploy,
and runFromPackage.
Output variables
This task defines the following output variables, which you can consume in downstream
steps, jobs, and stages.
AppServiceApplicationUrl
Remarks
Use this task to deploy web applications to Azure App Service.
Deployment methods
Several deployment methods are available in this task. Auto is the default option.
Based on the type of Azure App Service and Azure Pipelines agent, the task chooses a
suitable deployment technology. The different deployment technologies used by the
task are:
By default, the task tries to select the appropriate deployment technology given the
input package, app service type, and agent OS.
When the app service type is Web App on Linux App, use Zip Deploy
If a War file is provided, use War Deploy
If a Jar file is provided, use Run From Package
For all others, use Run From Zip (via Zip Deploy)
On a non-Windows agent (for any app service type), the task relies on Kudu REST APIs
to deploy the web app.
Zip Deploy
Creates a .zip deployment package of the chosen package or folder. The file contents
are then deployed to the wwwroot folder of the function app in Azure App Service. This
option overwrites all existing contents in the wwwroot folder. For more information, see
Zip deployment for Azure Functions.
RunFromPackage
Creates the same deployment package as Zip Deploy. However, instead of deploying
files to the wwwroot folder, the entire package is mounted by the Azure Functions
runtime. With this option, files in the wwwroot folder become read-only. For more
information, see Run your Azure Functions from a package file.
Error: Could not fetch access token for Azure. Verify if the
Service Principal used is valid and not expired.
The task uses the service principal in the service connection to authenticate with Azure.
If the service principal has expired or doesn't have permissions to the App Service, the
task fails with this error. Verify the validity of the service principal used and that it's
present in the app registration. For more information, see Use role-based access control
to manage access to your Azure subscription resources. This blog post also contains
more information about using service principal authentication.
SSL error
If you want to use a certificate in App Service, the certificate must be signed by a trusted
certificate authority. If your web app gives you certificate validation errors, you're
probably using a self-signed certificate. Set a variable named
VSTS_ARM_REST_IGNORE_SSL_ERRORS to the value true in the build or release pipeline to
/p:publishUrl="$(System.DefaultWorkingDirectory)\\WebAppContent" :
b. Clear the Prepend root folder name to archive paths check box:
FAQs
The Azure Web App task ( AzureWebApp ) is the simplest way to deploy to an Azure Web
App. By default, your deployment happens to the root application in the Azure Web
App.
The Azure App Service Deploy task (AzureRmWebAppDeployment) can handle more
custom scenarios, such as:
Modify configuration settings inside web packages and XML parameters files.
Deploy with Web Deploy, if you're used to the IIS deployment process.
Deploy to virtual applications.
Deploy to other app types, like Container apps, Function apps, WebJobs, or API
and Mobile apps.
7 Note
File transforms and variable substitution are also supported by the separate File
Transform task for use in Azure Pipelines. You can use the File Transform task to
apply file transformations and variable substitutions on any configuration and
parameters files.
Insights extension in a safe state. This step is required because the Application Insights
continuous WebJob is installed into the App_Data folder.
Examples
Following is an example YAML snippet to deploy web application to the Azure Web App
Service running on Windows.
YAML
variables:
azureSubscription: Contoso
# To ignore SSL error uncomment the below variable
# VSTS_ARM_REST_IGNORE_SSL_ERRORS: true
steps:
- task: AzureWebApp@1
displayName: Azure Web App Deploy
inputs:
azureSubscription: $(azureSubscription)
appName: samplewebapp
package: $(System.DefaultWorkingDirectory)/**/*.zip
To deploy Web App on Linux, add the appType parameter and set it to appType:
webAppLinux .
To specify the deployment method as Zip Deploy, add the parameter deploymentMethod:
zipDeploy . Another supported value for this parameter is runFromPackage .
Requirements
ノ Expand table
Requirement Description
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Requirement Description
Feedback
Was this page helpful? Yes No
Syntax
YAML
Inputs
azureSubscription - Azure subscription
string . Required.
The name of the Azure Resource Manager subscription for the deployment.
string . Required.
Specifies the name of an existing Azure App Service. Only app services based on the
selected app type will be listed.
deployToSlotOrASE - Deploy to Slot or App Service Environment
boolean . Default value: false .
Selects the option to deploy to an existing deployment slot or an Azure App Service
Environment.
For both targets, the task needs a resource group name.
If the deployment target is a slot, the default is the production slot. Any other existing
slot name can also be provided.
If the deployment target is an Azure App Service Environment, leave the slot name as
production , and specify the resource group name.
The resource group name is required when the deployment target is either a
deployment slot or an Azure App Service Environment.
Specifies the Azure resource group that contains the Azure App Service indicated above.
slotName - Slot
string .
The path of the Docker-Compose file. Must be a fully qualified path or a path relative to
the default working directory.
string .
Specifies the start up command.
For example:
dotnet run
dotnet filename.dll
Edits the web app application settings using the syntax -key value (for example: -Port
5000 -RequestTimeout 5000 -WEBSITE_TIME_ZONE ). A value containing spaces should be
string .
Edits the web app application settings using the syntax -key value (for example: -
phpVersion 5.6 -linuxFxVersion: node|6.11 ). A value containing spaces should be
Output variables
This task defines the following output variables, which you can consume in downstream
steps, jobs, and stages.
AppServiceApplicationUrl
The application URL of the selected Azure App Service.
Requirements
ノ Expand table
Requirement Description
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Feedback
Was this page helpful? Yes No
Syntax
YAML
# Bash v3
# Run a Bash script on macOS, Linux, or Windows.
- task: Bash@3
inputs:
#targetType: 'filePath' # 'filePath' | 'inline'. Type. Default:
filePath.
filePath: # string. Required when targetType = filePath. Script Path.
#arguments: # string. Optional. Use when targetType = filePath.
Arguments.
#script: # string. Required when targetType = inline. Script.
# Advanced
#workingDirectory: # string. Working Directory.
#failOnStderr: false # boolean. Fail on Standard Error. Default: false.
#bashEnvValue: # string. Set value for BASH_ENV environment variable.
Inputs
targetType - Type
string . Allowed values: filePath (File Path), inline . Default value: filePath .
The path of the script to execute. This must be a fully qualified path or relative to
$(System.DefaultWorkingDirectory) .
arguments - Arguments
script - Script
string . Required when targetType = inline . Default value: # Write your commands
string .
Specifies the working directory in which you want to run the command. If you leave it
empty, the working directory is $(Build.SourcesDirectory).
If this is true, this task will fail if any errors are written to the StandardError stream.
If the input is specified, its value is expanded and used as the path of a startup file to
execute before running the script. If the environment variable BASH_ENV has already
been defined, the task will override this variable only for the current task. Learn more
about Bash Startup Files .
Output variables
None.
Remarks
The bash task has a shortcut in YAML: steps.bash.
yml
steps:
- bash: string # Required as first property. An inline script.
## Other task inputs
The Bash task will find the first Bash implementation on your system. Running which
bash on Linux/macOS or where bash on Windows will give you an idea of which one it
will select.
There are several options for defining the BASH_ENV environment variable in a pipeline.
Firstly, it's possible to set the BASH_ENV environment variable as a pipeline variable. In
this case, each instance of the Bash task will try to unfold the value of the BASH_ENV
variable and use its value.
YAML
variables:
BASH_ENV: "~/.profile"
steps:
- task: Bash@3
inputs:
targetType: 'inline'
script: env
Another option is to set BASH_ENV for one particular instance of the Bash task, there are
two ways how this can be done:
The first way is to use the bashEnvValue task input, see an example for reference:
YAML
steps:
- task: Bash@3
inputs:
targetType: 'inline'
script: env
bashEnvValue: '~/.profile'
Another way is to set the BASH_ENV variable as an environment variable for the pipeline
task via the env keyword, for example:
YAML
- task: Bash@3
inputs:
targetType: 'inline'
script: env
env:
BASH_ENV: '~/.profile'
7 Note
Note that if the bashEnvValue input is defined in the Bash task, the pipeline task will
override the value of the BASH_ENV variable with the value from the bashEnvValue
input in a case when the BASH_ENV environment variable was already defined in the
environment.
Bash scripts checked into the repo should be set executable ( chmod +x ). Otherwise, the
task will show a warning and source the file instead.
Examples
You can map in variables using the env parameter which is common across all tasks, and
is list of additional items to map into the process's environment. For example, secret
variables are not automatically mapped. If you have a secret variable called Foo , you can
map it in like this:
YAML
steps:
- task: Bash@3
inputs:
targetType: 'inline'
script: echo $MYSECRET
env:
MYSECRET: $(Foo)
YAML
steps:
- script: echo $MYSECRET
env:
MYSECRET: $(Foo)
Requirements
ノ Expand table
Requirement Description
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Feedback
Was this page helpful? Yes No
Use this task to run a Windows .bat or .cmd script. Optionally, the .bat or .cmd script
can permanently modify environment variables.
Syntax
YAML
# Batch script v1
# Run a Windows command or batch script and optionally allow it to change
the environment.
- task: BatchScript@1
inputs:
filename: # string. Required. Path.
#arguments: # string. Arguments.
#modifyEnvironment: False # boolean. Modify Environment. Default: False.
# Advanced
#workingFolder: # string. Working folder.
#failOnStandardError: false # boolean. Fail on Standard Error. Default:
false.
Inputs
filename - Path
string . Required.
The path of the .cmd or .bat script to execute. This should be a fully qualified path or
one relative to the default working directory. (Please note that the working directory
could differ from workingFolder , which could be specified for this task.)
arguments - Arguments
string .
The current working directory when a script is run. This defaults to the folder where the
script is located.
If this is true, this task will fail if any errors are written to the StandardError stream.
Output variables
None.
Remarks
Use this task to run a Windows .bat or .cmd script. Optionally, allow it to permanently
modify environment variables.
7 Note
This task is not compatible with Windows containers. If you need to run a batch
script on a Windows container, use the command line task instead.
Examples
Create test.bat at the root of your repo:
bat
@echo off
echo Hello World from %AGENT_NAME%.
echo My ID is %AGENT_ID%.
echo AGENT_WORKFOLDER contents:
@dir %AGENT_WORKFOLDER%
echo AGENT_BUILDDIRECTORY contents:
@dir %AGENT_BUILDDIRECTORY%
echo BUILD_SOURCESDIRECTORY contents:
@dir %BUILD_SOURCESDIRECTORY%
echo Over and out.
yml
- task: BatchScript@1
inputs:
filename: 'test.bat'
Requirements
ノ Expand table
Requirement Description
Demands Self-hosted agents must have capabilities that match the following demands
to run jobs that use this task: Cmd
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Command Any
restrictions
Feedback
Was this page helpful? Yes No
Use this task to build a machine image using Packer, which may be used for Azure
Virtual machine scale set deployment.
7 Note
This task does not support Azure Resource Manager authentication with workflow
identity federation.
Syntax
# Build machine image v1
# Build a machine image using Packer, which may be used for Azure Virtual
machine scale set deployment.
- task: PackerBuild@1
inputs:
templateType: 'builtin' # 'builtin' | 'custom'. Required. Packer
template. Default: builtin.
#customTemplateLocation: # string. Required when templateType = custom.
Packer template location.
#customTemplateParameters: '{}' # string. Optional. Use when
templateType = custom. Template parameters. Default: {}.
# Azure Details
ConnectedServiceName: # string. Required when templateType = builtin.
Azure subscription.
#isManagedImage: true # boolean. Optional. Use when templateType =
builtin. Managed VM disk image. Default: true.
#managedImageName: # string. Required when isManagedImage = true &&
templateType = builtin. Managed VM Disk Image Name.
location: # string. Required when templateType = builtin. Storage
location.
storageAccountName: # string. Required when templateType = builtin.
Storage account.
azureResourceGroup: # string. Required when templateType = builtin.
Resource group.
# Deployment Inputs
baseImageSource: 'default' # 'default' | 'customVhd'. Required when
templateType = builtin. Base image source. Default: default.
#baseImage: 'MicrosoftWindowsServer:WindowsServer:2012-R2-
Datacenter:windows' # 'MicrosoftWindowsServer:WindowsServer:2012-R2-
Datacenter:windows' | 'MicrosoftWindowsServer:WindowsServer:2016-
Datacenter:windows' | 'MicrosoftWindowsServer:WindowsServer:2012-
Datacenter:windows' | 'MicrosoftWindowsServer:WindowsServer:2008-R2-
SP1:windows' | 'Canonical:UbuntuServer:14.04.4-LTS:linux' |
'Canonical:UbuntuServer:16.04-LTS:linux' | 'Canonical:UbuntuServer:18.04-
LTS:linux' | 'RedHat:RHEL:7.2:linux' | 'RedHat:RHEL:6.8:linux' |
'OpenLogic:CentOS:7.2:linux' | 'OpenLogic:CentOS:6.8:linux' |
'credativ:Debian:8:linux' | 'credativ:Debian:7:linux' | 'SUSE:openSUSE-
Leap:42.2:linux' | 'SUSE:SLES:12-SP2:linux' | 'SUSE:SLES:11-SP4:linux'.
Required when baseImageSource = default && templateType = builtin. Base
image. Default: MicrosoftWindowsServer:WindowsServer:2012-R2-
Datacenter:windows.
#customImageUrl: # string. Required when baseImageSource = customVhd &&
templateType = builtin. Base image URL.
#customImageOSType: 'windows' # 'windows' | 'linux'. Required when
baseImageSource = customVhd && templateType = builtin. Base image OS.
Default: windows.
packagePath: # string. Required when templateType = builtin. Deployment
Package.
deployScriptPath: # string. Required when templateType = builtin.
Deployment script.
#deployScriptArguments: # string. Optional. Use when templateType =
builtin. Deployment script arguments.
# Advanced
#additionalBuilderParameters: '{"vm_size":"Standard_D3_v2"}' # string.
Optional. Use when templateType = builtin. Additional Builder parameters.
Default: {"vm_size":"Standard_D3_v2"}.
#skipTempFileCleanupDuringVMDeprovision: true # boolean. Optional. Use
when templateType = builtin. Skip temporary file cleanup during deprovision.
Default: true.
#packerVersion: # string. Optional. Use when templateType = custom.
Packer Version.
# Output
#imageUri: # string. Image URL or Name.
#imageId: # string. Azure Resource Id.
Inputs
templateType - Packer template
string . Required. Allowed values: builtin (Auto generated), custom (User provided).
Specifies whether the task auto generates a Packer template or uses a custom template
provided by you.
Specifies the parameters which will be passed to the Packer for building a custom
template. This should map to a variables section in your custom template. For
example, if the template has a variable named drop-location , then add a parameter
here with the name drop-location and a value which you want to use. You can link the
value to a release variable as well. To view/edit the additional parameters in a grid, click
on … next to text box.
Specifies the Azure Resource Manager subscription for baking and storing the machine
image.
Specifies the name of the Managed disk image for auto-generated templates.
Specifies the location for storing the built machine image. This location will also be used
to create a temporary VM for the purpose of building an image.
Specifies the storage account for storing the built machine image. This storage account
must be pre-existing in the location selected.
azureResourceGroup - Resource group
string . Required when templateType = builtin .
Specifies the Azure Resource group that contains the selected storage account.
Specifies the source of the base image. You can either choose from a curated gallery of
OS images or provide a URL of your custom VHD image.
7 Note
If you have selected the option to create a Managed image by checking the
Managed VM disk image option, then you should only choose the Gallery option
Chooses from a curated list of OS images. This will be used for installing pre-requisite(s)
and application(s) before capturing a machine image.
customImageUrl - Base image URL
string . Required when baseImageSource = customVhd && templateType = builtin .
Specifies the URL of a base image. This will be used for installing pre-requisite(s) and
application(s) before capturing a machine image.
7 Note
This package will be copied to a temporary virtual machine which Packer creates. If
the package contains a large number of files and/or the files are very large in size,
the upload can take a long time (possibly running for a few hours). To optimize the
upload time, please see if the size of the package can be meaningfully reduced.
Another alternative is to use an intermediary Azure storage account. Upload the
package to a storage account prior to running this task. For this task, use a package
containing a script which will download the required package from the storage
account.
Specifies the relative path to the powershell script (for Windows) or the shell script (for
Linux) which deploys the package. This script should be contained in the package path
selected above. Supports a minimatch pattern. Example path:
deploy/**/scripts/windows/deploy.ps1 .
deployScriptArguments - Deployment script arguments
string . Optional. Use when templateType = builtin .
In the auto-generated Packer template mode, the task creates a Packer template with an
Azure builder. This builder is used to generate a machine image. You can add keys to the
Azure builder to customize the generated Packer template. For example: Setting
ssh_tty=true if you are using a CentOS base image and you need to have a tty to run
sudo . To view/edit the additional parameters in a grid, click on … next to text box.
deprovision
boolean . Optional. Use when templateType = builtin . Default value: true .
During the deprovisioning of a VM, skips the cleanup of temporary files uploaded to the
VM. Learn more about Azure Virtual Machine Image Builders in Packer .
Specifies the version of Packer to install. This will work only with custom templates.
string .
Specifies a name for the output variable which will store the generated machine image
VHD URL for an un-managed VM image or the image name for a managed VM image.
string .
Specifies a name for the output variable which will store the Azure Resource ID for the
newly created image. This is for managed images only.
Task control options
All tasks have control options in addition to their task inputs. For more information, see
Control options and common task properties.
Output variables
None.
Remarks
Use this task to build a machine image using Packer. This image can be used for Azure
Virtual machine scale set deployment.
7 Note
If you want to enable detailed logs, navigate to Pipelines > Edit > Variables, and
then add a new variable PACKER_LOG and set its value to 1.
Requirements
ノ Expand table
Requirement Description
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Use this task to build a machine image using Packer, which may be used for Azure
Virtual machine scale set deployment.
7 Note
This task does not support Azure Resource Manager authentication with workflow
identity federation.
Syntax
# Build machine image v0
# Build a machine image using Packer, which may be used for Azure Virtual
machine scale set deployment.
- task: PackerBuild@0
inputs:
templateType: 'builtin' # 'builtin' | 'custom'. Required. Packer
template. Default: builtin.
#customTemplateLocation: # string. Required when templateType = custom.
Packer template location.
#customTemplateParameters: '{}' # string. Optional. Use when
templateType = custom. Template parameters. Default: {}.
# Azure Details
ConnectedServiceName: # string. Required when templateType = builtin.
Azure subscription.
location: # string. Required when templateType = builtin. Storage
location.
storageAccountName: # string. Required when templateType = builtin.
Storage account.
azureResourceGroup: # string. Required when templateType = builtin.
Resource group.
# Deployment Inputs
baseImageSource: 'default' # 'default' | 'customVhd'. Required when
templateType = builtin. Base image source. Default: default.
#baseImage: 'MicrosoftWindowsServer:WindowsServer:2012-R2-
Datacenter:windows' # 'MicrosoftWindowsServer:WindowsServer:2012-R2-
Datacenter:windows' | 'MicrosoftWindowsServer:WindowsServer:2016-
Datacenter:windows' | 'MicrosoftWindowsServer:WindowsServer:2012-
Datacenter:windows' | 'MicrosoftWindowsServer:WindowsServer:2008-R2-
SP1:windows' | 'Canonical:UbuntuServer:14.04.4-LTS:linux' |
'Canonical:UbuntuServer:16.04-LTS:linux' | 'RedHat:RHEL:7.2:linux' |
'RedHat:RHEL:6.8:linux' | 'OpenLogic:CentOS:7.2:linux' |
'OpenLogic:CentOS:6.8:linux' | 'credativ:Debian:8:linux' |
'credativ:Debian:7:linux' | 'SUSE:openSUSE-Leap:42.2:linux' | 'SUSE:SLES:12-
SP2:linux' | 'SUSE:SLES:11-SP4:linux'. Required when baseImageSource =
default && templateType = builtin. Base image. Default:
MicrosoftWindowsServer:WindowsServer:2012-R2-Datacenter:windows.
#customImageUrl: # string. Required when baseImageSource = customVhd &&
templateType = builtin. Base image URL.
#customImageOSType: 'windows' # 'windows' | 'linux'. Required when
baseImageSource = customVhd && templateType = builtin. Base image OS.
Default: windows.
packagePath: # string. Required when templateType = builtin. Deployment
Package.
deployScriptPath: # string. Required when templateType = builtin.
Deployment script.
#deployScriptArguments: # string. Optional. Use when templateType =
builtin. Deployment script arguments.
# Advanced
#additionalBuilderParameters: '{}' # string. Optional. Use when
templateType = builtin. Additional Builder parameters. Default: {}.
#skipTempFileCleanupDuringVMDeprovision: true # boolean. Optional. Use
when templateType = builtin. Skip temporary file cleanup during deprovision.
Default: true.
# Output
#imageUri: # string. Image URL.
Inputs
templateType - Packer template
string . Required. Allowed values: builtin (Auto generated), custom (User provided).
Specifies whether you want the task to auto generate a Packer template or use a custom
template provided by you.
Specifies parameters which will be passed to Packer for building a custom template. This
should map to the variables section in your custom template. For example, if the
template has a variable named drop-location , then add a parameter here with the
name drop-location and a value which you want to use. You can link the value to a
release variable as well. To view/edit the additional parameters in a grid, click on … next
to the text box.
Specifies the Azure Resource Manager subscription for baking and storing the machine
image.
Specifies the location for storing the built machine image. This location will also be used
to create a temporary VM for the purpose of building an image.
Specifies the storage account for storing the built machine image. This storage account
must be pre-existing in the location selected.
Specifies the Azure Resource group that contains the selected storage account.
Specifies the source of a base image. You can either choose from a curated gallery of OS
images or provide a URL of your custom image.
Chooses from a curated list of OS images. This is used for installing pre-requisite(s) and
application(s) before capturing a machine image.
Specifies the URL of a base image. This is used for installing pre-requisite(s) and
application(s) before capturing a machine image.
FrontendWebApp/**/GalleryApp .
Specifies the relative path to a powershell script (for Windows) or a shell script (for
Linux) which deploys the package. This script should be contained in the package path
selected above. Supports a minimatch pattern. Example path:
deploy/**/scripts/windows/deploy.ps1 .
In an auto-generated Packer template mode, the task creates a Packer template with an
Azure builder. This builder is used to generate a machine image. You can add keys to the
Azure builder to customize the generated Packer template. For example, setting
ssh_tty=true in case you are using a CentOS base image, and you need to have a tty to
run sudo.
To view or edit the additional parameters in a grid, click on … next to text box.
deprovision
boolean . Optional. Use when templateType = builtin . Default value: true .
During the deprovisioning of a VM, skips the cleanup of temporary files uploaded to the
VM. For more information, refer to Azure Virtual Machine Image Builders .
Specifies a name for the output variable which stores the generated machine image
URL.
Remarks
Use this task to build a machine image using Packer. This image can be used for Azure
Virtual machine scale set deployment.
7 Note
If you want to enable detailed logs, navigate to Pipelines > Edit > Variables, and
then add a new variable PACKER_LOG and set its value to 1.
Requirements
ノ Expand table
Requirement Description
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Feedback
Was this page helpful? Yes No
Improve build performance by using this task to cache files, like dependencies, between
pipeline runs. See Cache task: how it works and Reduce build time using caching for
specific examples and more details.
Syntax
# Cache v2
# Cache files between runs.
- task: Cache@2
inputs:
key: # string. Required. Key.
path: # string. Required. Path.
#cacheHitVar: # string. Cache hit variable.
#restoreKeys: # string. Additional restore key prefixes.
Inputs
key - Key
string . Required.
The key (unique identifier) for the cache. This should be a string that can be segmented
using | . File paths can be absolute or relative to $(System.DefaultWorkingDirectory) .
While there is no defined maximum number of segments for a key, if you are getting
cache misses, try using a shorter key with fewer segments, for example by creating a
new key that is a hash of your segments.
path - Path
string . Required.
supported.
string .
The variable to set based on cache restoration. It will be true when the cache is
restored (i.e. a cache hit), inexact on a restore key cache hit (based on restoreKeys ) or
false if there is a cache miss.
string .
The additional restore key prefixes that the task uses if the primary key misses. This can
be a newline-delimited list of key prefixes.
Output variables
None.
Remarks
Improve build performance by caching files, like dependencies, between pipeline runs.
Requirements
ノ Expand table
Requirement Description
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
See also
Pipeline Caching
Cache NuGet packages
Feedback
Was this page helpful? Yes No
Improve build performance by using this task to cache files, like dependencies, between
pipeline runs.
7 Note
Syntax
# Cache (Beta) v1
# Cache files between runs.
- task: CacheBeta@1
inputs:
key: # string. Required. Key.
path: # string. Required. Path.
#cacheHitVar: # string. Cache hit variable.
#restoreKeys: # string. Additional restore key prefixes.
Inputs
key - Key
string . Required.
The key (unique identifier) for the cache. This should be a string that can be segmented
using | . File paths can be absolute or relative to $(System.DefaultWorkingDirectory) .
path - Path
string . Required.
supported.
string .
The variable to set to true when the cache is restored (i.e. a cache hit). Otherwise, sets
the variable to false .
string .
The additional restore key prefixes that the task uses if the primary key misses. This can
be a newline-delimited list of key prefixes.
Output variables
None.
Requirements
ノ Expand table
Requirement Description
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Improve build performance by using this task to cache files, like dependencies, between
pipeline runs.
7 Note
Syntax
# Cache (Beta) v0
# Cache files between runs.
- task: CacheBeta@0
inputs:
key: # string. Required. Key.
path: # string. Required. Path.
#cacheHitVar: # string. Cache hit variable.
Inputs
key - Key
string . Required.
The key (unique identifier) for the cache. This should be a newline-delimited list of
strings or file paths. File paths can be absolute or relative to
$(System.DefaultWorkingDirectory) .
path - Path
string . Required.
supported.
Output variables
None.
Requirements
ノ Expand table
Requirement Description
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Feedback
Was this page helpful? Yes No
Authentication task for the cargo client used for installing Cargo crates.
7 Note
Syntax
# Cargo authenticate (for task runners) v0
# Authentication task for the cargo client used for installing Cargo crates
distribution.
- task: CargoAuthenticate@0
inputs:
configFile: # string. Required. config.toml file to authenticate.
#cargoServiceConnections: # string. Credentials for registries outside
this organization/collection.
Inputs
configFile - config.toml file to authenticate
string . Required.
Path to the config.toml file that specifies the registries you want to work with. Select the
file, not the folder e.g. "/.cargo/config.toml".
organization/collection
string .
Credentials to use for external registries located in the project's config.toml. For
registries in this organization/collection, don't specify this attribute; the build’s
credentials are used automatically.
Output variables
None.
Requirements
ノ Expand table
Requirement Description
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Feedback
Was this page helpful? Yes No
Use this task to check the security and compliance assessment for Azure Policy.
Syntax
# Check Azure Policy compliance v0
# Security and compliance assessment for Azure Policy.
- task: AzurePolicyCheckGate@0
inputs:
azureSubscription: # string. Alias: ConnectedServiceName. Required.
Azure subscription.
#ResourceGroupName: # string. Resource group.
#Resources: # string. Resource name.
# Advanced
#RetryDuration: '00:02:00' # string. Retry duration. Default: 00:02:00.
Inputs
azureSubscription - Azure subscription
Selects the Azure Resource Manager subscription you want to use to enforce the
policies.
string .
string .
Selects the name of Azure resources for which you want to check the policy compliance.
RetryDuration - Retry duration
string . Default value: 00:02:00 .
The default is 00:02:00 (two minutes), which is the minumum interval that may be
configured.
Output variables
None.
Remarks
Azure Policy allows you to assess and enforce resource compliance against defined IT
policies. Use this task in a gate to identify, analyze and evaluate the security risks, and
determine the mitigation measures required to reduce the risks.
7 Note
Can be used only as a gate. This task is not supported in a build or release pipeline.
Requirements
ノ Expand table
Requirement Description
Runs on ServerGate
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Feedback
Was this page helpful? Yes No
) Important
This task is deprecated and will be retired January 31, 2024. Use Chef-CLI .
Syntax
YAML
# Chef v1
# Deploy to Chef environments by editing environment attributes.
- task: Chef@1
inputs:
connectedServiceName: # string. Required. Chef Service Connection.
Environment: # string. Required. Environment.
Attributes: # string. Required. Environment Attributes.
chefWaitTime: '30' # string. Required. Wait Time. Default: 30.
Inputs
connectedServiceName - Chef Service Connection
string . Required.
Environment - Environment
string . Required.
The name of the Chef environment to be used for deployment. The attributes of that
environment will be edited.
string . Required.
Specifies the value of the leaf node attribute(s) to be updated. Example: {
"default_attributes.connectionString" : "$(connectionString)",
"override_attributes.buildLocation" : "https://sample.blob.core.windows.net/build"
} . The task fails if the leaf node does not exist.
The amount of time (in minutes) to wait for this task to complete. Default value: 30
minutes.
Output variables
None.
Remarks
Use this task to deploy to Chef environments by editing environment attributes.
) Important
Requirements
ノ Expand table
Requirement Description
Runs on Agent
Requirement Description
Demands Self-hosted agents must have capabilities that match the following demands
to run jobs that use this task: Chef, KnifeReporting, DotNetFramework
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Command Any
restrictions
Feedback
Was this page helpful? Yes No
) Important
This task is deprecated and will be retired January 31, 2024. Use Chef knife client .
Syntax
# Chef Knife v1
# Run scripts with Knife commands on your Chef workstation.
- task: ChefKnife@1
inputs:
ConnectedServiceName: # string. Required. Chef Subscription.
ScriptPath: # string. Required. Script Path.
#ScriptArguments: # string. Script Arguments.
Inputs
ConnectedServiceName - Chef Subscription
string . Required.
string . Required.
The path of the script. This should be fully qualified path or a relative to the default
working directory.
string .
Optional. The additional parameters to pass to the script. Can be either ordinal or
named parameters.
Task control options
All tasks have control options in addition to their task inputs. For more information, see
Control options and common task properties.
Output variables
None.
Remarks
) Important
Requirements
ノ Expand table
Requirement Description
Runs on Agent
Demands Self-hosted agents must have capabilities that match the following demands
to run jobs that use this task: Chef, DotNetFramework
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Command Any
restrictions
Feedback
Was this page helpful? Yes No
Use this task to build with the CMake cross-platform build system.
Syntax
# CMake v1
# Build with the CMake cross-platform build system.
- task: CMake@1
inputs:
#workingDirectory: 'build' # string. Alias: cwd. Working Directory.
Default: build.
#cmakeArgs: # string. Arguments.
# Advanced
#runInsideShell: false # boolean. Run cmake command inside shell.
Default: false.
Inputs
workingDirectory - Working Directory
If you specify a relative path, then it is relative to your repo. For example, if you specify
build , the result is the same as if you specified $(Build.SourcesDirectory)\build .
You can also specify a full path outside the repo, and you can use variables. For example:
$(Build.ArtifactStagingDirectory)\build
If the path you specify does not exist, CMake creates it.
cmakeArgs - Arguments
string .
Output variables
None.
Remarks
Use this task to build with the CMake cross-platform build system.
2. On your agent machine, install CMake and make sure to add it to the user's path
that the agent is running as.
3. In your web browser, go to Agent pools and add a capability named cmake . Set its
value to yes .
Requirements
ノ Expand table
Requirement Description
Demands Self-hosted agents must have capabilities that match the following demands
to run jobs that use this task: cmake
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Command Any
restrictions
Feedback
Was this page helpful? Yes No
CocoaPods is the dependency manager for Swift and Objective-C Cocoa projects. This
task optionally runs pod repo update and then runs pod install .
Syntax
# CocoaPods v0
# Install CocoaPods dependencies for Swift and Objective-C Cocoa projects.
- task: CocoaPods@0
inputs:
#workingDirectory: # string. Alias: cwd. Working directory.
# Advanced
#forceRepoUpdate: false # boolean. Force repo update. Default: false.
#projectDirectory: # string. Project directory.
Inputs
workingDirectory - Working directory
Specifies the working directory in which to execute this task. If left empty, the repository
directory will be used.
Selecting this option will force running pod repo update before installation.
string .
Optional. Specifies the path to the root of the project directory. If left empty, the task
uses the specified project in the podfile. If no project is specified, then the task searches
for an Xcode project. If the task finds more than one Xcode project, an error will occur.
Task control options
All tasks have control options in addition to their task inputs. For more information, see
Control options and common task properties.
Output variables
None.
Remarks
Use this task to run CocoaPods pod install .
CocoaPods is the dependency manager for Swift and Objective-C Cocoa projects. This
task optionally runs pod repo update and then runs pod install .
Requirements
ノ Expand table
Requirement Description
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Command This task runs using the following command restrictions: restricted
restrictions
Settable variables This task has permission to set the following variables: Setting variables is
disabled
Feedback
Was this page helpful? Yes No
Use this task to run a command line script using Bash on Linux, macOS, and cmd.exe on
Windows.
Syntax
YAML
# Command Line v2
# Run a command line script using Bash on Linux and macOS and cmd.exe on
Windows.
- task: CmdLine@2
inputs:
script: # string. Required. Script.
# Advanced
#workingDirectory: # string. Working Directory.
#failOnStderr: false # boolean. Fail on Standard Error. Default: false.
Inputs
script - Script
string . Required. Default value: echo Write your commands here\n\necho Hello world .
Specifies the working directory to run commands. If you leave it empty, the working
directory is $(Build.SourcesDirectory).
If the value is set to true, the task fails if any errors are written to the Standard Error
stream.
Task control options
All tasks have control options in addition to their task inputs. For more information, see
Control options and common task properties.
Output variables
None.
Remarks
The command line has a shortcut in YAML: steps.script.
yml
) Important
You may not realize you're running a batch file. For example, npm on Windows,
along with any tools that you install using npm install -g , are actually batch files.
Always use call npm <command> to run NPM commands in a Command Line task on
Windows.
Examples
YAML
steps:
- script: date /t
displayName: Get the date
- script: dir
workingDirectory: $(Agent.BuildDirectory)
displayName: List contents of a folder
- script: |
set MYVAR=foo
set
displayName: Set a variable and then display all
env:
aVarFromYaml: someValue
Requirements
ノ Expand table
Requirement Description
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
See also
Learn how to use verbose logs for troubleshooting.
Feedback
Was this page helpful? Yes No
Provide product feedback
CmdLine@1 - Command Line v1 task
Article • 04/29/2024
7 Note
Syntax
# Command Line v1
# Run a command line with arguments.
- task: CmdLine@1
inputs:
filename: # string. Required. Tool.
#arguments: # string. Arguments.
# Advanced
#workingFolder: # string. Working folder.
#failOnStandardError: false # boolean. Fail on Standard Error. Default:
false.
Inputs
filename - Tool
string . Required.
The name of the tool to run. The tool should be found in your path. Optionally, a fully
qualified path can be supplied, but the path must be present on the agent.
Note: You can use $(Build.SourcesDirectory)\ if you want the path relative to repo.
arguments - Arguments
string .
The arguments that are passed to the tool. Use double quotes to escape spaces.
string .
Specifies the working directory to run commands. If you leave it empty, the working
directory is $(Build.SourcesDirectory).
If the value is set to true, the task fails if any errors are written to the Standard Error
stream.
Output variables
None.
Remarks
There is a newer version of the Command line task at CommandLine@2.
Requirements
ノ Expand table
Requirement Description
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
See also
CommandLine@2
Feedback
Was this page helpful? Yes No
) Important
This task is deprecated and will be retired January 31, 2024. Use conda
commands directly in the bash task or batch script task as an alternative.
Syntax
# Conda environment v1
# This task is deprecated. Use `conda` directly in script to work with
Anaconda environments.
- task: CondaEnvironment@1
inputs:
#createCustomEnvironment: false # boolean. Create a custom environment.
Default: false.
#environmentName: # string. Required when createCustomEnvironment ==
true. Environment name.
#packageSpecs: 'python=3' # string. Package specs. Default: python=3.
#updateConda: true # boolean. Update to the latest Conda. Default: true.
#installOptions: # string. Optional. Use when createCustomEnvironment ==
false. Other options for `conda install`.
#createOptions: # string. Optional. Use when createCustomEnvironment ==
true. Other options for `conda create`.
#cleanEnvironment: false # boolean. Optional. Use when
createCustomEnvironment == true. Clean the environment. Default: false.
Inputs
createCustomEnvironment - Create a custom environment
boolean . Default value: false .
If the value for this boolean is set to true , the task creates or reactivates a Conda
environment instead of using the base environment. Setting the value to true is
recommended for self-hosted agents.
environmentName - Environment name
string . Required when createCustomEnvironment == true .
The name of the Conda environment to create and activate, or reactivate if it already
exists.
Updates Conda to the latest version. This applies to the Conda installation found in
PATH or to the path specified by the CONDA environment variable.
The space-delimited list of additional options to pass to the conda create command.
Deletes the environment and recreates it if it already exists. If this boolean is not
selected, the task will reactivate an existing environment.
Output variables
None.
Remarks
Use this task to create and activate a Conda environment.
) Important
This task has been deprecated. Use conda commands directly in the bash task or
batch script task as an alternative.
This task will create a Conda environment and activate it for subsequent build tasks.
If the task finds an existing environment with the same name, the task will simply
reactivate it. This is possible on self-hosted agents. To recreate the environment and
reinstall any of its packages, set the "Clean the environment" option.
Running with the "Update to the latest Conda" option will attempt to update Conda
before creating or activating the environment. If you are running a self-hosted agent
and have configured a Conda installation to work with the task, this may result in your
Conda installation being updated.
7 Note
Microsoft-hosted agents won't have Conda in their PATH by default. You will need
to run this task in order to use Conda.
After running this task, PATH will contain the binary directory for the activated
environment, followed by the binary directories for the Conda installation itself. You can
run scripts as subsequent build tasks that run Python, Conda, or the command-line
utilities from other packages you install. For example, you can run tests with pytest or
upload a package to Anaconda Cloud with the Anaconda client .
Tip
After running this task, the environment will be "activated," and packages you
install by calling conda install will get installed to this environment.
Prerequisites
A Microsoft-hosted agent, or a self-hosted agent with Anaconda or Miniconda
installed.
If using a self-hosted agent, you must either add the conda executable to PATH or
set the CONDA environment variable to the root of the Conda installation.
Requirements
ノ Expand table
Requirement Description
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Feedback
Was this page helpful? Yes No
) Important
This task has been deprecated. Use conda commands directly in the bash task or
batch script task as an alternative.
Syntax
# Conda environment v0
# Create and activate a Conda environment.
- task: CondaEnvironment@0
inputs:
environmentName: # string. Required. Environment name.
#packageSpecs: 'python=3' # string. Package specs. Default: python=3.
#updateConda: true # boolean. Update to the latest Conda. Default: true.
# Advanced
#createOptions: # string. Environment creation options.
#cleanEnvironment: false # boolean. Clean the environment. Default:
false.
Inputs
environmentName - Environment name
string . Required.
The name of the Conda environment to create and activate, or reactivate if it already
exists.
Updates Conda to the latest version. This applies to the Conda installation found in
PATH or to the path specified by the CONDA environment variable.
The space-delimited list of additional options to pass to the conda create command.
Deletes the environment and recreates it if it already exists. If this boolean is not
selected, the task will reactivate an existing environment.
Output variables
None.
Remarks
Use this task to create and activate a Conda environment.
) Important
This task has been deprecated. Use conda commands directly in the bash task or
batch script task as an alternative.
This task will create a Conda environment and activate it for subsequent build tasks.
If the task finds an existing environment with the same name, the task will simply
reactivate it. This is possible on self-hosted agents. To recreate the environment and
reinstall any of its packages, set the "Clean the environment" option.
Running with the "Update to the latest Conda" option will attempt to update Conda
before creating or activating the environment. If you are running a self-hosted agent
and have configured a Conda installation to work with the task, this may result in your
Conda installation being updated.
7 Note
Microsoft-hosted agents won't have Conda in their PATH by default. You will need
to run this task in order to use Conda.
After running this task, PATH will contain the binary directory for the activated
environment, followed by the binary directories for the Conda installation itself. You can
run scripts as subsequent build tasks that run Python, Conda, or the command-line
utilities from other packages you install. For example, you can run tests with pytest or
upload a package to Anaconda Cloud with the Anaconda client .
Tip
After running this task, the environment will be "activated", and packages you
install by calling conda install will get installed to this environment.
Prerequisites
A Microsoft-hosted agent, or a self-hosted agent with Anaconda or Miniconda
installed.
If using a self-hosted agent, you must either add the conda executable to PATH or
set the CONDA environment variable to the root of the Conda installation.
Requirement Description
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Feedback
Was this page helpful? Yes No
Syntax
# Container Build v0
# Container Build Task.
- task: ContainerBuild@0
inputs:
#dockerRegistryServiceConnection: # string. Docker registry service
connection.
#repository: # string. Container repository.
Dockerfile: 'Dockerfile' # string. Required. Dockerfile. Default:
Dockerfile.
#buildContext: '.' # string. Build context. Default: ..
#tags: '$(Build.BuildId)' # string. Tags. Default: $(Build.BuildId).
Inputs
dockerRegistryServiceConnection - Docker registry service connection
string .
string .
Dockerfile - Dockerfile
string . Required. Default value: Dockerfile .
tags - Tags
The list of tags in separate lines. Tags are used while building and pushing the image to
container registry.
Output variables
None.
Requirements
ノ Expand table
Requirement Description
Demands None
Capabilities Running this task satisfies the following demands for any subsequent tasks
in the same job: Buildctl
Command Any
restrictions
Syntax
YAML
Inputs
dockerRegistryServiceConnection - Docker registry service connection
string . Required.
Specify a Docker registry service connection. Required for commands that need to
authenticate with a registry.
string . Required.
The tag is used in pulling the image from docker registry service connection.
The config file path that contains container structure tests, either in .yaml or .json file
formats.
Fails the task if there are any test failures. Check this option to fail the task if test failures
are detected.
Output variables
None.
Remarks
This task helps you run container structure tests and publish test results to Azure
Pipelines and provides a comprehensive test reporting and analytics experience.
7 Note
This is an early preview feature. More upcoming features will be rolled out in
upcoming sprints.
The Container Structure Tests provide a powerful framework to validate the structure of
a container image. These tests can be used to check the output of commands in an
image, as well as verify metadata and contents of the filesystem. Tests can be run either
through a standalone binary, or through a Docker image.
Tests within this framework are specified through a YAML or JSON config file. Multiple
config files may be specified in a single test run. The config file will be loaded in by the
test runner, which will execute the tests in order. Within this config file, four types of
tests can be written:
YAML
In the new YAML based unified pipeline, you can search for task in the window.
Once the task is added, you need to set the config file path, docker registory service
connection, container repository and tag, if required. Task input in the yaml based
pipeline is created.
YAML file
yml
steps:
- task: ContainerStructureTest@0
displayName: 'Container Structure Test '
inputs:
dockerRegistryServiceConnection: 'Container_dockerHub'
repository: adma/hellodocker
tag: v1
configFile: /home/user/cstfiles/fileexisttest.yaml
Requirement Description
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Feedback
Was this page helpful? Yes No
Use this task to copy build artifacts to a staging folder and then publish them to the
server or a file share. Files are copied to the $(Build.ArtifactStagingDirectory) staging
folder and then published.
) Important
This task is deprecated. We recommend that you use Pipeline Artifacts and the
Copy Files task and the Publish Build Artifacts task instead.
Syntax
YAML
Inputs
CopyRoot - Copy Root
string .
The folder that contains the files you want to copy. If the folder is empty, the task copies
files from the root folder of the repo as though $(Build.SourcesDirectory) was
specified.
If your build produces artifacts outside of the sources directory, specify
$(Agent.BuildDirectory) to copy files from the build agent working directory.
Contents - Contents
string . Required.
Specifies pattern filters (one on each line) that you want to apply to the list of files to be
copied. For example:
string . Required.
Specifies whether to store the artifact on TFS/Team Services or to copy it to a file share
that must be accessible from the build agent.
TargetPath - Path
string . Optional. Use when ArtifactType = FilePath . Default value:
\\my\share\$(Build.DefinitionName)\$(Build.BuildNumber) .
The UNC file path location where the artifact is copied. It must be accessible from the
build agent.
Remarks
) Important
This task is deprecated. We recommend that you use Pipeline Artifacts and the
Copy Files task and the Publish Build Artifacts task instead.
You can avoid these issues by instead using the Copy Files task and the Publish Build
Artifacts task.
Requirements
ノ Expand table
Requirement Description
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Use this task to copy files from a source folder to a target folder using match patterns.
(The match patterns will only match file paths, not folder paths).
Syntax
YAML
# Copy files v2
# Copy files from a source folder to a target folder using patterns matching
file paths (not folder paths).
- task: CopyFiles@2
inputs:
#SourceFolder: # string. Source Folder.
Contents: '**' # string. Required. Contents. Default: **.
TargetFolder: # string. Required. Target Folder.
# Advanced
#CleanTargetFolder: false # boolean. Clean Target Folder. Default:
false.
#OverWrite: false # boolean. Overwrite. Default: false.
#flattenFolders: false # boolean. Flatten Folders. Default: false.
#preserveTimestamp: false # boolean. Preserve Target Timestamp. Default:
false.
#retryCount: '0' # string. Retry count to copy the file. Default: 0.
#delayBetweenRetries: '1000' # string. Delay between two retries.
Default: 1000.
#ignoreMakeDirErrors: false # boolean. Ignore errors during creation of
target folder. Default: false.
Inputs
SourceFolder - Source Folder
string .
Optional. The folder that contains the files you want to copy. If the folder is empty, then
the task copies files from the root folder of the repo as though
$(Build.SourcesDirectory) was specified.
The file paths to include as part of the copy. This string supports multiple lines of match
patterns.
For example:
The pattern is used to match only file paths, not folder paths. Specify patterns, such as
**\bin\** instead of **\bin .
Use the path separator that matches your build agent type. For example, / must be
used for Linux agents. More examples are shown below.
string . Required.
The target folder or UNC path that will contain the copied files. You can use variables.
Example: $(build.artifactstagingdirectory) .
Optional. Deletes all existing files in the target folder before the copy process.
OverWrite - Overwrite
boolean . Default value: false .
Optional. Flattens the folder structure and copies all files into the specified target folder.
preserveTimestamp - Preserve Target Timestamp
boolean . Default value: false .
Preserves the target file timestamp by using the original source file.
Specifies the retry count to copy the file. This string is useful for intermittent issues, such
as UNC target paths on a remote host.
Specifies the delay between two retries. This string is useful for intermittent issues, such
as UNC target paths on a remote host.
Ignores errors that occur during the creation of the target folder. This string is useful for
avoiding issues with the parallel execution of tasks by several agents within one target
folder.
Output variables
None.
Remarks
If no files match, the task will still report success.
If Overwrite is false and a matched file already exists in the target folder, the task
will not report failure but log that the file already exists and skip it.
If Overwrite is true and a matched file already exists in the target folder, the
matched file will be overwritten.
Examples
steps:
- task: CopyFiles@2
inputs:
contents: '_buildOutput/**'
targetFolder: $(Build.ArtifactStagingDirectory)
- task: PublishBuildArtifacts@1
inputs:
pathToPublish: $(Build.ArtifactStagingDirectory)
artifactName: MyBuildOutputs
Goal
You want to copy just the readme and the files needed to run this C# console app:
`-- ConsoleApplication1
|-- ConsoleApplication1.sln
|-- readme.txt
`-- ClassLibrary1
|-- ClassLibrary1.csproj
`-- ClassLibrary2
|-- ClassLibrary2.csproj
`-- ConsoleApplication1
|-- ConsoleApplication1.csproj
7 Note
ConsoleApplication1.sln contains a bin folder with .dll and .exe files, see the Results
below to see what gets moved!
YAML
YAML
steps:
- task: CopyFiles@2
displayName: 'Copy Files to: $(Build.ArtifactStagingDirectory)'
inputs:
Contents: |
ConsoleApplication1\ConsoleApplication1\bin\**\*.exe
ConsoleApplication1\ConsoleApplication1\bin\**\*.dll
ConsoleApplication1\readme.txt
TargetFolder: '$(Build.ArtifactStagingDirectory)'
YAML
steps:
- task: CopyFiles@2
displayName: 'Copy Files to: $(Build.ArtifactStagingDirectory)'
inputs:
Contents: |
ConsoleApplication1\ConsoleApplication1\bin\**\?(*.exe|*.dll)
ConsoleApplication1\readme.txt
TargetFolder: '$(Build.ArtifactStagingDirectory)'
YAML
steps:
- task: CopyFiles@2
displayName: 'Copy Files to: $(Build.ArtifactStagingDirectory)'
inputs:
Contents: |
ConsoleApplication1\**\bin\**\!(*.pdb|*.config)
!ConsoleApplication1\**\ClassLibrary*\**
ConsoleApplication1\readme.txt
TargetFolder: '$(Build.ArtifactStagingDirectory)'
Example with variables in content section
YAML
- task: CopyFiles@2
inputs:
Contents: '$(Build.Repository.LocalPath)/**'
TargetFolder: '$(Build.ArtifactStagingDirectory)'
Results
These files are copied to the staging directory:
`-- ConsoleApplication1
|-- readme.txt
`-- ConsoleApplication1
`-- bin
`-- Release
| -- ClassLibrary1.dll
| -- ClassLibrary2.dll
| -- ConsoleApplication1.exe
YAML
YAML
steps:
- task: CopyFiles@2
displayName: 'Copy Files to: $(Build.ArtifactStagingDirectory)'
inputs:
SourceFolder: '$(Build.SourcesDirectory)'
Contents: |
**/*
!.git/**/*
TargetFolder: '$(Build.ArtifactStagingDirectory)'
Requirements
ノ Expand table
Requirement Description
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Command This task runs using the following command restrictions: restricted
restrictions
Settable variables This task has permission to set the following variables: Setting variables is
disabled
See also
File matching patterns reference
How do I use this task to publish artifacts
Learn how to use verbose logs for troubleshooting.
Feedback
Was this page helpful? Yes No
Use this task to copy files from a source folder to a target folder using match patterns.
(The match patterns will only match file paths, not folder paths).
7 Note
Syntax
# Copy Files v1
# Copy files from source folder to target folder using minimatch patterns
(The minimatch patterns will only match file paths, not folder paths).
- task: CopyFiles@1
inputs:
#SourceFolder: # string. Source Folder.
Contents: '**' # string. Required. Contents. Default: **.
TargetFolder: # string. Required. Target Folder.
# Advanced
#CleanTargetFolder: false # boolean. Clean Target Folder. Default:
false.
#OverWrite: false # boolean. Overwrite. Default: false.
#flattenFolders: false # boolean. Flatten Folders. Default: false.
Inputs
SourceFolder - Source Folder
string .
Optional. The folder that contains the files you want to copy. If the folder is empty, then
the task copies files from the root folder of the repo as though
$(Build.SourcesDirectory) was specified.
Contents - Contents
For example:
** copies all files in the specified source folder and all files in all sub-folders.
The pattern is used to match only file paths, not folder paths. Specify patterns, such as
**\bin\** instead of **\bin .
Use the path separator that matches your build agent type. For example, / must be
used for Linux agents. More examples are shown below.
string . Required.
The target folder or UNC path that will contain the copied files. You can use variables.
Example: $(build.artifactstagingdirectory) .
Optional. Deletes all existing files in the target folder before the copy process.
OverWrite - Overwrite
boolean . Default value: false .
Optional. Flattens the folder structure and copies all files into the specified target folder.
Output variables
None.
Remarks
There is a newer version of this task available at CopyFiles@2.
If no files match, the task will still report success. If a matched file already exists in the
target folder, the task will report failure unless Overwrite is set to true.
Requirements
ノ Expand table
Requirement Description
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
See also
CopyFiles@2
Feedback
Was this page helpful? Yes No
Syntax
# Copy files over SSH v0
# Copy files or build artifacts to a remote machine over SSH.
- task: CopyFilesOverSSH@0
inputs:
sshEndpoint: # string. Required. SSH service connection.
#sourceFolder: # string. Source folder.
contents: '**' # string. Required. Contents. Default: **.
#targetFolder: # string. Target folder.
# Advanced
#isWindowsOnTarget: false # boolean. Target machine running Windows.
Default: false.
#cleanTargetFolder: false # boolean. Clean target folder. Default:
false.
#cleanHiddenFilesInTarget: false # boolean. Optional. Use when
cleanTargetFolder = true. Remove hidden files in target folder. Default:
false.
readyTimeout: '20000' # string. Required. SSH handshake timeout.
Default: 20000.
#overwrite: true # boolean. Overwrite. Default: true.
#failOnEmptySource: false # boolean. Fail if no files found to copy.
Default: false.
#flattenFolders: false # boolean. Flatten folders. Default: false.
Inputs
sshEndpoint - SSH service connection
string . Required.
The name of an SSH service connection containing connection details for the remote
machine.
The hostname or IP address of the remote machine, the port number, and the user
name are required to create an SSH service connection.
The private key and the passphrase must be specified for authentication.
sourceFolder - Source folder
string .
The source folder of the files to copy to the remote machine. When empty, the root of
the repository (build) or artifacts directory (release) is used, which is
$(System.DefaultWorkingDirectory) . Use variables if files are not in the repository.
Example: $(Agent.BuildDirectory) .
contents - Contents
The file paths to include as part of the copy. Supports multiple lines of minimatch
patterns. The default value is ** , which includes all files (including sub-folders) under
the source folder.
Example: **/*.*(jar|war) includes all .jar and .war files (including sub-folders)
under the source folder.
Example: "** \n !**/*.xml" includes all files (including sub-folders) under the
source folder, but excludes xml files.
string .
The target folder on the remote machine, where files will be copied. Example:
/home/user/MySite . Preface with a tilde (~) to specify the user's home directory.
Deletes all existing files and sub-folders in the target folder before copying.
cleanHiddenFilesInTarget - Remove hidden files in target folder
boolean . Optional. Use when cleanTargetFolder = true . Default value: false .
How long (in milliseconds) to wait for the SSH handshake to complete.
overwrite - Overwrite
Fails if no matching files to be copied are found under the source folder.
Flattens the folder structure and copies all files into the specified target folder on the
remote machine.
Output variables
None.
Requirements
ノ Expand table
Requirement Description
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Command This task runs using the following command restrictions: restricted
restrictions
Settable variables This task has permission to set the following variables: Setting variables is
disabled
Feedback
Was this page helpful? Yes No
Use this task with cURL to upload files. Supported data transfer protocols include FTP,
FTPS, SFTP, HTTP, and others.
Syntax
# cURL Upload Files v2
# Use cURL's supported protocols to upload files.
- task: cURLUploader@2
inputs:
files: # string. Required. Files.
#authType: 'ServiceEndpoint' # 'ServiceEndpoint' | 'UserAndPass'.
Authentication Method. Default: ServiceEndpoint.
serviceEndpoint: # string. Required when authType = ServiceEndpoint.
Service Connection.
#username: # string. Optional. Use when authType = UserAndPass.
Username.
#password: # string. Optional. Use when authType = UserAndPass.
Password.
#url: # string. Required when authType = UserAndPass. URL.
#remotePath: 'upload/$(Build.BuildId)/' # string. Remote Directory.
Default: upload/$(Build.BuildId)/.
#options: # string. Optional Arguments.
# Advanced
#redirectStderr: true # boolean. Redirect Standard Error to Standard
Out. Default: true.
Inputs
files - Files
string . Required.
File(s) to be uploaded. Wildcards can be used. For example, **/*.zip for all ZIP files in
all subfolders.
Specifies the service connection with the credentials for the server authentication. Use
the Generic service connection type for the service connection.
username - Username
string . Optional. Use when authType = UserAndPass .
password - Password
Specifies the password for server authentication. Use a new build variable with its lock
enabled on the Variables tab to encrypt this value. Use a secret variable to avoid
exposing ths value.
url - URL
string . Required when authType = UserAndPass .
Specifies the URL to where the file(s) will be uploaded. The directory should end with a
trailing slash. Possible URL protocols include DICT:// , FILE:// , FTP:// , FTPS:// ,
GOPHER:// , HTTP:// , HTTPS:// , IMAP:// , IMAPS:// , LDAP:// , LDAPS:// , POP3:// ,
Optional. Specifies the sub-folder on the remote server for the URL supplied in the
credentials.
string .
Optional. The additional arguments that will be passed to cURL.
Adds --stderr - as an argument to cURL. By default, cURL writes its progress bar to
stderr , which is interpreted by the build as error output. Enabling this checkbox
Output variables
None.
Remarks
Use this task to use cURL to upload files with supported protocols such as FTP, FTPS,
SFTP, HTTP, and more.
Requirements
ノ Expand table
Requirement Description
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Command This task runs using the following command restrictions: restricted
restrictions
Settable variables This task has permission to set the following variables: Setting variables is
disabled
Feedback
Was this page helpful? Yes No
Use this task with cURL to upload files. Supported data transfer protocols include FTP,
FTPS, SFTP, HTTP, and others.
7 Note
Syntax
# cURL Upload Files v1
# Use cURL to upload files with FTP, FTPS, SFTP, HTTP, and more.
- task: cURLUploader@1
inputs:
files: # string. Required. Files.
#username: # string. Username.
#password: # string. Password.
url: # string. Required. URL.
#options: # string. Optional Arguments.
# Advanced
#redirectStderr: true # boolean. Redirect Standard Error to Standard
Out. Default: true.
Inputs
files - Files
string . Required.
The file(s) to be uploaded. Wildcards can be used. For example, **\*.zip for all ZIP files
in all subfolders.
username - Username
string .
Optional. Specifies the password for server authentication. Use a new build variable with
its lock enabled on the Variables tab to encrypt this value. Use a secret variable to avoid
exposing ths value.
url - URL
string . Required.
Specifies the URL to where the file(s) will be uploaded. The directory should end with a
trailing slash. Possible URL protocols include DICT:// , FILE:// , FTP:// , FTPS:// ,
GOPHER:// , HTTP:// , HTTPS:// , IMAP:// , IMAPS:// , LDAP:// , LDAPS:// , POP3:// ,
POP3S:// , RTMP:// , RTSP:// , SCP:// , SFTP:// , SMTP:// , SMTPS:// , TELNET:// and
TFTP:// .
string .
Adds --stderr - as an argument to cURL. By default, cURL writes its progress bar to
stderr , which is interpreted by the build as error output. Enabling this checkbox
Output variables
None.
Remarks
Requirements
ノ Expand table
Requirement Description
Demands Self-hosted agents must have capabilities that match the following demands
to run jobs that use this task: curl
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Command Any
restrictions
Feedback
Was this page helpful? Yes No
Syntax
# Decrypt file (OpenSSL) v1
# Decrypt a file using OpenSSL.
- task: DecryptFile@1
inputs:
cipher: 'des3' # string. Required. Cypher. Default: des3.
inFile: # string. Required. Encrypted file.
passphrase: # string. Required. Passphrase.
#outFile: # string. Decrypted file path.
# Advanced
#workingDirectory: # string. Alias: cwd. Working directory.
Inputs
cipher - Cypher
The encryption cypher to use. See cypher suite names for a complete list of possible
values.
string . Required.
passphrase - Passphrase
string . Required.
The passphrase to use for decryption. Use a variable to encrypt the passphrase.
outFile - Decrypted file path
string .
The optional filename for the decrypted file. Defaults to the encrypted file with an .out
extension.
The optional working directory for decryption. Defaults to the root of the repository.
Output variables
None.
Remarks
Use this task to decrypt files using OpenSSL.
Requirements
ノ Expand table
Requirement Description
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Command This task runs using the following command restrictions: restricted
restrictions
Requirement Description
Settable variables This task has permission to set the following variables: Setting variables is
disabled
Feedback
Was this page helpful? Yes No
Syntax
# Delay v1
# Delay further execution of a workflow by a fixed time.
- task: Delay@1
inputs:
delayForMinutes: '0' # string. Required. Delay Time (minutes). Default:
0.
Inputs
delayForMinutes - Delay Time (minutes)
string . Required. Default value: 0 .
Delays the execution of the workflow by specified time in minutes. A 0 value means that
workflow execution will start without delay. The maximum value is 86400 (60 days).
Output variables
None.
Remarks
Use this task in an agentless job of a release pipeline to pause the execution of the
pipeline for a fixed delay time.
7 Note
Can be used in only an agentless job of a release pipeline.
Requirements
ノ Expand table
Requirement Description
Runs on Server
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Feedback
Was this page helpful? Yes No
Syntax
YAML
# Delete files v1
# Delete folders, or files matching a pattern.
- task: DeleteFiles@1
inputs:
#SourceFolder: # string. Source Folder.
Contents: 'myFileShare' # string. Required. Contents. Default:
myFileShare.
#RemoveSourceFolder: false # boolean. Remove SourceFolder. Default:
false.
# Advanced
#RemoveDotFiles: false # boolean. Remove files starting with a dot.
Default: false.
Inputs
SourceFolder - Source Folder
string .
If the source folder is empty, the task deletes files from the root folder of the repository
as though $(Build.SourcesDirectory) was specified. If your build produces artifacts
outside of the sources directory, specify $(Agent.BuildDirectory) to delete files from
the build agent working directory.
Contents - Contents
The file/folder paths to delete. Supports multiple lines of minimatch patterns; each one
is processed before moving onto the next line. Learn more about File matching patterns.
For example:
temp.
**/temp/* deletes all files and folders in any sub-folder named temp.
**/temp* deletes any file or folder with a name that begins with temp.
!(*.vsix) deletes all files in the root folder that do not have a .vsix extension.
Attempts to remove the source folder after attempting to remove Contents . If you want
to remove the whole folder, set this to true and set Contents to * .
Deletes files starting with a dot. For example: .git and .dockerfile . Omits these files if
it's not specified explicitly. For example: /.* . Learn more about minimatch .
Output variables
None.
Remarks
Use this task to delete files or folders from the agent working directory.
Examples
YAML
steps:
- task: DeleteFiles@1
displayName: 'Remove unneeded files'
inputs:
contents: |
some/file
test*
**/bin/*
YAML
steps:
- task: DeleteFiles@1
displayName: 'Remove unneeded files'
inputs:
contents: |
some/!(two)
YAML
steps:
- task: DeleteFiles@1
displayName: 'Remove unneeded files'
inputs:
contents: |
some/{one,four}
steps:
- task: DeleteFiles@1
displayName: 'Remove unneeded files'
inputs:
contents: |
/some/*.txt
removeDotFiles: true
Requirements
ノ Expand table
Requirement Description
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Command This task runs using the following command restrictions: restricted
restrictions
Settable variables This task has permission to set the following variables: Setting variables is
disabled
Feedback
Was this page helpful? Yes No
Syntax
YAML
Inputs
workingDirectory - Working directory
Specifies the absolute working directory in which to execute this task. If left empty, the
default working directory is used.
app_location - App location
string .
The directory location of the application source code, relative to the working directory.
string .
The custom command used to run Oryx when building application source code.
string .
The directory location of the compiled application code after building is complete,
relative to the working directory.
string .
The directory location of the Azure Functions source code, relative to the working
directory.
string .
The custom command used to run Oryx when building Azure Functions source code.
The directory location of the routes.json file, relative to the working directory.
Note: Routes.json is deprecated. Use staticwebapp.config.json.
boolean .
boolean .
Set this flag to true when your application is configured to export to static HTML, like
when using next export .
verbose - Verbose
boolean .
string .
Specifies the time limit of the Oryx app folder build in minutes.
string .
string .
Specifies the environment to deploy to. Leave blank for the production environment.
This input takes precedence over the production branch.
string .
Specifies the production branch. When defined, and the deployment environment is
empty, deployments from other branches will be preview environments.
string .
Directory location of the Data API source files relative to working directory.
Output variables
None.
7 Note
Examples
YAML
trigger:
- main
pool:
vmImage: ubuntu-latest
steps:
- checkout: self
submodules: true
- task: AzureStaticWebApp@0
inputs:
app_location: '/build'
api_location: 'api'
output_location: '/output'
azure_static_web_apps_api_token: $(deployment_token)
Requirements
ノ Expand table
Requirement Description
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Feedback
Was this page helpful? Yes No
Use Kubernetes manifest files to deploy to clusters or even bake the manifest files to be
used for deployments using Helm charts.
Syntax
YAML
# Deploy to Kubernetes v1
# Use Kubernetes manifest files to deploy to clusters or even bake the
manifest files to be used for deployments using Helm charts.
- task: KubernetesManifest@1
inputs:
#action: 'deploy' # 'bake' | 'createSecret' | 'delete' | 'deploy' |
'patch' | 'promote' | 'scale' | 'reject'. Action. Default: deploy.
#connectionType: 'kubernetesServiceConnection' # 'azureResourceManager'
| 'kubernetesServiceConnection'. Required when action != bake. Service
connection type. Default: kubernetesServiceConnection.
#kubernetesServiceConnection: # string. Alias:
kubernetesServiceEndpoint. Required when action != bake && connectionType =
kubernetesServiceConnection. Kubernetes service connection.
#azureSubscriptionConnection: # string. Alias:
azureSubscriptionEndpoint. Required when action != bake && connectionType =
azureResourceManager. Azure subscription.
#azureResourceGroup: # string. Required when action != bake &&
connectionType = azureResourceManager. Resource group.
#kubernetesCluster: # string. Required when action != bake &&
connectionType = azureResourceManager. Kubernetes cluster.
#useClusterAdmin: false # boolean. Optional. Use when connectionType =
azureResourceManager. Use cluster admin credentials. Default: false.
#namespace: # string. Namespace.
#strategy: 'none' # 'canary' | 'none'. Optional. Use when action =
deploy || action = promote || action = reject. Strategy. Default: none.
#trafficSplitMethod: 'pod' # 'pod' | 'smi'. Optional. Use when strategy
= canary. Traffic split method. Default: pod.
#percentage: '0' # string. Required when strategy = Canary && action =
deploy. Percentage. Default: 0.
#baselineAndCanaryReplicas: '1' # string. Required when strategy =
Canary && action = deploy && trafficSplitMethod = SMI. Baseline and canary
replicas. Default: 1.
#manifests: # string. Required when action = deploy || action = promote
|| action = reject. Manifests.
#containers: # string. Optional. Use when action = deploy || action =
promote || action = bake. Containers.
#imagePullSecrets: # string. Optional. Use when action = deploy ||
action = promote. ImagePullSecrets.
#renderType: 'helm' # 'helm' | 'kompose' | 'kustomize'. Optional. Use
when action = bake. Render Engine. Default: helm.
#dockerComposeFile: # string. Required when action = bake && renderType
= kompose. Path to docker compose file.
#helmChart: # string. Required when action = bake && renderType = helm.
Helm Chart.
#releaseName: # string. Optional. Use when action = bake && renderType =
helm. Helm Release Name.
#overrideFiles: # string. Optional. Use when action = bake && renderType
= helm. Override Files.
#overrides: # string. Optional. Use when action = bake && renderType =
helm. Overrides.
#kustomizationPath: # string. Optional. Use when action = bake &&
renderType = kustomize. Kustomization Path.
#resourceToPatch: 'file' # 'file' | 'name'. Required when action =
patch. Resource to patch. Default: file.
#resourceFileToPatch: # string. Required when action = patch &&
resourceToPatch = file. File path.
#kind: # 'deployment' | 'replicaset' | 'statefulset'. Required when
action = scale || resourceToPatch = name. Kind.
#name: # string. Required when action = scale || resourceToPatch = name.
Name.
#replicas: # string. Required when action = scale. Replica count.
#mergeStrategy: 'strategic' # 'json' | 'merge' | 'strategic'. Required
when action = patch. Merge Strategy. Default: strategic.
#arguments: # string. Optional. Use when action = delete. Arguments.
#patch: # string. Required when action = patch. Patch.
#secretType: 'dockerRegistry' # 'dockerRegistry' | 'generic'. Required
when action = createSecret. Type of secret. Default: dockerRegistry.
#secretName: # string. Optional. Use when action = createSecret. Secret
name.
#secretArguments: # string. Optional. Use when action = createSecret &&
secretType = generic. Arguments.
#dockerRegistryEndpoint: # string. Optional. Use when action =
createSecret && secretType = dockerRegistry. Docker registry service
connection.
#rolloutStatusTimeout: '0' # string. Optional. Use when action = deploy
|| action = patch || action = scale || action = promote. Timeout for rollout
status. Default: 0.
Inputs
action - Action
string . Allowed values: bake , createSecret (create secret), delete , deploy , patch ,
Select the Azure Resource Manager subscription, which contains Azure Container
Registry.Note: To configure new service connection, select the Azure subscription from
the list and click 'Authorize'. If your subscription is not listed or if you want to use an
existing Service Principal, you can setup an Azure service connection using 'Add' or
'Manage' button.
namespace - Namespace
string .
Specifies the namespace for the commands by using the –namespace flag. If the
namespace is not provided, the commands will run in the default namespace.
strategy - Strategy
string . Optional. Use when action = deploy || action = promote || action = reject .
Specifies the deployment strategy used in the deploy action before a promote action or
reject action. Currently, canary is the only acceptable deployment strategy.
pod .
For the value smi , the percentage traffic split is done at the request level by using a
service mesh. A service mesh must be set up by a cluster admin. This task handles
orchestration of SMI TrafficSplit objects.
For the value pod , the percentage split isn't possible at the request level in the absence
of a service mesh. Instead, the percentage input is used to calculate the replicas for
baseline and canary. The calculation is a percentage of replicas that are specified in the
input manifests for the stable variant.
percentage - Percentage
string . Required when strategy = Canary && action = deploy . Default value: 0 .
The percentage that is used to compute the number of baseline-variant and canary-
variant replicas of the workloads that are contained in manifest files.
If the result isn't an integer, the mathematical floor of the result is used when baseline
and canary variants are created.
For example, assume the deployment hello-world is in the input manifest file and that
the following lines are in the task input:
replicas: 4
strategy: canary
percentage: 25
When you set trafficSplitMethod to smi , the percentage traffic split is controlled in the
service mesh plane. You can control the actual number of replicas for canary and
baseline variants independently of the traffic split.
For example, assume that the input deployment manifest specifies 30 replicas for the
stable variant. Also assume that you specify the following input for the task:
strategy: canary
trafficSplitMethod: smi
percentage: 20
baselineAndCanaryReplicas: 1
In this case, the stable variant receives 80% of the traffic, while the baseline and canary
variants each receive half of the specified 20%. Baseline and canary variants don't
receive three replicas each. They instead receive the specified number of replicas, which
means they each receive one replica.
manifests - Manifests
string . Required when action = deploy || action = promote || action = reject .
Specifies the path to the manifest files to be used for deployment. Each line represents a
single path. A file-matching pattern is an acceptable value for each line.
containers - Containers
string . Optional. Use when action = deploy || action = promote || action = bake .
Specifies the fully qualified resource URL of the image to be used for substitutions on
the manifest files. The URL contosodemo.azurecr.io/helloworld:test is an example.
imagePullSecrets - ImagePullSecrets
string . Optional. Use when action = deploy || action = promote .
Specifies a multiline input where each line contains the name of a Docker registry secret
that has already been set up within the cluster. Each secret name is added under
imagePullSecrets for the workloads that are found in the input manifest files.
string . Optional. Use when action = bake . Allowed values: helm , kompose , kustomize .
Specifies a multiline input that accepts the path to the override files. The files are used
when manifest files from Helm charts are baked.
overrides - Overrides
Specifies the argument that must be the path to the directory containing the file, or a git
repository URL with a path suffix specifying same with respect to the repository root.
file .
Specifies the kind of K8s object, such as deployment , replicaSet and more.
name - Name
string . Required when action = patch . Allowed values: json , merge , strategic .
arguments - Arguments
Specifies the arguments for the kubectl delete command. An example is: arguments:
deployment hello-world foo-bar
patch - Patch
string . Required when action = patch .
Specifies the name of the secret. You can use this secret name in the Kubernetes YAML
configuration file.
secretArguments - Arguments
string . Optional. Use when action = createSecret && secretType = generic .
Specifies keys and literal values to insert in secret. For example, --from-
literal=key1=value1 --from-literal=key2="top secret" .
Specifies the credentials of the specified service connection that are used to create a
Docker registry secret within the cluster. Manifest files under the imagePullSecrets field
can then refer to this secret's name.
string . Optional. Use when action = deploy || action = patch || action = scale ||
action = promote . Default value: 0 .
Specifies the length of time (in seconds) to wait before ending watch on rollout status.
Output variables
This task defines the following output variables, which you can consume in downstream
steps, jobs, and stages.
manifestsBundle
Remarks
KubeConfig
Service Account
Azure Subscription
Access to a (private) AKS cluster can be performed from a self-hosted or scale set
agent with line of sight to the cluster.
A token is created for every task that uses an Azure Resource Manager service
connection. This ensures you are connecting to Kubernetes with a short-lived
token, which is the Kubernetes recommendation .
AKS can be accessed even when local accounts are disabled.
I receive the following error message: Could not find any secret
associated with the service account. What is happening?
You are using the Kubernetes service connection with Azure Subscription option. We are
updating this method to create long-lived tokens. This is expected to be available mid-
May. However, it is recommended to start using the Azure service connection type and
not o use long-lived tokens as per Kubernetes guidance .
I'm using AKS and don't want to change anything, can I continue
to use tasks with the Kubernetes service connection?
We are updating this method to create long-lived tokens. This is expected to be
available mid-May. However, please be aware that this approach is against Kubernetes
guidance .
Our Kubernetes tasks work with any Kubernetes cluster, regardless where they are
running. The Kubernetes service connection will continue to exist.
There is no need to change anything. If you are using the Kubernetes service connection
and selected Azure Subscription during creation, you should be aware of the Kubernetes
guidance on using long-lived tokens .
In case you can’t access your AKS during environment creation time, you can use an
empty environment and set the connectionType input to an Azure Resource Manager
service connection.
Use a Kubernetes manifest task in a build or release pipeline to bake and deploy
manifests to Kubernetes clusters.
Secret handling: The createSecret action lets Docker registry secrets be created
using Docker registry service connections. It also lets generic secrets be created
using either plain-text variables or secret variables. Before deployment to the
cluster, you can use the secrets input along with the deploy action to augment
the input manifest files with the appropriate imagePullSecrets value.
Bake manifest: The bake action of the task allows for baking templates into
Kubernetes manifest files. The action uses tools such as Helm, Compose, and
Kustomize. With baking, these Kubernetes manifest files are usable for
deployments to the cluster.
Deployment strategy: Choosing the canary strategy with the deploy action leads
to the creation of workload names suffixed with -baseline and -canary . The task
supports two methods of traffic splitting:
Canary deployments that are based on a service mesh and use this task are
more accurate. This accuracy is due to how service mesh providers enable the
granular percentage-based split of traffic. The service mesh uses the service
registry and sidecar containers that are injected into pods. This injection occurs
alongside application containers to achieve the granular traffic split.
Kubernetes with no service mesh: In the absence of a service mesh, you might
not get the exact percentage split you want at the request level. However, you
can do canary deployments by using baseline and canary variants next to the
stable variant.
The service sends requests to pods of all three workload variants as the
selector-label constraints are met. Kubernetes Manifest honors these requests
when creating baseline and canary variants. This routing behavior achieves the
intended effect of routing only a portion of total requests to the canary.
Compare the baseline and canary workloads by using either a Manual Intervention
task in release pipelines or a Delay task in YAML pipelines. Do the comparison
before using the promote or reject action of the task.
Deploy action
The following YAML code is an example of deploying to a Kubernetes namespace by
using manifest files:
YAML
steps:
- task: KubernetesManifest@0
displayName: Deploy
inputs:
kubernetesServiceConnection: someK8sSC1
namespace: default
manifests: |
manifests/deployment.yml
manifests/service.yml
containers: |
foo/demo:$(tagVariable1)
bar/demo:$(tagVariable2)
imagePullSecrets: |
some-secret
some-other-secret
In the above example, the task tries to find matches for the images foo/demo and
bar/demo in the image fields of manifest files. For each match found, the value of either
tagVariable1 or tagVariable2 is appended as a tag to the image name. You can also
7 Note
While you can author deploy , promote , and reject actions with YAML input related
to deployment strategy, support for a Manual Intervention task is currently
unavailable for build pipelines.
For release pipelines, we advise you to use actions and input related to deployment
strategy in the following sequence:
2. A Manual Intervention task so that you can pause the pipeline and compare
the baseline variant with the canary variant.
3. A promote action that runs if a Manual Intervention task is resumed and a
reject action that runs if a Manual Intervention task is rejected.
YAML
steps:
- task: KubernetesManifest@0
displayName: Create secret
inputs:
action: createSecret
secretType: dockerRegistry
secretName: foobar
dockerRegistryEndpoint: demoACR
kubernetesServiceConnection: someK8sSC
namespace: default
YAML
steps:
- task: KubernetesManifest@0
displayName: Create secret
inputs:
action: createSecret
secretType: generic
secretName: some-secret
secretArguments: --from-literal=key1=value1
kubernetesServiceConnection: someK8sSC
namespace: default
Bake action
The following YAML code is an example of baking manifest files from Helm charts. Note
the usage of a name input in the first task. This name is later referenced from the deploy
step for specifying the path to the manifests that were produced by the bake step.
YAML
steps:
- task: KubernetesManifest@0
name: bake
displayName: Bake K8s manifests from Helm chart
inputs:
action: bake
helmChart: charts/sample
overrides: 'image.repository:nginx'
- task: KubernetesManifest@0
displayName: Deploy K8s manifests
inputs:
kubernetesServiceConnection: someK8sSC
namespace: default
manifests: $(bake.manifestsBundle)
containers: |
nginx: 1.7.9
7 Note
To use Helm directly for managing releases and rollbacks, see the Package and
deploy Helm charts task.
Kustomize example
The following YAML code is an example of baking manifest files generated with
Kustomize that contain a kustomization.yaml file.
YAML
steps:
- task: KubernetesManifest@0
name: bake
displayName: Bake K8s manifests from kustomization path
inputs:
action: bake
renderType: kustomize
kustomizationPath: folderContainingKustomizationFile
- task: KubernetesManifest@0
displayName: Deploy K8s manifests
inputs:
kubernetesServiceConnection: k8sSC1
manifests: $(bake.manifestsBundle)
Kompose example
The following YAML code is an example of baking manifest files generated with
Kompose, a conversion tool for Docker Compose.
YAML
steps:
- task: KubernetesManifest@0
name: bake
displayName: Bake K8s manifests from Docker Compose
inputs:
action: bake
renderType: kompose
dockerComposeFile: docker-compose.yaml
- task: KubernetesManifest@0
displayName: Deploy K8s manifests
inputs:
kubernetesServiceConnection: k8sSC1
manifests: $(bake.manifestsBundle)
Scale action
The following YAML code shows an example of scaling objects:
YAML
steps:
- task: KubernetesManifest@0
displayName: Scale
inputs:
action: scale
kind: deployment
name: bootcamp-demo
replicas: 5
kubernetesServiceConnection: someK8sSC
namespace: default
Patch action
The following YAML code shows an example of object patching:
YAML
steps:
- task: KubernetesManifest@0
displayName: Patch
inputs:
action: patch
kind: pod
name: demo-5fbc4d6cd9-pgxn4
mergeStrategy: strategic
patch: '{"spec":{"containers":
[{"name":"demo","image":"foobar/demo:2239"}]}}'
kubernetesServiceConnection: someK8sSC
namespace: default
Delete action
This YAML code shows a sample object deletion:
YAML
steps:
- task: KubernetesManifest@0
displayName: Delete
inputs:
action: delete
arguments: deployment expressapp
kubernetesServiceConnection: someK8sSC
namespace: default
Troubleshooting
deployment sampleapp in the input manifest file and that after completion of run
number 22 of the pipeline, the stable variant of this deployment named sampleapp is
deployed in the cluster. In the subsequent run (in this case run number 23), Kubernetes
manifest task with action: deploy and strategy: canary would result in creation of
sampleapp-baseline and sampleapp-canary deployments whose number of replicas are
determined by the product of percentage task input with the value of the desired
number of replicas for the final stable variant of sampleapp as per the input manifest
files.
Excluding the number of replicas, the baseline version has the same configuration as the
stable variant while the canary version has the new changes that are being introduced
by the current run (in this case, run number 23). If a manual intervention is set up in the
pipeline after the above mentioned step, it would allow for an opportunity to pause the
pipeline so that the pipeline admin can evaluate key metrics for the baseline and canary
versions and take the decision on whether the canary changes are safe and good
enough for a complete rollout.
The action: promote and strategy: canary or action: reject and strategy: canary
inputs of the Kubernetes manifest tasks can be used to promote or reject the canary
changes respectively. Note that in either cases, at the end of this step, only the stable
variant of the workloads declared in the input manifest files will be remain deployed in
the cluster, while the ephemeral baseline and canary versions are cleaned up.
Requirements
ノ Expand table
Requirement Description
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Feedback
Was this page helpful? Yes No
Use a Kubernetes manifest task in a build or release pipeline to bake and deploy
manifests to Kubernetes clusters using Helm charts.
Syntax
YAML
# Deploy to Kubernetes v0
# Use Kubernetes manifest files to deploy to clusters or even bake the
manifest files to be used for deployments using Helm charts.
- task: KubernetesManifest@0
inputs:
#action: 'deploy' # 'bake' | 'createSecret' | 'delete' | 'deploy' |
'patch' | 'promote' | 'scale' | 'reject'. Action. Default: deploy.
#kubernetesServiceConnection: # string. Required when action != bake.
Kubernetes service connection.
#namespace: # string. Namespace.
#strategy: 'none' # 'canary' | 'none'. Optional. Use when action =
deploy || action = promote || action = reject. Strategy. Default: none.
#trafficSplitMethod: 'pod' # 'pod' | 'smi'. Optional. Use when strategy
= canary. Traffic split method. Default: pod.
#percentage: '0' # string. Required when strategy = Canary && action =
deploy. Percentage. Default: 0.
#baselineAndCanaryReplicas: '1' # string. Required when strategy =
Canary && action = deploy && trafficSplitMethod = SMI. Baseline and canary
replicas. Default: 1.
#manifests: # string. Required when action = deploy || action = promote
|| action = reject. Manifests.
#containers: # string. Optional. Use when action = deploy || action =
promote || action = bake. Containers.
#imagePullSecrets: # string. Optional. Use when action = deploy ||
action = promote. ImagePullSecrets.
#renderType: 'helm' # 'helm' | 'kompose' | 'kustomize'. Optional. Use
when action = bake. Render Engine. Default: helm.
#dockerComposeFile: # string. Required when action = bake && renderType
= kompose. Path to docker compose file.
#helmChart: # string. Required when action = bake && renderType = helm.
Helm Chart.
#releaseName: # string. Optional. Use when action = bake && renderType =
helm. Helm Release Name.
#overrideFiles: # string. Optional. Use when action = bake && renderType
= helm. Override Files.
#overrides: # string. Optional. Use when action = bake && renderType =
helm. Overrides.
#kustomizationPath: # string. Optional. Use when action = bake &&
renderType = kustomize. Kustomization Path.
#resourceToPatch: 'file' # 'file' | 'name'. Required when action =
patch. Resource to patch. Default: file.
#resourceFileToPatch: # string. Required when action = patch &&
resourceToPatch = file. File path.
#kind: # 'deployment' | 'replicaset' | 'statefulset'. Required when
action = scale || resourceToPatch = name. Kind.
#name: # string. Required when action = scale || resourceToPatch = name.
Name.
#replicas: # string. Required when action = scale. Replica count.
#mergeStrategy: 'strategic' # 'json' | 'merge' | 'strategic'. Required
when action = patch. Merge Strategy. Default: strategic.
#arguments: # string. Optional. Use when action = delete. Arguments.
#patch: # string. Required when action = patch. Patch.
#secretType: 'dockerRegistry' # 'dockerRegistry' | 'generic'. Required
when action = createSecret. Type of secret. Default: dockerRegistry.
#secretName: # string. Optional. Use when action = createSecret. Secret
name.
#secretArguments: # string. Optional. Use when action = createSecret &&
secretType = generic. Arguments.
#dockerRegistryEndpoint: # string. Optional. Use when action =
createSecret && secretType = dockerRegistry. Docker registry service
connection.
#rolloutStatusTimeout: '0' # string. Optional. Use when action = deploy
|| action = patch || action = scale || action = promote. Timeout for rollout
status. Default: 0.
Inputs
action - Action
string . Allowed values: bake , createSecret (create secret), delete , deploy , patch ,
namespace - Namespace
string .
Specifies the namespace for the commands by using the –namespace flag. If the
namespace is not provided, the commands will run in the default namespace.
strategy - Strategy
string . Optional. Use when action = deploy || action = promote || action = reject .
Specifies the deployment strategy used in the deploy action before a promote action or
reject action. Currently, canary is the only acceptable deployment strategy.
pod .
For the value smi , the percentage traffic split is done at the request level by using a
service mesh. A service mesh must be set up by a cluster admin. This task handles
orchestration of SMI TrafficSplit objects.
For the value pod , the percentage split isn't possible at the request level in the absence
of a service mesh. Instead, the percentage input is used to calculate the replicas for
baseline and canary. The calculation is a percentage of replicas that are specified in the
input manifests for the stable variant.
percentage - Percentage
string . Required when strategy = Canary && action = deploy . Default value: 0 .
The percentage that is used to compute the number of baseline-variant and canary-
variant replicas of the workloads that are contained in manifest files.
If the result isn't an integer, the mathematical floor of the result is used when baseline
and canary variants are created.
For example, assume the deployment hello-world is in the input manifest file and that
the following lines are in the task input:
replicas: 4
strategy: canary
percentage: 25
When you set trafficSplitMethod to smi , the percentage traffic split is controlled in the
service mesh plane. You can control the actual number of replicas for canary and
baseline variants independently of the traffic split.
For example, assume that the input deployment manifest specifies 30 replicas for the
stable variant. Also assume that you specify the following input for the task:
strategy: canary
trafficSplitMethod: smi
percentage: 20
baselineAndCanaryReplicas: 1
In this case, the stable variant receives 80% of the traffic, while the baseline and canary
variants each receive half of the specified 20%. Baseline and canary variants don't
receive three replicas each. They instead receive the specified number of replicas, which
means they each receive one replica.
manifests - Manifests
Specifies the path to the manifest files to be used for deployment. Each line represents a
single path. A file-matching pattern is an acceptable value for each line.
containers - Containers
string . Optional. Use when action = deploy || action = promote || action = bake .
Specifies the fully qualified resource URL of the image to be used for substitutions on
the manifest files. The URL contosodemo.azurecr.io/helloworld:test is an example.
imagePullSecrets - ImagePullSecrets
Specifies a multiline input where each line contains the name of a Docker registry secret
that has already been set up within the cluster. Each secret name is added under
imagePullSecrets for the workloads that are found in the input manifest files.
string . Optional. Use when action = bake . Allowed values: helm , kompose , kustomize .
Specifies a multiline input that accepts the path to the override files. The files are used
when manifest files from Helm charts are baked.
overrides - Overrides
string . Optional. Use when action = bake && renderType = helm .
Specifies the argument that must be the path to the directory containing the file, or a git
repository URL with a path suffix specifying same with respect to the repository root.
string . Required when action = patch . Allowed values: file , name . Default value:
file .
kind - Kind
Specifies the kind of K8s object, such as deployment , replicaSet and more.
name - Name
string . Required when action = patch . Allowed values: json , merge , strategic .
arguments - Arguments
Specifies the arguments for the kubectl delete command. An example is: arguments:
deployment hello-world foo-bar
patch - Patch
Specifies the name of the secret. You can use this secret name in the Kubernetes YAML
configuration file.
secretArguments - Arguments
string . Optional. Use when action = createSecret && secretType = generic .
Specifies keys and literal values to insert in secret. For example, --from-
literal=key1=value1 --from-literal=key2="top secret" .
Specifies the credentials of the specified service connection that are used to create a
Docker registry secret within the cluster. Manifest files under the imagePullSecrets field
can then refer to this secret's name.
string . Optional. Use when action = deploy || action = patch || action = scale ||
action = promote . Default value: 0 .
Specifies the length of time (in seconds) to wait before ending watch on rollout status.
Output variables
This task defines the following output variables, which you can consume in downstream
steps, jobs, and stages.
manifestsBundle
Remarks
7 Note
There is a newer version of this task available that provides additional support for
targetting a Kubernetes cluster in different ways, using the connectionType
property. For more information, see KubernetesManifest@1 and
KubernetesManifest@1 service connection remarks
Use a Kubernetes manifest task in a build or release pipeline to bake and deploy
manifests to Kubernetes clusters.
Secret handling: The createSecret action lets Docker registry secrets be created
using Docker registry service connections. It also lets generic secrets be created
using either plain-text variables or secret variables. Before deployment to the
cluster, you can use the secrets input along with the deploy action to augment
the input manifest files with the appropriate imagePullSecrets value.
Bake manifest: The bake action of the task allows for baking templates into
Kubernetes manifest files. The action uses tools such as Helm, Compose, and
Kustomize. With baking, these Kubernetes manifest files are usable for
deployments to the cluster.
Deployment strategy: Choosing the canary strategy with the deploy action leads
to the creation of workload names suffixed with -baseline and -canary . The task
supports two methods of traffic splitting:
Service Mesh Interface: Service Mesh Interface (SMI) abstraction allows
configuration with service mesh providers like Linkerd and Istio . The
Kubernetes Manifest task maps SMI TrafficSplit objects to the stable,
baseline, and canary services during the life cycle of the deployment strategy.
Canary deployments that are based on a service mesh and use this task are
more accurate. This accuracy is due to how service mesh providers enable the
granular percentage-based split of traffic. The service mesh uses the service
registry and sidecar containers that are injected into pods. This injection occurs
alongside application containers to achieve the granular traffic split.
Kubernetes with no service mesh: In the absence of a service mesh, you might
not get the exact percentage split you want at the request level. However, you
can do canary deployments by using baseline and canary variants next to the
stable variant.
The service sends requests to pods of all three workload variants as the
selector-label constraints are met. Kubernetes Manifest honors these requests
when creating baseline and canary variants. This routing behavior achieves the
intended effect of routing only a portion of total requests to the canary.
Compare the baseline and canary workloads by using either a Manual Intervention
task in release pipelines or a Delay task in YAML pipelines. Do the comparison
before using the promote or reject action of the task.
Deploy action
The following YAML code is an example of deploying to a Kubernetes namespace by
using manifest files:
YAML
steps:
- task: KubernetesManifest@0
displayName: Deploy
inputs:
kubernetesServiceConnection: someK8sSC1
namespace: default
manifests: |
manifests/deployment.yml
manifests/service.yml
containers: |
foo/demo:$(tagVariable1)
bar/demo:$(tagVariable2)
imagePullSecrets: |
some-secret
some-other-secret
In the above example, the task tries to find matches for the images foo/demo and
bar/demo in the image fields of manifest files. For each match found, the value of either
tagVariable1 or tagVariable2 is appended as a tag to the image name. You can also
7 Note
While you can author deploy , promote , and reject actions with YAML input related
to deployment strategy, support for a Manual Intervention task is currently
unavailable for build pipelines.
For release pipelines, we advise you to use actions and input related to deployment
strategy in the following sequence:
2. A Manual Intervention task so that you can pause the pipeline and compare
the baseline variant with the canary variant.
3. A promote action that runs if a Manual Intervention task is resumed and a
reject action that runs if a Manual Intervention task is rejected.
YAML
steps:
- task: KubernetesManifest@0
displayName: Create secret
inputs:
action: createSecret
secretType: dockerRegistry
secretName: foobar
dockerRegistryEndpoint: demoACR
kubernetesServiceConnection: someK8sSC
namespace: default
This YAML code shows a sample creation of generic secrets:
YAML
steps:
- task: KubernetesManifest@0
displayName: Create secret
inputs:
action: createSecret
secretType: generic
secretName: some-secret
secretArguments: --from-literal=key1=value1
kubernetesServiceConnection: someK8sSC
namespace: default
Bake action
The following YAML code is an example of baking manifest files from Helm charts. Note
the usage of a name input in the first task. This name is later referenced from the deploy
step for specifying the path to the manifests that were produced by the bake step.
YAML
steps:
- task: KubernetesManifest@0
name: bake
displayName: Bake K8s manifests from Helm chart
inputs:
action: bake
helmChart: charts/sample
overrides: 'image.repository:nginx'
- task: KubernetesManifest@0
displayName: Deploy K8s manifests
inputs:
kubernetesServiceConnection: someK8sSC
namespace: default
manifests: $(bake.manifestsBundle)
containers: |
nginx: 1.7.9
7 Note
To use Helm directly for managing releases and rollbacks, see the Package and
deploy Helm charts task.
Kustomize example
The following YAML code is an example of baking manifest files generated with
Kustomize that contain a kustomization.yaml file.
YAML
steps:
- task: KubernetesManifest@0
name: bake
displayName: Bake K8s manifests from kustomization path
inputs:
action: bake
renderType: kustomize
kustomizationPath: folderContainingKustomizationFile
- task: KubernetesManifest@0
displayName: Deploy K8s manifests
inputs:
kubernetesServiceConnection: k8sSC1
manifests: $(bake.manifestsBundle)
Kompose example
The following YAML code is an example of baking manifest files generated with
Kompose, a conversion tool for Docker Compose.
YAML
steps:
- task: KubernetesManifest@0
name: bake
displayName: Bake K8s manifests from Docker Compose
inputs:
action: bake
renderType: kompose
dockerComposeFile: docker-compose.yaml
- task: KubernetesManifest@0
displayName: Deploy K8s manifests
inputs:
kubernetesServiceConnection: k8sSC1
manifests: $(bake.manifestsBundle)
Scale action
The following YAML code shows an example of scaling objects:
YAML
steps:
- task: KubernetesManifest@0
displayName: Scale
inputs:
action: scale
kind: deployment
name: bootcamp-demo
replicas: 5
kubernetesServiceConnection: someK8sSC
namespace: default
Patch action
The following YAML code shows an example of object patching:
YAML
steps:
- task: KubernetesManifest@0
displayName: Patch
inputs:
action: patch
kind: pod
name: demo-5fbc4d6cd9-pgxn4
mergeStrategy: strategic
patch: '{"spec":{"containers":
[{"name":"demo","image":"foobar/demo:2239"}]}}'
kubernetesServiceConnection: someK8sSC
namespace: default
Delete action
This YAML code shows a sample object deletion:
YAML
steps:
- task: KubernetesManifest@0
displayName: Delete
inputs:
action: delete
arguments: deployment expressapp
kubernetesServiceConnection: someK8sSC
namespace: default
Troubleshooting
You can grant hosted agents access through your firewall by allowing the IP addresses
for the hosted agents. For more details, see Agent IP ranges.
If the task includes the inputs of action: deploy and strategy: canary , for each
workload (Deployment, ReplicaSet, Pod, ...) defined in the input manifest files, a -
baseline and -canary variant of the deployment are created. In this example, there's a
deployment sampleapp in the input manifest file and that after completion of run
number 22 of the pipeline, the stable variant of this deployment named sampleapp is
deployed in the cluster. In the subsequent run (in this case run number 23), Kubernetes
manifest task with action: deploy and strategy: canary would result in creation of
sampleapp-baseline and sampleapp-canary deployments whose number of replicas are
determined by the product of percentage task input with the value of the desired
number of replicas for the final stable variant of sampleapp as per the input manifest
files.
Excluding the number of replicas, the baseline version has the same configuration as the
stable variant while the canary version has the new changes that are being introduced
by the current run (in this case, run number 23). If a manual intervention is set up in the
pipeline after the above mentioned step, it would allow for an opportunity to pause the
pipeline so that the pipeline admin can evaluate key metrics for the baseline and canary
versions and take the decision on whether the canary changes are safe and good
enough for a complete rollout.
The action: promote and strategy: canary or action: reject and strategy: canary
inputs of the Kubernetes manifest tasks can be used to promote or reject the canary
changes respectively. Note that in either cases, at the end of this step, only the stable
variant of the workloads declared in the input manifest files will be remain deployed in
the cluster, while the ephemeral baseline and canary versions are cleaned up.
Requirements
ノ Expand table
Requirement Description
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Feedback
Was this page helpful? Yes No
Build or push Docker images, log in or log out, start or stop containers, or run a Docker
command.
Syntax
YAML
# Docker v2
# Build or push Docker images, login or logout, start or stop containers, or
run a Docker command.
- task: Docker@2
inputs:
# Container Repository
#containerRegistry: # string. Container registry.
#repository: # string. Optional. Use when command != login && command !=
logout && command != start && command != stop. Container repository.
# Commands
command: 'buildAndPush' # 'buildAndPush' | 'build' | 'push' | 'login' |
'logout' | 'start' | 'stop'. Required. Command. Default: buildAndPush.
Dockerfile: '**/Dockerfile' # string. Required when command = build ||
command = buildAndPush. Dockerfile. Default: **/Dockerfile.
#buildContext: '**' # string. Optional. Use when command = build ||
command = buildAndPush. Build context. Default: **.
#tags: '$(Build.BuildId)' # string. Optional. Use when command = build
|| command = push || command = buildAndPush. Tags. Default:
$(Build.BuildId).
#arguments: # string. Optional. Use when command != login && command !=
logout && command != buildAndPush. Arguments.
#addPipelineData: true # boolean. Add Pipeline metadata to image(s).
Default: true.
#addBaseImageData: true # boolean. Add base image metadata to image(s).
Default: true.
#container: # string. Optional. Use when command = start || command =
stop. Container.
Inputs
containerRegistry - Container registry
string .
Name of the Docker registry service connection. Required for commands that perform
authentication with a registry.
repository - Container repository
string . Optional. Use when command != login && command != logout && command !=
start && command != stop .
command - Command
string . Required. Allowed values: buildAndPush , build , push , login , logout , start ,
stop . Default value: buildAndPush .
Dockerfile - Dockerfile
Specifies the path to the Docker file. The task uses the first Docker file it finds to build
the image.
** .
Specifies the path to the build context. Pass ** to indicate the directory that contains
the Docker file.
tags - Tags
Specifies a list of comma-separated tags. These tags are used in build , push and
buildAndPush commands.
arguments - Arguments
string . Optional. Use when command != login && command != logout && command !=
buildAndPush .
Specifies additional arguments to pass to the Docker client. If using the value
buildAndPush for the command parameter, the arguments property is ignored.
By default, pipeline data like source branch name, or build ID are added and help with
traceability. For example, you can inspect an image to find out which pipeline built the
image. You can opt out of this default behavior.
By default, base image data like base image name, or digest are added and help with
traceability. You can opt out of this default behavior.
container - Container
Specifies the name of the container resource to start or stop. Use this command with
start and stop commands.
Output variables
This task defines the following output variables, which you can consume in downstream
steps, jobs, and stages.
DockerOutput
Specifies the path to the files that contain the command output. You can list two file
paths on separate lines for the buildAndPush command, and one file path for any other
command.
Remarks
The following are the key benefits of using the Docker task instead of directly using
Docker client binary in a script.
Integration with Docker registry service connection - The task makes it easy to
use a Docker registry service connection for connecting to any container registry.
Once signed in, you can add follow up tasks that execute other tasks or scripts by
leveraging the sign on used by the Docker task. For example, use the Docker task
to sign in to any Azure Container Registry, and then use another task or script to
build and push an image to the registry.
Troubleshooting
A Docker task configured using the buildAndPush command ignores the arguments
passed because they become ambiguous to the internal build and push commands. You
can split your command into separate build and push steps and pass the suitable
arguments. For example, see this stackoverflow post .
DockerV2 only supports Docker registry service connection and not
support ARM service connection. How can I use an existing Azure
service principal (SPN) for authentication in Docker task?
You can create a Docker registry service connection using your Azure SPN credentials.
Choose the others from Registry type and provide the details as follows:
Examples
Login
YAML
The following YAML snippet shows a container registry sign on using a Docker
registry service connection.
YAML
- task: Docker@2
displayName: Login to ACR
inputs:
command: login
containerRegistry: dockerRegistryServiceConnection1
YAML
The following YAML snippet is an example of building and pushing multiple tags of
an image to multiple registries.
YAML
steps:
- task: Docker@2
displayName: Login to ACR
inputs:
command: login
containerRegistry: dockerRegistryServiceConnection1
- task: Docker@2
displayName: Login to Docker Hub
inputs:
command: login
containerRegistry: dockerRegistryServiceConnection2
- task: Docker@2
displayName: Build and Push
inputs:
command: buildAndPush
repository: contosoRepository # username/contosoRepository for
DockerHub
tags: |
tag1
tag2
If you want to build and push to a specific authenticated container registry instead
of building and pushing to all authenticated container registries at once, explicitly
specify the containerRegistry input with command: buildAndPush as shown:
YAML
steps:
- task: Docker@2
displayName: Build and Push
inputs:
command: buildAndPush
containerRegistry: dockerRegistryServiceConnection1
repository: contosoRepository
tags: |
tag1
tag2
Logout
YAML
The following YAML snippet shows how to log out from a container registry using a
Docker registry service connection.
YAML
- task: Docker@2
displayName: Logout of ACR
inputs:
command: logout
containerRegistry: dockerRegistryServiceConnection1
Start/stop
Use this task to control job and service containers. This usage is uncommon, but
occasionally used in unique circumstances.
YAML
resources:
containers:
- container: builder
image: ubuntu:18.04
steps:
- script: echo "I can run inside the container (it starts by default)"
target:
container: builder
- task: Docker@2
inputs:
command: stop
container: builder
# any task beyond this point would not be able to target the builder
container
# because it's been stopped
YAML
steps:
- task: Docker@2
displayName: Login to ACR
inputs:
command: login
containerRegistry: dockerRegistryServiceConnection1
- task: Docker@2
displayName: Build
inputs:
command: build
repository: contosoRepository # username/contosoRepository for DockerHub
tags: tag1
arguments: --secret id=mysecret,src=mysecret.txt
7 Note
Requirements
ノ Expand table
Requirement Description
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Feedback
Was this page helpful? Yes No
Provide product feedback
Docker@1 - Docker v1 task
Article • 04/29/2024
Build, tag, push, or run Docker images, or run a Docker command. Use this task with
Docker or the Azure Container registry.
7 Note
Docker@2 is a newer version of this task that simplifies the task by removing inputs
that can be passed as arguments to the command.
Syntax
# Docker v1
# Build, tag, push, or run Docker images, or run a Docker command.
- task: Docker@1
inputs:
# Container Registry
#containerregistrytype: 'Azure Container Registry' # 'Azure Container
Registry' | 'Container Registry'. Required when command != logout. Container
registry type. Default: Azure Container Registry.
#dockerRegistryEndpoint: # string. Optional. Use when
containerregistrytype = Container Registry && command != logout. Docker
registry service connection.
#azureSubscriptionEndpoint: # string. Optional. Use when
containerregistrytype = Azure Container Registry && command != logout. Azure
subscription.
#azureContainerRegistry: # string. Optional. Use when
containerregistrytype = Azure Container Registry && command != logout. Azure
container registry.
# Commands
#addBaseImageData: true # boolean. Add base image metadata to image(s).
Default: true.
command: 'Build an image' # 'Build an image' | 'Tag image' | 'Push an
image' | 'Run an image' | 'login' | 'logout'. Required. Command. Default:
Build an image.
#dockerFile: '**/Dockerfile' # string. Required when command = Build an
image || command = build. Dockerfile. Default: **/Dockerfile.
#arguments: # string. Optional. Use when command != login && command !=
logout. Arguments.
#pushMultipleImages: false # boolean. Optional. Use when command = Push
an image || command = push. Push multiple images. Default: false.
#tagMultipleImages: false # boolean. Optional. Use when command = Tag
image || command = tag. Tag multiple images. Default: false.
#imageName: '$(Build.Repository.Name):$(Build.BuildId)' # string.
Required when command = Build an image || command = build || command = Run
an image || command = run || pushMultipleImages = false || tagMultipleImages
= false. Image name. Default: $(Build.Repository.Name):$(Build.BuildId).
#imageNamesPath: # string. Required when tagMultipleImages = true ||
pushMultipleImages = true. Image names path.
#qualifyImageName: true # boolean. Optional. Use when command = Build an
image || command = build || command = Tag image || command = tag || command
= Push an image || command = push || command = Run an image || command =
run. Qualify image name. Default: true.
#qualifySourceImageName: false # boolean. Optional. Use when command =
Tag image || command = tag. Qualify source image name. Default: false.
#includeSourceTags: false # boolean. Optional. Use when command = Build
an image || command = build || command = Tag image || command = tag ||
command = Push an image || command = push. Include source tags. Default:
false.
#includeLatestTag: false # boolean. Optional. Use when command = Build
an image || command = build. Include latest tag. Default: false.
#addDefaultLabels: true # boolean. Optional. Use when addDefaultLabels =
false. Add default labels. Default: true.
#useDefaultContext: true # boolean. Optional. Use when command = Build
an image || command = build. Use default build context. Default: true.
#buildContext: # string. Optional. Use when useDefaultContext = false.
Build context.
#imageDigestFile: # string. Optional. Use when command = Push an image
|| command = push. Image digest file.
#containerName: # string. Optional. Use when command = Run an image ||
command = run. Container name.
#ports: # string. Optional. Use when command = Run an image || command =
run. Ports.
#volumes: # string. Optional. Use when command = Run an image || command
= run. Volumes.
#envVars: # string. Optional. Use when command = Run an image || command
= run. Environment variables.
#workingDirectory: # string. Optional. Use when command = Run an image
|| command = run. Working directory.
#entrypointOverride: # string. Optional. Use when command = Run an image
|| command = run. Entry point override.
#containerCommand: # string. Optional. Use when command = Run an image
|| command = run. Container command.
#runInBackground: true # boolean. Optional. Use when command = Run an
image || command = run. Run in background. Default: true.
restartPolicy: 'no' # 'no' | 'onFailure' | 'always' | 'unlessStopped'.
Required when runInBackground = true. Restart policy. Default: no.
#maxRestartRetries: # string. Optional. Use when runInBackground = true
&& restartPolicy = onFailure. Maximum restart retries.
# Advanced Options
#dockerHostEndpoint: # string. Optional. Use when command != login &&
command != logout. Docker host service connection.
#enforceDockerNamingConvention: true # boolean. Optional. Use when
command != login && command != logout. Force image name to follow Docker
naming convention. Default: true.
#memoryLimit: # string. Optional. Use when command != login && command
!= logout. Memory limit.
Inputs
containerregistrytype - Container registry type
string . Required when command != logout . Allowed values: Azure Container Registry ,
Container Registry . Default value: Azure Container Registry .
Specifies the Azure Container Registry to connect using an Azure Service Connection.
Select an Azure Container Registry to connect to a Docker Hub or any other private
container registry.
The default value adds base image data, such as the base image name and digest, to
help with traceability. You can opt out of this default behavior by setting this value to
false .
logout .
Specifies a Docker registry service connection. Required for commands that authenticate
using a registry.
command != logout .
command != logout .
Specifies an Azure Container Registry in the selected Azure Subscription. The container
image is built and pushed to this container registry.
command - Command
string . Required. Allowed values: Build an image (build), Tag image (tag), Push an
image (push), Run an image (run), login , logout . Default value: Build an image .
dockerFile - Dockerfile
string . Required when command = Build an image || command = build . Default value:
**/Dockerfile .
Specifies the path to the Docker file. The task uses the first docker file it finds to build
the image.
arguments - Arguments
Specifies additional arguments to pass to the docker client. Using the value
buildAndPush in the command parameter ignores the arguments property.
boolean . Optional. Use when command = Push an image || command = push . Default value:
false .
Specifies a list in a text file of Docker images to push. List each image name in the
format Imagename1:tag1 on a separate line. Listing an image name without tags, for
example Imagename2 , pushes all tags in the Imagename2 container.
boolean . Optional. Use when command = Tag image || command = tag . Default value:
false .
Specifies a list of multiple image tags and Docker images to tag in a text file. List each
image name in the format Imagename1:tag1 on a separate line. Images listed without a
tag as Imagename2 are tagged as latest by default.
string . Required when command = Build an image || command = build || command = Run
an image || command = run || pushMultipleImages = false || tagMultipleImages =
false . Default value: $(Build.Repository.Name):$(Build.BuildId) .
Specifies the path to a text file that contains the names of the Docker images to tag or
push. List each image name on a separate line.
boolean . Optional. Use when command = Build an image || command = build || command
= Tag image || command = tag || command = Push an image || command = push ||
Specifies a qualify image name with the Docker registry service connection's hostname.
false .
Specifies a qualify image name with the Docker registry service connection's hostname.
= Tag image || command = tag || command = Push an image || command = push . Default
value: false .
Specifies Git tags to include when building or pushing the Docker image.
boolean . Optional. Use when command = Build an image || command = build . Default
value: false .
Specifies whether to use the latest tag when building the Docker image.
addDefaultLabels - Add default labels
boolean . Optional. Use when addDefaultLabels = false . Default value: true .
Specifies whether to add CI/CD metadata to the container image by using Docker labels,
like repository, commit, build and release information.
value: true .
Specifies adding or removing build context to the directory that contains the Docker file.
Specifies the path to a file that is created and populated with the full image repository
digest of the Docker image that was pushed.
ports - Ports
Specifies the ports in the Docker container to publish to the host. List each host-
port:container-port binding on a separate line.
volumes - Volumes
Specifies environment variables for the Docker container. List each name=value pair on a
separate line.
Specifies whether to override the default entry point for the Docker container.
Specifies a Docker run command. The docker run command first creates a writeable
container layer over the specified image, and then starts it by using the specified run
command. For example, if the image contains a simple Python Flask web application you
can specify python app.py to launch the web application.
boolean . Optional. Use when command = Run an image || command = run . Default value:
true .
Specifies the maximum number of restart retries the Docker daemon attempts.
convention
boolean . Optional. Use when command != login && command != logout . Default value:
true .
The default value modifies the Docker image name according to Docker naming
conventions. For example, convert upper case characters to lower case and remove
spaces.
Specifies the maximum amount of memory available to the container as an integer with
optional suffixes like 2GB .
Output variables
This task defines the following output variables, which you can consume in downstream
steps, jobs, and stages.
DockerOutput
The path of the file which contains the output of the build command.
Remarks
Docker@2 is a newer version of this task that simplifies the task by removing inputs that
can be passed as arguments to the command.
Requirements
ノ Expand table
Requirement Description
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
See also
Docker@2
Feedback
Was this page helpful? Yes No
Build, tag, push, run Docker images, or run a Docker command. Use this task with
Docker or the Azure Container registry.
7 Note
Docker@2 is a newer version of this task that simplifies the task by removing inputs
that can be passed as arguments to the command.
Syntax
# Docker v0
# Build, tag, push, or run Docker images, or run a Docker command.
- task: Docker@0
inputs:
containerregistrytype: 'Azure Container Registry' # 'Azure Container
Registry' | 'Container Registry'. Required. Container Registry Type.
Default: Azure Container Registry.
#dockerRegistryConnection: # string. Alias: dockerRegistryEndpoint.
Optional. Use when containerregistrytype = Container Registry. Docker
Registry Service Connection.
#azureSubscription: # string. Alias: azureSubscriptionEndpoint.
Optional. Use when containerregistrytype = Azure Container Registry. Azure
subscription.
#azureContainerRegistry: # string. Optional. Use when
containerregistrytype = Azure Container Registry. Azure Container Registry.
action: 'Build an image' # 'Build an image' | 'Tag images' | 'Push an
image' | 'Push images' | 'Run an image' | 'Run a Docker command'. Required.
Action. Default: Build an image.
#dockerFile: '**/Dockerfile' # string. Required when action = Build an
image. Docker File. Default: **/Dockerfile.
#buildArguments: # string. Optional. Use when action = Build an image.
Build Arguments.
#defaultContext: true # boolean. Optional. Use when action = Build an
image. Use Default Build Context. Default: true.
#context: # string. Optional. Use when action = Build an image &&
defaultContext = false. Build Context.
#imageName: '$(Build.Repository.Name):$(Build.BuildId)' # string.
Required when action == Build an image || action == Push an image || action
== Run an image. Image Name. Default:
$(Build.Repository.Name):$(Build.BuildId).
#imageNamesPath: # string. Required when action == Tag images || action
== Push images. Image Names Path.
#qualifyImageName: true # boolean. Optional. Use when action = Build an
image || action = Tag images || action = Push an image || action = Push
images || action = Run an image. Qualify Image Name. Default: true.
#additionalImageTags: # string. Optional. Use when action = Build an
image || action = Tag images || action = Push an image || action = Push
images. Additional Image Tags.
#includeSourceTags: false # boolean. Optional. Use when action = Build
an image || action = Tag image || action = Push an image || action = Push
images. Include Source Tags. Default: false.
#includeLatestTag: false # boolean. Optional. Use when action = Build an
image || action = Push an image || action = Push images. Include Latest Tag.
Default: false.
#imageDigestFile: # string. Optional. Use when action = Push an image ||
action = Push images. Image Digest File.
#containerName: # string. Optional. Use when action = Run an image.
Container Name.
#ports: # string. Optional. Use when action = Run an image. Ports.
#volumes: # string. Optional. Use when action = Run an image. Volumes.
#envVars: # string. Optional. Use when action = Run an image.
Environment Variables.
#workDir: # string. Optional. Use when action = Run an image. Working
Directory.
#entrypoint: # string. Optional. Use when action = Run an image. Entry
Point Override.
#containerCommand: # string. Optional. Use when action = Run an image.
Command.
#detached: true # boolean. Optional. Use when action = Run an image. Run
In Background. Default: true.
#restartPolicy: 'no' # 'no' | 'onFailure' | 'always' | 'unlessStopped'.
Required when action = Run an image && detached = true. Restart Policy.
Default: no.
#restartMaxRetries: # string. Optional. Use when action = Run an image
&& detached = true && restartPolicy = onFailure. Maximum Restart Retries.
#customCommand: # string. Required when action = Run a Docker command.
Command.
# commands
#addBaseImageData: true # boolean. Add base image metadata to image(s).
Default: true.
# Advanced Options
#dockerHostEndpoint: # string. Docker Host Service Connection.
#enforceDockerNamingConvention: true # boolean. Force image name to
follow Docker naming convention. Default: true.
#workingDirectory: '$(System.DefaultWorkingDirectory)' # string. Alias:
cwd. Working Directory. Default: $(System.DefaultWorkingDirectory).
#memory: # string. Memory limit.
Inputs
containerregistrytype - Container Registry Type
Specifies a Docker registry service connection. Required for commands that need to
authenticate with a registry.
Specifies an Azure Container Registry in the selected Azure Subscription. The container
image is built and then pushed to this container registry.
action - Action
string . Required. Allowed values: Build an image , Tag images , Push an image , Push
images , Run an image , Run a Docker command . Default value: Build an image .
Specifies the path to the Docker file. The task uses the first Docker file it finds to build
the image.
Specifies build-time variables for the Docker file. Format each name=value pair on a new
line.
boolean . Optional. Use when action = Build an image . Default value: true .
Specifies the build context of the directory that contains the Docker file.
Specifies the path to a text file that contains the names of the Docker images to tag or
push. List each image name on a separate line.
boolean . Optional. Use when action = Build an image || action = Tag images ||
action = Push an image || action = Push images || action = Run an image . Default
value: true .
Specifies a qualify image name with the Docker registry service connection's hostname.
additionalImageTags - Additional Image Tags
string . Optional. Use when action = Build an image || action = Tag images || action
Specifies additional tags for the Docker image being built or pushed.
Specifies whether to include Git tags when building or pushing the Docker image.
Specifies whether to include the latest tag when building or pushing the Docker image.
Specifies the path to a file that is created and populated with the full image repository
digest of the Docker image that was pushed.
ports - Ports
string . Optional. Use when action = Run an image .
Specifies ports in the Docker container to publish to the host. List each host-
port:container-port binding on a new line.
volumes - Volumes
string . Optional. Use when action = Run an image .
Specifies the volumes to mount from the host. List each host-dir:container-dir on a
new line.
Specifies environment variables for the Docker container. List each name=value pair on a
new line.
Specifies an override of the default entry point for the Docker container.
containerCommand - Command
Specifies a Docker run command. The docker run command first creates a writeable
container layer over the specified image, and then starts it by using the specified run
command. For example, if the image contains a simple Python Flask web application you
can specify python app.py to launch the web application.
boolean . Optional. Use when action = Run an image . Default value: true .
restartPolicy = onFailure .
Specifies the maximum number of restart retries that the Docker daemon attempts.
customCommand - Command
string . Required when action = Run a Docker command .
Specifies the Docker command and arguments to execute. For example, rmi -f image-
name removes an image.
convention
boolean . Default value: true .
If enabled, modifies the Docker image name according to Docker naming conventions.
For example, convert upper case characters to lower case and remove spaces.
Specifies the maximum amount of memory available to the container as a integer with
optional suffixes, for example 2GB .
Output variables
This task defines the following output variables, which you can consume in downstream
steps, jobs, and stages.
DockerOutput
Stores the output of the docker command.
DockerOutputPath
The path of the file which contains the output of the build command.
Remarks
Docker@2 is a newer version of this task that simplifies the task by removing inputs that
can be passed as arguments to the command.
Requirements
ノ Expand table
Requirement Description
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
See also
Docker@2
Feedback
Was this page helpful? Yes No
Syntax
YAML
Inputs
dockerVersion - Docker Version
string . Allowed values: stable , edge , test , nightly . Default value: stable .
Specifies the release type to install. The value nightly is not supported on Windows.
Output variables
None.
Remarks
Use this task to install a specific version of the Docker CLI on the agent machine.
Examples
This YAML example installs the Docker CLI on the agent machine:
YAML
- task: DockerInstaller@0
displayName: Docker Installer
inputs:
dockerVersion: 17.09.0-ce
releaseType: stable
Requirements
ノ Expand table
Requirement Description
Demands None
Capabilities Running this task satisfies the following demands for any subsequent tasks
in the same job: Docker
Command Any
restrictions
Feedback
Was this page helpful? Yes No
Build, push or run multi-container Docker applications. Use this task with Docker or the
Azure Container registry.
Syntax
YAML
# Docker Compose v0
# Build, push or run multi-container Docker applications. Task can be used
with Docker or Azure Container registry.
- task: DockerCompose@0
inputs:
containerregistrytype: 'Azure Container Registry' # 'Azure Container
Registry' | 'Container Registry'. Required. Container Registry Type.
Default: Azure Container Registry.
#dockerRegistryEndpoint: # string. Optional. Use when
containerregistrytype = Container Registry. Docker Registry Service
Connection.
#azureSubscription: # string. Alias: azureSubscriptionEndpoint.
Optional. Use when containerregistrytype = Azure Container Registry. Azure
subscription.
#azureContainerRegistry: # string. Optional. Use when
containerregistrytype = Azure Container Registry. Azure Container Registry.
dockerComposeFile: '**/docker-compose.yml' # string. Required. Docker
Compose File. Default: **/docker-compose.yml.
#additionalDockerComposeFiles: # string. Additional Docker Compose
Files.
#dockerComposeFileArgs: # string. Environment Variables.
#projectName: '$(Build.Repository.Name)' # string. Project Name.
Default: $(Build.Repository.Name).
#qualifyImageNames: true # boolean. Qualify Image Names. Default: true.
action: 'Run a Docker Compose command' # 'Build services' | 'Push
services' | 'Run services' | 'Run a specific service' | 'Lock services' |
'Write service image digests' | 'Combine configuration' | 'Run a Docker
Compose command'. Required. Action. Default: Run a Docker Compose command.
#additionalImageTags: # string. Optional. Use when action = Build
services || action = Push services. Additional Image Tags.
#includeSourceTags: false # boolean. Optional. Use when action = Build
services || action = Push services. Include Source Tags. Default: false.
#includeLatestTag: false # boolean. Optional. Use when action = Build
services || action = Push services. Include Latest Tag. Default: false.
#buildImages: true # boolean. Optional. Use when action = Run services.
Build Images. Default: true.
#serviceName: # string. Required when action = Run a specific service.
Service Name.
#containerName: # string. Optional. Use when action = Run a specific
service. Container Name.
#ports: # string. Optional. Use when action = Run a specific service.
Ports.
#workingDirectory: # string. Alias: workDir. Optional. Use when action =
Run a specific service. Working Directory.
#entrypoint: # string. Optional. Use when action = Run a specific
service. Entry Point Override.
#containerCommand: # string. Optional. Use when action = Run a specific
service. Command.
#detached: true # boolean. Optional. Use when action = Run services ||
action = Run a specific service. Run in Background. Default: true.
#abortOnContainerExit: true # boolean. Optional. Use when action = Run
services && detached == false. Abort on Container Exit. Default: true.
#imageDigestComposeFile: '$(Build.StagingDirectory)/docker-
compose.images.yml' # string. Required when action = Write service image
digests. Image Digest Compose File. Default:
$(Build.StagingDirectory)/docker-compose.images.yml.
#removeBuildOptions: false # boolean. Optional. Use when action = Lock
services || action = Combine configuration. Remove Build Options. Default:
false.
#baseResolveDirectory: # string. Optional. Use when action = Lock
services || action = Combine configuration. Base Resolve Directory.
#outputDockerComposeFile: '$(Build.StagingDirectory)/docker-compose.yml'
# string. Required when action = Lock services || action = Combine
configuration. Output Docker Compose File. Default:
$(Build.StagingDirectory)/docker-compose.yml.
#dockerComposeCommand: # string. Required when action = Run a Docker
Compose command. Command.
#arguments: # string. Optional. Use when action != Lock services &&
action != Combine configuration && action != Write service image digests.
Arguments.
# Advanced Options
#dockerHostEndpoint: # string. Docker Host Service Connection.
#nopIfNoDockerComposeFile: false # boolean. No-op if no Docker Compose
File. Default: false.
#requireAdditionalDockerComposeFiles: false # boolean. Require
Additional Docker Compose Files. Default: false.
#currentWorkingDirectory: '$(System.DefaultWorkingDirectory)' # string.
Alias: cwd. Working Directory. Default: $(System.DefaultWorkingDirectory).
#dockerComposePath: # string. Docker Compose executable Path.
Inputs
containerregistrytype - Container Registry Type
string . Required. Allowed values: Azure Container Registry , Container Registry .
Specifies an Azure subscription. Name of the Azure Service Connection. To manually set
up the connection, see Azure Resource Manager service connection.
Specifies additional Docker Compose files that are combined with the primary Docker
Compose file. Relative paths are resolved relative to the directory containing the primary
Docker Compose file. If a specified file is not found, it is ignored. Specify each file path
on a new line.
Specifies the project name to use by default to name images and containers.
action - Action
string . Required. Allowed values: Build services (Build service images), Push services
(Push service images), Run services (Run service images), Run a specific service (Run
a specific service image), Lock services (Lock service images), Write service image
digests , Combine configuration , Run a Docker Compose command . Default value: Run a
Specifies additional tags for the Docker images being built or pushed. You can specify
multiple tags separating each with a line feed \n .
boolean . Optional. Use when action = Build services || action = Push services .
ports - Ports
string . Optional. Use when action = Run a specific service .
Specifies ports in the service container to publish to the host. Add each host-
port:container-port binding on a new line.
Input alias: workDir . string . Optional. Use when action = Run a specific service .
Specifies an override value for the default entry point of the service container.
containerCommand - Command
string . Optional. Use when action = Run a specific service .
Specifies the command to run in the service container. For example, if the image
contains a simple Python Flask web application you can specify python app.py to launch
the web application.
boolean . Optional. Use when action = Run services || action = Run a specific
service . Default value: true .
boolean . Optional. Use when action = Run services && detached == false . Default
value: true .
Specifies all containers that should stop when any container exits.
string . Required when action = Write service image digests . Default value:
$(Build.StagingDirectory)/docker-compose.images.yml .
Specifies the path to a Docker Compose file that is created and populated with the full
image repository digests of each service's Docker image.
Specifies if build options should be removed from the output Docker Compose file.
configuration .
Specifies the base directory from which relative paths in the output Docker Compose file
should be resolved.
outputDockerComposeFile - Output Docker Compose File
dockerComposeCommand - Command
Specifies the Docker Compose command to execute with arguments. For example, rm -
-all to remove all stopped service containers.
arguments - Arguments
string . Optional. Use when action != Lock services && action != Combine
configuration && action != Write service image digests .
Specifies a value to skip the task if the Docker Compose file does not exist. This option is
useful when the task offers optional behavior based on the existence of a Docker
Compose file in the repository.
Specifies a value to produce an error if the additional Docker Compose files do not exist.
This option overrides the default behavior that would ignore a file if it does not exist.
currentWorkingDirectory - Working Directory
Output variables
This task defines the following output variables, which you can consume in downstream
steps, jobs, and stages.
DockerComposeOutput
The path to the files which contain the output of the command. This can contain
multiple file paths (separated by newline characters) such as, dockerComposeRun
command (one for running and one for down), dockerPush (one for each image
pushed), dockerBuild (the build itself and all the tag commands) and dockerDigest (one
for each image pulled). The other commands only output one file.
Remarks
Use this task to build, push or run multi-container Docker applications. Use this task with
a Docker registry or an Azure Container Registry.
Examples
Azure Container Registry
Other container registries
Build service images
Push service images
Run service images
Run a specific service image
Lock service images
Write service image digests
Combine configuration
Run a Docker Compose command
YAML
variables:
azureContainerRegistry: Contoso.azurecr.io
azureSubscriptionEndpoint: Contoso
steps:
- task: DockerCompose@0
displayName: Container registry login
inputs:
containerregistrytype: Azure Container Registry
azureSubscriptionEndpoint: $(azureSubscriptionEndpoint)
azureContainerRegistry: $(azureContainerRegistry)
This YAML example specifies a container registry other than ACR where Contoso is the
name of the Docker registry service connection for the container registry:
YAML
- task: DockerCompose@0
displayName: Container registry login
inputs:
containerregistrytype: Container Registry
dockerRegistryEndpoint: Contoso
YAML
- task: DockerCompose@0
displayName: Build services
inputs:
action: Build services
azureSubscriptionEndpoint: $(azureSubscriptionEndpoint)
azureContainerRegistry: $(azureContainerRegistry)
dockerComposeFile: docker-compose.yml
projectName: $(Build.Repository.Name)
qualifyImageNames: true
additionalImageTags: $(Build.BuildId)
dockerComposeFileArgs: |
firstArg=$(firstArg)
secondArg=$(secondArg)
YAML
- task: DockerCompose@0
displayName: Push services
inputs:
action: Push services
azureSubscriptionEndpoint: $(azureSubscriptionEndpoint)
azureContainerRegistry: $(azureContainerRegistry)
dockerComposeFile: docker-compose.yml
projectName: $(Build.Repository.Name)
qualifyImageNames: true
additionalImageTags: $(Build.BuildId)
YAML
- task: DockerCompose@0
displayName: Run services
inputs:
action: Run services
azureSubscriptionEndpoint: $(azureSubscriptionEndpoint)
azureContainerRegistry: $(azureContainerRegistry)
dockerComposeFile: docker-compose.ci.build.yml
projectName: $(Build.Repository.Name)
qualifyImageNames: true
buildImages: true
abortOnContainerExit: true
detached: true
YAML
- task: DockerCompose@0
displayName: Run a specific service
inputs:
action: Run a specific service
azureSubscriptionEndpoint: $(azureSubscriptionEndpoint)
azureContainerRegistry: $(azureContainerRegistry)
dockerComposeFile: docker-compose.yml
projectName: $(Build.Repository.Name)
qualifyImageNames: true
serviceName: myhealth.web
ports: 80:80
detached: true
YAML
- task: DockerCompose@0
displayName: Lock services
inputs:
action: Lock services
azureSubscriptionEndpoint: $(azureSubscriptionEndpoint)
azureContainerRegistry: $(azureContainerRegistry)
dockerComposeFile: docker-compose.yml
projectName: $(Build.Repository.Name)
qualifyImageNames: true
outputDockerComposeFile: $(Build.StagingDirectory)/docker-compose.yml
- task: DockerCompose@0
displayName: Write service image digests
inputs:
action: Write service image digests
azureSubscriptionEndpoint: $(azureSubscriptionEndpoint)
azureContainerRegistry: $(azureContainerRegistry)
dockerComposeFile: docker-compose.yml
projectName: $(Build.Repository.Name)
qualifyImageNames: true
imageDigestComposeFile: $(Build.StagingDirectory)/docker-
compose.images.yml
Combine configuration
This YAML example combines configurations:
YAML
- task: DockerCompose@0
displayName: Combine configuration
inputs:
action: Combine configuration
azureSubscriptionEndpoint: $(azureSubscriptionEndpoint)
azureContainerRegistry: $(azureContainerRegistry)
dockerComposeFile: docker-compose.yml
additionalDockerComposeFiles: docker-compose.override.yml
projectName: $(Build.Repository.Name)
qualifyImageNames: true
outputDockerComposeFile: $(Build.StagingDirectory)/docker-compose.yml
YAML
- task: DockerCompose@0
displayName: Run a Docker Compose command
inputs:
action: Run a Docker Compose command
azureSubscriptionEndpoint: $(azureSubscriptionEndpoint)
azureContainerRegistry: $(azureContainerRegistry)
dockerComposeFile: docker-compose.yml
projectName: $(Build.Repository.Name)
qualifyImageNames: true
dockerComposeCommand: rm
Requirements
ノ Expand table
Requirement Description
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Feedback
Was this page helpful? Yes No
Use this task to download artifacts from a file share, like \\share\drop .
Syntax
# Download artifacts from file share v1
# Download artifacts from a file share, like \\share\drop.
- task: DownloadFileshareArtifacts@1
inputs:
filesharePath: # string. Required. File share path.
artifactName: # string. Required. Artifact name.
#itemPattern: '**' # string. Matching pattern. Default: **.
downloadPath: '$(System.ArtifactsDirectory)' # string. Required.
Download path. Default: $(System.ArtifactsDirectory).
# Advanced
#parallelizationLimit: '8' # string. Parallelization limit. Default: 8.
Inputs
filesharePath - File share path
string . Required.
string . Required.
Specifies the files to be downloaded as a multi line minimatch pattern. Learn more
about file matching patterns .
The default pattern ( ** ) downloads all files within the artifact.
Specifies the path on the agent machine where the artifacts are downloaded.
Output variables
None.
Remarks
Use this task to download file share artifacts.
Requirements
ノ Expand table
Requirement Description
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Feedback
Was this page helpful? Yes No
Use this task to download files that were saved as artifacts of a completed build.
Syntax
# Download build artifacts v1
# Download files that were saved as artifacts of a completed build.
- task: DownloadBuildArtifacts@1
inputs:
buildType: 'current' # 'current' | 'specific'. Required. Download
artifacts produced by. Default: current.
#project: # string. Required when buildType == specific. Project.
#pipeline: # string. Alias: definition. Required when buildType ==
specific. Build pipeline.
#specificBuildWithTriggering: false # boolean. Optional. Use when
buildType == specific. When appropriate, download artifacts from the
triggering build. Default: false.
#buildVersionToDownload: 'latest' # 'latest' | 'latestFromBranch' |
'specific'. Required when buildType == specific. Build version to download.
Default: latest.
#allowPartiallySucceededBuilds: false # boolean. Optional. Use when
buildType == specific && buildVersionToDownload != specific. Download
artifacts even from partially succeeded builds. Default: false.
#branchName: 'refs/heads/master' # string. Required when buildType ==
specific && buildVersionToDownload == latestFromBranch. Branch name.
Default: refs/heads/master.
#buildId: # string. Required when buildType == specific &&
buildVersionToDownload == specific. Build.
#tags: # string. Optional. Use when buildType == specific &&
buildVersionToDownload != specific. Build Tags.
downloadType: 'single' # 'single' | 'specific'. Required. Download type.
Default: single.
artifactName: # string. Required when downloadType == single. Artifact
name.
#itemPattern: '**' # string. Matching pattern. Default: **.
downloadPath: '$(System.ArtifactsDirectory)' # string. Required.
Destination directory. Default: $(System.ArtifactsDirectory).
#cleanDestinationFolder: false # boolean. Clean destination folder.
Default: false.
# Advanced
#parallelizationLimit: '8' # string. Parallelization limit. Default: 8.
#checkDownloadedFiles: false # boolean. Check downloaded files. Default:
false.
#retryDownloadCount: '4' # string. Retry count. Default: 4.
#extractTars: # boolean. Extract all files that are stored inside tar
archives.
Inputs
buildType - Download artifacts produced by
string . Required. Allowed values: current (Current build), specific (Specific build).
Whether to download artifacts produced by the current build or from a specific build.
project - Project
triggering build.
boolean . Optional. Use when buildType == specific . Default value: false .
If true , this build task tries to download artifacts from the triggering build. If there is no
triggering build from the specified pipeline, it downloads artifacts from the build
specified in the options below.
builds.
boolean . Optional. Use when buildType == specific && buildVersionToDownload !=
If true , this build task tries to download artifacts whether the build succeeds or partially
succeeds.
buildId - Build
specific .
A comma-delimited list of tags. Only builds with these tags are returned.
string . Required. Allowed values: single (Specific artifact), specific (Specific files).
Choose single (Specific artifact) when you want only one specific artifact specified
by artifactName
Choose specific (Specific files) when you want all artifacts of the selected build
Specifies the files to download as a multi-line minimatch pattern. For more information,
see File matching patterns reference .
The default pattern \*\* downloads all files across all artifacts in the build if you choose
the Specific files option. To download all files within the artifact drop, use drop/** .
The path on the agent machine where the artifacts are downloaded.
If true , this build task checks that all files are fully downloaded.
retryDownloadCount - Retry count
string . Default value: 4 .
The number of times to retry downloading a build artifact if the download fails.
extractTars - Extract all files that are stored inside tar archives
boolean .
Set to true to extract all downloaded files that have the .tar extension. This is helpful
because you need to pack your artifact files into tar if you want to preserve Unix file
permissions. Enabling the StoreAsTar option in the Publish build artifacts task will store
artifacts as .tar files automatically.
Output variables
This task defines the following output variables, which you can consume in downstream
steps, jobs, and stages.
BuildNumber
Please note that this input returns BuildId due to backward compatibility. For more
information, see Variables.
Remarks
7 Note
The Azure Pipelines team recommends upgrading from build artifacts to Pipeline
Artifacts for faster performance.
Requirements
ノ Expand table
Requirement Description
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Feedback
Was this page helpful? Yes No
Use this task to download files that were saved as artifacts of a completed build.
7 Note
Disable IIS Basic Authentication if you are using Azure DevOps Server to allow
authentication with your Personal Access Token. See IIS Basic Authentication and
PATs for more details.
Syntax
# Download build artifacts v0
# Download files that were saved as artifacts of a completed build.
- task: DownloadBuildArtifacts@0
inputs:
buildType: 'current' # 'current' | 'specific'. Required. Download
artifacts produced by. Default: current.
#project: # string. Required when buildType == specific. Project.
#pipeline: # string. Alias: definition. Required when buildType ==
specific. Build pipeline.
#specificBuildWithTriggering: false # boolean. Optional. Use when
buildType == specific. When appropriate, download artifacts from the
triggering build. Default: false.
#buildVersionToDownload: 'latest' # 'latest' | 'latestFromBranch' |
'specific'. Required when buildType == specific. Build version to download.
Default: latest.
#allowPartiallySucceededBuilds: false # boolean. Optional. Use when
buildType == specific && buildVersionToDownload != specific. Download
artifacts even from partially succeeded builds. Default: false.
#branchName: 'refs/heads/master' # string. Required when buildType ==
specific && buildVersionToDownload == latestFromBranch. Branch name.
Default: refs/heads/master.
#buildId: # string. Required when buildType == specific &&
buildVersionToDownload == specific. Build.
#tags: # string. Optional. Use when buildType == specific &&
buildVersionToDownload != specific. Build Tags.
downloadType: 'single' # 'single' | 'specific'. Required. Download type.
Default: single.
artifactName: # string. Required when downloadType == single. Artifact
name.
#itemPattern: '**' # string. Matching pattern. Default: **.
downloadPath: '$(System.ArtifactsDirectory)' # string. Required.
Destination directory. Default: $(System.ArtifactsDirectory).
#cleanDestinationFolder: false # boolean. Clean destination folder.
Default: false.
# Advanced
#parallelizationLimit: '8' # string. Parallelization limit. Default: 8.
#checkDownloadedFiles: false # boolean. Check downloaded files. Default:
false.
#retryDownloadCount: '4' # string. Retry count. Default: 4.
#retryRedirectDownloadCount: '0' # string. Retry count for redirect
download. Default: 0.
#extractTars: # boolean. Extract all files that are stored inside tar
archives.
Inputs
buildType - Download artifacts produced by
string . Required. Allowed values: current (Current build), specific (Specific build).
Default value: current .
Whether to download artifacts produced by the current build or from a specific build.
project - Project
string . Required when buildType == specific .
The project from which you want to download the build artifacts.
triggering build.
boolean . Optional. Use when buildType == specific . Default value: false .
If true , this build task tries to download artifacts from the triggering build. If there is no
triggering build from the specified pipeline, it downloads artifacts from the build
specified in the options below.
buildVersionToDownload - Build version to download
string . Required when buildType == specific . Allowed values: latest ,
latestFromBranch (Latest from specific branch and specified Build Tags), specific
builds.
boolean . Optional. Use when buildType == specific && buildVersionToDownload !=
specific . Default value: false .
If true , this build task tries to download artifacts whether the build succeeds or partially
succeeds.
buildId - Build
string . Required when buildType == specific && buildVersionToDownload == specific .
A comma-delimited list of tags. Only builds with these tags are returned.
string . Required. Allowed values: single (Specific artifact), specific (Specific files).
Specifies the files to download as a multi-line minimatch pattern. For more information,
see File matching patterns reference .
The default pattern \*\* downloads all files across all artifacts in the build if you choose
the Specific files option. To download all the files within the artifact drop, use drop/** .
.
The path on the agent machine where the artifacts are downloaded.
Deletes all the existing files in the destination folder before the artifact is downloaded.
If true , this build task checks that all files are fully downloaded.
The number of times to retry downloading a build artifact if the download fails.
retryRedirectDownloadCount - Retry count for redirect download
Optional number of times to retry downloading a build artifact if the download based
on redirect fails. If your network does not allow following the redirect, you can set this to
-1 to always download streamed response from Azure DevOps instead.
extractTars - Extract all files that are stored inside tar archives
boolean .
Extracts all downloaded files that have a .tar extension. This is helpful because you
need to pack your artifact files into a .tar file if you want to preserve Unix file
permissions. Enabling the StoreAsTar option in the PublishBuildArtifacts task stores
artifacts as .tar files automatically.
Output variables
This task defines the following output variables, which you can consume in downstream
steps, jobs, and stages.
BuildNumber
Please note that this input returns BuildId due to backward compatibility. For more
information, see Variables.
Requirements
ノ Expand table
Requirement Description
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Feedback
Was this page helpful? Yes No
Syntax
YAML
Inputs
packageName - Package Name
string . Required.
string . Required.
Specifies the folder where packages are installed. If no folder is specified, packages are
restored into the default system working directory.
Output variables
None.
Requirements
ノ Expand table
Requirement Description
Demands Self-hosted agents must have capabilities that match the following demands
to run jobs that use this task: npm
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Command Any
restrictions
Feedback
Was this page helpful? Yes No
Use this task to restore your NuGet packages using dotnet CLI.
Syntax
YAML
Inputs
packageName - Package Name
string . Required.
string . Required.
Specifies the folder where packages are installed. If no folder is specified, packages are
restored into the default system working directory.
Output variables
None.
Requirements
ノ Expand table
Requirement Description
Runs on Agent
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Syntax
YAML
Inputs
connection - GitHub Connection
string . Required.
Specifies the GitHub service connection name. Learn more about service connections.
userRepository - Repository
string . Required.
Specifies the name of the GitHub repository that GitHub releases are downloaded from.
version - Release
The minimatch pattern that filters files to be downloaded. To download all files within a
release, use the default value ** .
The path on the agent machine where the release assets are downloaded.
Output variables
None.
Remarks
Use this task in your pipeline to download assets from your GitHub release as part of
your CI/CD pipeline.
Requirements
ノ Expand table
Requirement Description
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Feedback
Was this page helpful? Yes No
Use this task to download a package from a package management feed in Azure
Artifacts.
Syntax
YAML
# Download package v1
# Download a package from a package management feed in Azure Artifacts.
- task: DownloadPackage@1
inputs:
packageType: 'nuget' # 'maven' | 'npm' | 'nuget' | 'pypi' | 'upack' |
'cargo'. Required. Package Type. Default: nuget.
feed: # string. Required. Feed.
#view: # string. View.
definition: # string. Required. Package.
version: # string. Required. Version.
downloadPath: '$(System.ArtifactsDirectory)' # string. Required.
Destination directory. Default: $(System.ArtifactsDirectory).
# Advanced
#files: '**' # string. Optional. Use when packageType = maven ||
packageType = pypi || packageType = upack. Files. Default: **.
#extract: true # boolean. Optional. Use when packageType = nuget ||
packageType = npm. Extract package contents. Default: true.
Inputs
packageType - Package Type
string . Required. Allowed values: maven , npm , nuget , pypi (Python), upack (Universal),
feed - Feed
string . Required.
For project-scoped feeds, the format is projectID/feedID . See the following remarks to
learn how to get a feed or project ID, or learn how to use a project and feed name
instead.
view - View
string .
Specifies a view that only uses versions promoted to that specific view.
definition - Package
string . Required.
If you don't find the package in the list, you can provide the package ID, which you can
find using the instructions here .
version - Version
string . Required.
Specifies the version of the package. Use latest to download the latest version of the
package at runtime.
files - Files
string . Optional. Use when packageType = maven || packageType = pypi || packageType
true .
Extracts the package contents and contains the package archive in the artifact folder.
Specifies the path on the agent machine where the package is downloaded.
Output variables
None.
Remarks
Use this task to download a package from a package management feed in Azure
Artifacts or TFS.
7 Note
Examples
Requirements
ノ Expand table
Requirement Description
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Use this task to download a package from a package management feed in Azure
Artifacts.
Syntax
# Download package v0
# Download a package from a package management feed in Azure Artifacts.
- task: DownloadPackage@0
inputs:
feed: # string. Required. Feed.
definition: # string. Required. Package.
version: # string. Required. Version.
downloadPath: '$(System.ArtifactsDirectory)' # string. Required.
Destination directory. Default: $(System.ArtifactsDirectory).
Inputs
feed - Feed
string . Required.
definition - Package
string . Required.
Specifies the package to download. Only NuGet packages are currently supported.
version - Version
string . Required.
Specifies the path on the agent machine where the package is downloaded.
Output variables
None.
Remarks
There is a newer version of this task available at DownloadPackage@1.
Requirements
ノ Expand table
Requirement Description
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Feedback
Was this page helpful? Yes No
Use this task to download pipeline artifacts from earlier stages in this pipeline, or from
another pipeline.
7 Note
For more information, including Azure CLI commands, see downloading artifacts.
Syntax
YAML
Inputs
buildType - Download artifacts produced by
Input alias: source . string . Required. Allowed values: current (Current run), specific
(Specific run). Default value: current .
Downloads artifacts produced by the current pipeline run or from a specific pipeline run.
project - Project
Specifies the project name or GUID from which to download the pipeline artifacts.
The definition ID of the pipeline. In a running pipeline the definitionId can be found in
the System.DefinitionId variable. The definitionId can also be retrieved from the URL
on the pipeline overview page in the Azure DevOps portal. In the following URL
example, the definitionId is 78: https://dev.azure.com/fabrikam-
inc/FabrikamFiber/_build?definitionId=78&_a=summary . To download artifacts from a
specific pipeline definition, capture the definitionId from that pipeline, and specify it as
the pipeline parameter.
triggering build.
Input alias: preferTriggeringPipeline . boolean . Optional. Use when source ==
specific . Default value: false .
If checked, the task downloads artifacts from the triggering build. If there is no
triggering build from the specified pipeline, the task downloads artifacts from the build
specified in the options below.
buildVersionToDownload - Build version to download
Input alias: runVersion . string . Required when source == specific . Allowed values:
latest , latestFromBranch (Latest from specific branch and specified Build Tags),
specific (Specific version). Default value: latest .
Input alias: runBranch . string . Required when source == specific && runVersion ==
latestFromBranch . Default value: refs/heads/master .
pipelineId - Build
Input alias: runId | buildId . string . Required when source == specific && runVersion
== specific .
The identifier of the pipeline run from which to download the artifacts. In a running
pipeline the buildId can be found in the Build.BuildId variable. The buildId can also be
retrieved from the URL on the pipeline run summary page in the Azure DevOps portal.
In the following URL example, the buildId is 1088: https://dev.azure.com/fabrikam-
inc/FabrikamFiber/_build/results?buildId=1088&view=results . To download artifacts
from a specific pipeline run, capture the buildId from that run, and specify it as the
buildId parameter.
The comma-delimited list of tags that the task uses to return tagged builds. Untagged
builds are not returned.
value: false .
Specifies if the build task downloads artifacts whether the build succeeds or partially
succeeds.
allowFailedBuilds - Download artifacts from failed builds.
boolean . Optional. Use when source == specific && runVersion != specific . Default
value: false .
If checked, the build task downloads artifacts whether the build succeeds or fails.
Specifies the name of the artifact to download. If the value is left empty, the task
downloads all artifacts associated with the pipeline run.
The file matching patterns that limit downloaded files. The value can be one or more file
matching patterns that are new line delimited. Learn more about file matching patterns.
Specifies either a relative or absolute path on the agent machine where the artifacts will
download. If the multi-download option is applied (by leaving an empty artifact name),
a sub-directory will be created for each download. Learn more about Artifacts in Azure
Pipelines.
Output variables
This task defines the following output variables, which you can consume in downstream
steps, jobs, and stages.
BuildNumber
Remarks
) Important
This task is supported on Azure DevOps Services only. If you use it on Azure
DevOps Server, you'll receive an error message similar to Pipeline Artifact Task
is not supported in on-premises. Please use Build Artifact Task instead. Use
Download Build Artifacts if you're using Azure DevOps Server or TFS 2018.
Use this task to download pipeline artifacts from earlier stages in this pipeline, or from
another pipeline. By default, artifacts are downloaded to $(Pipeline.Workspace) . If you
don't specify an artifact name, a subdirectory will be created for each downloaded
artifact. You can use file matching patterns to limit the files you want to download.
The publish and download keywords are tasks shortcuts to publish and download your
pipeline artifacts.
To download artifacts from a specific pipeline definition, capture the definitionId from
that pipeline, and specify it as the pipeline parameter.
from a specific pipeline run, capture the buildId from that run, and specify it as the
buildId parameter.
Examples
Requirements
ノ Expand table
Requirement Description
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Feedback
Was this page helpful? Yes No
Provide product feedback
DownloadPipelineArtifact@1 -
Download pipeline artifact v1 task
Article • 04/29/2024
Use this task to download pipeline artifacts from earlier stages in this pipeline, or from
another pipeline.
7 Note
For more information, including Azure CLI commands, see downloading artifacts.
Syntax
# Download Pipeline Artifacts v1
# Download a named artifact from a pipeline to a local path.
- task: DownloadPipelineArtifact@1
inputs:
buildType: 'current' # 'current' | 'specific'. Required. Download
artifacts produced by. Default: current.
#project: # string. Required when buildType == specific. Project.
#pipeline: # string. Alias: definition. Required when buildType ==
specific. Build pipeline.
#specificBuildWithTriggering: false # boolean. Optional. Use when
buildType == specific. When appropriate, download artifacts from the
triggering build. Default: false.
#buildVersionToDownload: 'latest' # 'latest' | 'latestFromBranch' |
'specific'. Required when buildType == specific. Build version to download.
Default: latest.
#branchName: 'refs/heads/master' # string. Required when buildType ==
specific && buildVersionToDownload == latestFromBranch. Branch name.
Default: refs/heads/master.
#pipelineId: # string. Alias: buildId. Required when buildType ==
specific && buildVersionToDownload == specific. Build.
#tags: # string. Optional. Use when buildType == specific &&
buildVersionToDownload != specific. Build Tags.
#artifactName: # string. Artifact name.
#itemPattern: '**' # string. Matching pattern. Default: **.
targetPath: '$(System.ArtifactsDirectory)' # string. Alias:
downloadPath. Required. Destination directory. Default:
$(System.ArtifactsDirectory).
Inputs
buildType - Download artifacts produced by
string . Required. Allowed values: current (Current build), specific (Specific build).
Downloads artifacts produced by the current pipeline run or from a specific pipeline run.
project - Project
Specifies the project name or GUID from which to download the pipeline artifacts.
The definition ID of the pipeline. In a running pipeline the definitionId can be found in
the System.DefinitionId variable. The definitionId can also be retrieved from the URL
on the pipeline overview page in the Azure DevOps portal. In the following URL
example, the definitionId is 78: https://dev.azure.com/fabrikam-
inc/FabrikamFiber/_build?definitionId=78&_a=summary . To download artifacts from a
specific pipeline definition, capture the definitionId from that pipeline, and specify it as
the pipeline parameter.
triggering build.
boolean . Optional. Use when buildType == specific . Default value: false .
If checked, the task downloads artifacts from the triggering build. If there is no
triggering build from the specified pipeline, the task downloads artifacts from the build
specified in the options below.
latestFromBranch (Latest from specific branch and specified Build Tags), specific
pipelineId - Build
The identifier of the pipeline run from which to download the artifacts. In a running
pipeline the buildId can be found in the Build.BuildId variable. The buildId can also be
retrieved from the URL on the pipeline run summary page in the Azure DevOps portal.
In the following URL example, the buildId is 1088: https://dev.azure.com/fabrikam-
inc/FabrikamFiber/_build/results?buildId=1088&view=results . To download artifacts
from a specific pipeline run, capture the buildId from that run, and specify it as the
buildId parameter.
specific .
The comma-delimited list of tags that the task uses to return tagged builds. Untagged
builds are not returned.
string .
Specifies the name of the artifact to download. If the value is left empty, the task
downloads all artifacts associated with the pipeline run.
The file matching patterns that limit downloaded files. The value can be one or more file
matching patterns that are new line delimited. Learn more about file matching patterns.
targetPath - Destination directory
The path on the agent machine where the artifacts will be downloaded.
Output variables
None.
Remarks
There is a newer version of this task. For more information, see
DownloadPipelineArtifact@2.
) Important
This task is supported on Azure DevOps Services only. If you use it on Azure
DevOps Server, you'll receive an error message similar to Pipeline Artifact Task
is not supported in on-premises. Please use Build Artifact Task instead. Use
Download Build Artifacts if you're using Azure DevOps Server or TFS 2018.
To download artifacts from a specific pipeline definition, capture the definitionId from
that pipeline, and specify it as the pipeline parameter.
The identifier of the pipeline run from which to download the artifacts. In a running
pipeline the buildId can be found in the Build.BuildId variable. The buildId can also be
retrieved from the URL on the pipeline run summary page in the Azure DevOps portal.
In the following URL example, the buildId is 1088: https://dev.azure.com/fabrikam-
inc/FabrikamFiber/_build/results?buildId=1088&view=results . To download artifacts
from a specific pipeline run, capture the buildId from that run, and specify it as the
buildId parameter.
Requirements
ノ Expand table
Requirement Description
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Feedback
Was this page helpful? Yes No
Use this task to download pipeline artifacts from earlier stages in this pipeline, or from
another pipeline.
7 Note
For more information, including Azure CLI commands, see downloading artifacts.
Syntax
# Download Pipeline Artifacts v0
# Downloads an artifact associated with a pipeline.
- task: DownloadPipelineArtifact@0
inputs:
#pipelineId: # string. The specific pipeline to download from.
artifactName: 'drop' # string. Required. The name of artifact to
download. Default: drop.
targetPath: # string. Required. Path to download to.
Inputs
pipelineId - The specific pipeline to download from
string .
The build from which to download the artifacts. For example: 1764 . If missing, target the
current pipeline.
Specifies the name of the artifact to download. If the value is left empty, the task
downloads all artifacts associated with the pipeline run.
targetPath - Path to download to
string . Required.
The folder path to download the artifact to. This can be a fully-qualified path or a path
relative to the root of the repository. Wildcards are not supported. Variables are
supported. If the folder doesn't exist it will be created.
Output variables
None.
Remarks
There is a newer version of this task. For more information, see
DownloadPipelineArtifact@2.
) Important
This task is supported on Azure DevOps Services only. If you use it on Azure
DevOps Server, you'll receive an error message similar to Pipeline Artifact Task
is not supported in on-premises. Please use Build Artifact Task instead. Use
Download Build Artifacts if you're using Azure DevOps Server or TFS 2018.
Requirement Description
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Feedback
Was this page helpful? Yes No
Syntax
YAML
Inputs
secureFile - Secure File
string . Required.
Specifies the name or unique identifier (GUID) of the secure file that is downloaded to
the agent machine. The file is deleted when the pipeline job completes.
Optional. Specifies the number of times to retry downloading a secure file if the
download fails.
string .
Optional. When downloading a secure file request in Microsoft, this input specifies the
timeout for a socket.
Task control options
All tasks have control options in addition to their task inputs. For more information, see
Control options and common task properties.
Output variables
This task defines the following output variables, which you can consume in downstream
steps, jobs, and stages.
secureFilePath
Remarks
Use this task in a pipeline to download a secure file to the agent machine. When
specifying the name of the file (using the secureFile input), use the name you specified
when uploading it, rather than the actual file name.
Once downloaded, use the name value that is set on the task (or "Reference name" in the
classic editor) to reference the path to the secure file on the agent machine. For
example, if the task is given the name mySecureFile , its path can be referenced in the
pipeline as $(mySecureFile.secureFilePath) . Alternatively, downloaded secure files can
be found in the directory given by $(Agent.TempDirectory) . See a full example below.
When the pipeline job completes, whether it succeeds, fails, or is canceled, the secure
file is deleted from its download location.
It is unnecessary to use this task with the Install Apple Certificate or Install Apple
Provisioning Profile tasks because they automatically download, install, and delete (at
the end of the pipeline job) the secure file.
This task currently supports only one file task per instance.
Examples
This example downloads a secure certificate file and installs it to a trusted certificate
authority (CA) directory on Linux:
YAML
- task: DownloadSecureFile@1
name: caCertificate
displayName: 'Download CA certificate'
inputs:
secureFile: 'myCACertificate.pem'
- script: |
echo Installing $(caCertificate.secureFilePath) to the trusted CA
directory...
sudo chown root:root $(caCertificate.secureFilePath)
sudo chmod a+r $(caCertificate.secureFilePath)
sudo ln -s $(caCertificate.secureFilePath) /etc/ssl/certs/
Requirements
ノ Expand table
Requirement Description
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Command restrictions This task runs using the following command restrictions: restricted
Settable variables This task has permission to set the following variables: secureFilePath
Feedback
Was this page helpful? Yes No
Use this task to install a specified version of Duffle, which is used for installing and
managing CNAB bundles.
Syntax
# Duffle tool installer v0
# Install a specified version of Duffle for installing and managing CNAB
bundles.
- task: DuffleInstaller@0
inputs:
version: '0.1.0-ralpha.4+dramallamabuie' # string. Required. Version.
Default: 0.1.0-ralpha.4+dramallamabuie.
#checkLatestVersion: false # boolean. Check for latest version. Default:
false.
Inputs
version - Version
string . Required. Default value: 0.1.0-ralpha.4+dramallamabuie .
Always checks online for the latest available version (stable.txt) that satisfies the version
spec. Typically, the default value, false , is used unless you have a specific scenario
where the latest update is always needed. This may incur download costs when
potentially not necessary, especially with the hosted build pool.
Requirements
ノ Expand table
Requirement Description
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Feedback
Was this page helpful? Yes No
Use this task to extract a variety of archive and compression files, such as .7z, .rar, .tar.gz,
and .zip.
Syntax
YAML
# Extract files v1
# Extract a variety of archive and compression files such as .7z, .rar,
.tar.gz, and .zip.
- task: ExtractFiles@1
inputs:
archiveFilePatterns: '**/*.zip' # string. Required. Archive file
patterns. Default: **/*.zip.
destinationFolder: # string. Required. Destination folder.
#cleanDestinationFolder: true # boolean. Clean destination folder before
extracting. Default: true.
#overwriteExistingFiles: false # boolean. Overwrite existing files.
Default: false.
#pathToSevenZipTool: # string. Path to 7z utility.
Inputs
archiveFilePatterns - Archive file patterns
Specifies the file paths or patterns of the archive files to extract. Supports multiple lines
of minimatch patterns. Learn more about the Extract Files task.
Specifies the patterns to match the archives you want to extract. By default, patterns
start in the root folder of the repo (same as if you had specified
$(Build.SourcesDirectory) .
Specifies the pattern filters, one per line, that match the archives to extract. For example:
The pattern is used to match only archive file paths, not folder paths, and not
archive contents to be extracted. So, you should specify patterns, such as
**/bin/** instead of **/bin .
string . Required.
Specifies the destination folder into which archive files should be extracted. Use
variables if files are not in the repo. For example: $(agent.builddirectory) .
Specifies the option to clean the destination directory before archive contents are
extracted into it.
Specifies the option to overwrite existing files in the destination directory if they already
exist. If the option is false , the script prompts on existing files, asking whether you
want to overwrite them.
string .
Specifies the custom path to 7z utility. For example, C:\7z\7z.exe on Windows and
/usr/local/bin/7z on MacOS/Ubuntu. If it's not specified on Windows, the default 7zip
Output variables
None.
Remarks
Use this task to extract files from archives to a target folder using match patterns. A
range of standard archive formats is supported, including .zip, .jar, .war, .ear, .tar, .7z, and
more.
For more information about file matching patterns, see the File matching patterns
reference.
Examples
YAML
steps:
- task: ExtractFiles@1
inputs:
archiveFilePatterns: '**/*.zip'
cleanDestinationFolder: true
overwriteExistingFiles: false
YAML
steps:
- task: ExtractFiles@1
inputs:
archiveFilePatterns: 'test/*.zip'
cleanDestinationFolder: true
overwriteExistingFiles: false
Requirements
ノ Expand table
Requirement Description
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Command This task runs using the following command restrictions: restricted
restrictions
Settable variables This task has permission to set the following variables: Setting variables is
disabled
See also
File matching patterns reference
Feedback
Was this page helpful? Yes No
Use this task to replace tokens with variable values in XML or JSON configuration files.
Syntax
YAML
# File transform v2
# Replace tokens with variable values in XML or JSON configuration files.
- task: FileTransform@2
inputs:
folderPath: '$(System.DefaultWorkingDirectory)/**/*.zip' # string.
Required. Package or folder. Default:
$(System.DefaultWorkingDirectory)/**/*.zip.
#xmlTransformationRules: '-transform **\*.Release.config -xml
**\*.config' # string. XML Transformation rules. Default: -transform
**\*.Release.config -xml **\*.config.
# Variable Substitution
#jsonTargetFiles: # string. JSON target files.
#xmlTargetFiles: # string. XML target files.
Inputs
folderPath - Package or folder
string . Required. Default value: $(System.DefaultWorkingDirectory)/**/*.zip .
string .
Provides a newline-separated list of files to substitute the variable values. File names are
to be provided relative to the root folder.
For example, to replace the value of ConnectionString in the sample below, you need to
define a variable as Data.DefaultConnection.ConnectionString in the build or release
pipeline (or release pipeline's environment).
JSON
{
"Data": {
"DefaultConnection": {
"ConnectionString": "Server=
(localdb)\SQLEXPRESS;Database=MyDB;Trusted_Connection=True"
}
}
}
Note: Only custom variables that are defined in build/release pipelines are used in
substitution. Default/system defined pipeline variables are excluded. If the same
variables are defined in the release pipeline and in the stage, then the stage variables
will supersede the release pipeline variables.
string .
Provides a newline-separated list of files to substitute the variable values. File names are
to be provided relative to the root folder.
For XML, Variables defined in the build or release pipelines will be matched against the
key or name entries in the appSettings , applicationSettings , and connectionStrings
Output variables
None.
Remarks
What's new in File Transform version 2:
More optimized task fields that allow users to enable any/all of the transformation
(XML), variable substitution (JSON and XML) features in a single task instance.
Task fails when any of the configured transformation/substitution is NOT applied
or when the task is no-op.
Use this task to apply file transformations and variable substitutions on configuration
and parameters files. For details of how translations are processed, see File transforms
and variable substitution reference.
) Important
This task is intended for web packages and requires a web package file. It does not
work on standalone JSON files.
File transformations
At present, file transformations are supported for only XML files.
To apply an XML transformation to configuration files (*.config) you must specify a
newline-separated list of transformation file rules using the syntax: -t ransform
<path to the transform file> -xml <path to the source file> -result <path to
the result file>
File transformations are useful in many scenarios, particularly when you are
deploying to an App service and want to add, remove or modify configurations for
different environments (such as Dev, Test, or Prod) by following the standard
Web.config Transformation Syntax.
You can also use this functionality to transform other files, including Console or
Windows service application configuration files (for example,
FabrikamService.exe.config ).
Variable substitution
At present only XML and JSON file formats are supported for variable substitution.
Tokens defined in the target configuration files are updated and then replaced with
variable values.
Variable substitutions are run after config file transformations.
Variable substitution is applied for only the JSON keys predefined in the object
hierarchy. It does not create new keys.
7 Note
Only custom variables defined in build and release pipelines are used in
substitution. Default and system pipeline variables are excluded.
agent.
azure_http_user_agent
build.
common.
release.
system.
tf_
If the same variables are defined in both the release pipeline and in a stage, the
stage-defined variables supersede the pipeline-defined variables.
Examples
If you need XML transformation to run on all the configuration files named with pattern
.Production.config , the transformation rule should be specified as:
If you have a configuration file named based on the stage name in your pipeline, you
can use:
To substitute JSON variables that are nested or hierarchical, specify them using
JSONPath expressions. For example, to replace the value of ConnectionString in the
sample below, you must define a variable as Data.DefaultConnection.ConnectionString
in the build or release pipeline (or in a stage within the release pipeline).
{
"Data": {
"DefaultConnection": {
"ConnectionString": "Server=
(localdb)\SQLEXPRESS;Database=MyDB;Trusted_Connection=True"
}
}
}
Requirements
ノ Expand table
Requirement Description
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Feedback
Was this page helpful? Yes No
Use this task to replace tokens with variable values in XML or JSON configuration files.
Syntax
YAML
# File transform v1
# Replace tokens with variable values in XML or JSON configuration files.
- task: FileTransform@1
inputs:
folderPath: '$(System.DefaultWorkingDirectory)/**/*.zip' # string.
Required. Package or folder. Default:
$(System.DefaultWorkingDirectory)/**/*.zip.
#enableXmlTransform: false # boolean. XML transformation. Default:
false.
#xmlTransformationRules: '-transform **\*.Release.config -xml
**\*.config' # string. Optional. Use when enableXmlTransform == true.
Transformation rules. Default: -transform **\*.Release.config -xml
**\*.config.
# Variable Substitution
#fileType: # 'xml' | 'json'. File format.
#targetFiles: # string. Optional. Use when fileType = xml || fileType =
json. Target files.
Inputs
folderPath - Package or folder
string . Required. Default value: $(System.DefaultWorkingDirectory)/**/*.zip .
Provides a new line separated list of transformation file rules using the syntax:
For XML, variables defined in the build or release pipelines will be matched against the
key or name entries in the appSettings , applicationSettings , and connectionStrings
sections of any config file and parameters.xml . Variable Substitution is run after config
transforms.
To substitute JSON variables that are nested or hierarchical, specify them using
JSONPath expressions.
For example, to replace the value of ConnectionString in the sample below, you need to
define a variable as Data.DefaultConnection.ConnectionString in the build or release
pipeline (or release pipeline's environment).
JSON
{
"Data": {
"DefaultConnection": {
"ConnectionString": "Server=
(localdb)\SQLEXPRESS;Database=MyDB;Trusted_Connection=True"
}
}
}
Note: Only custom variables that are defined in build/release pipelines are used in
substitution. Default/system defined pipeline variables are excluded. If the same
variables are defined in the release pipeline and in the stage, then the stage variables
will supersede the release pipeline variables.
Provides a newline-separated list of files to substitute the variable values. File names are
to be provided relative to the root folder.
Output variables
None.
Remarks
There is a newer version of this task available at FileTransform@2.
Requirements
ノ Expand table
Requirement Description
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Feedback
Was this page helpful? Yes No
Use this task to upload files to a remote machine using FTP or securely with FTPS.
Syntax
YAML
# FTP upload v2
# Upload files using FTP.
- task: FtpUpload@2
inputs:
credentialsOption: 'serviceEndpoint' # 'serviceEndpoint' | 'inputs'.
Alias: credsType. Required. Authentication Method. Default: serviceEndpoint.
serverEndpoint: # string. Required when credsType = serviceEndpoint. FTP
Service Connection.
#serverUrl: # string. Required when credsType = inputs. Server URL.
#username: # string. Required when credsType = inputs. Username.
#password: # string. Required when credsType = inputs. Password.
#implicitFTPS: false # boolean. Use implicit FTPS. Default: false.
rootDirectory: # string. Alias: rootFolder. Required. Root folder.
filePatterns: '**' # string. Required. File patterns. Default: **.
remoteDirectory: '/upload/$(Build.BuildId)/' # string. Alias:
remotePath. Required. Remote directory. Default: /upload/$(Build.BuildId)/.
# Advanced
#enableUtf8: false # boolean. Enable UTF8 support. Default: false.
#clean: false # boolean. Delete remote directory. Default: false.
#cleanContents: false # boolean. Optional. Use when clean = false. Clear
remote directory contents. Default: false.
#preservePaths: false # boolean. Preserve file paths. Default: false.
#trustSSL: false # boolean. Trust server certificate. Default: false.
#customCmds: # string. FTP Commands.
Inputs
credentialsOption - Authentication Method
Input alias: credsType . string . Required. Allowed values: serviceEndpoint (FTP service
connection), inputs (Enter credentials). Default value: serviceEndpoint .
Specifies the authentication method. Use an FTP service connection or enter the
connection credentials.
serverEndpoint - FTP Service Connection
string . Required when credsType = serviceEndpoint .
Specifies the service connection for the FTP server. To create one, click the Manage link
and create a new generic service connection, and then enter the FTP server URL for the
server URL, e.g. ftp://server.example.com , and the required credentials.
Secure connections will always be made regardless of the specified protocol ( ftp:// or
ftps:// ) if the target server supports FTPS. To allow only secure connections, use the
username - Username
password - Password
Specifies the directory on the remote FTP server where the task uploads files.
Recursively deletes all content in the remote directory before uploading. The existing
directory will not be deleted. For better performance, use clean instead.
If selected, the relative local directory structure is recreated under the remote directory
where files are uploaded. Otherwise, files are uploaded directly to the remote directory
without creating additional subdirectories.
For example, suppose your source folder is /home/user/source/ , which contains the file
foo/bar/foobar.txt , and your remote directory is: /uploads/ . If this boolean is selected,
string .
The optional FTP commands that will be sent to the remote FTP server upon connection.
Output variables
None.
Remarks
Use this task to upload files to a remote machine using FTP or securely with FTPS.
Requirements
ノ Expand table
Requirement Description
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Command This task runs using the following command restrictions: restricted
Requirement Description
restrictions
Settable variables This task has permission to set the following variables: Setting variables is
disabled
See also
File matching patterns reference
Feedback
Was this page helpful? Yes No
Use this task to upload files to a remote machine using FTP or securely with FTPS.
Syntax
# FTP upload v1
# Upload files using FTP.
- task: FtpUpload@1
inputs:
credentialsOption: 'serviceEndpoint' # 'serviceEndpoint' | 'inputs'.
Alias: credsType. Required. Authentication Method. Default: serviceEndpoint.
serverEndpoint: # string. Required when credsType = serviceEndpoint. FTP
Service Connection.
#serverUrl: # string. Required when credsType = inputs. Server URL.
#username: # string. Required when credsType = inputs. Username.
#password: # string. Required when credsType = inputs. Password.
rootDirectory: # string. Alias: rootFolder. Required. Root folder.
filePatterns: '**' # string. Required. File patterns. Default: **.
remoteDirectory: '/upload/$(Build.BuildId)/' # string. Alias:
remotePath. Required. Remote directory. Default: /upload/$(Build.BuildId)/.
# Advanced
#clean: false # boolean. Delete remote directory. Default: false.
#cleanContents: false # boolean. Optional. Use when clean = false. Clear
remote directory contents. Default: false.
#overwrite: true # boolean. Overwrite. Default: true.
#preservePaths: false # boolean. Preserve file paths. Default: false.
#trustSSL: false # boolean. Trust server certificate. Default: false.
Inputs
credentialsOption - Authentication Method
Input alias: credsType . string . Required. Allowed values: serviceEndpoint (FTP service
connection), inputs (Enter credentials). Default value: serviceEndpoint .
Specifies the authentication method. Use an FTP service connection or enter the
connection credentials.
Secure connections will always be made regardless of the specified protocol ( ftp:// or
ftps:// ) if the target server supports FTPS. To allow only secure connections, use the
username - Username
string . Required when credsType = inputs .
password - Password
Specifies the file paths or patterns of the files to upload. The string supports multiple
lines of minimatch patterns. Learn more about file matching patterns.
Recursively deletes all content in the remote directory before uploading. The existing
directory will not be deleted. For better performance, use clean instead.
overwrite - Overwrite
If selected, the relative local directory structure is recreated under the remote directory
where files are uploaded. Otherwise, files are uploaded directly to the remote directory
without creating additional subdirectories.
For example, suppose your source folder is /home/user/source/ , which contains the file
foo/bar/foobar.txt , and your remote directory is: /uploads/ . If this boolean is selected,
Trusts the FTP server's SSL certificate with ftps:// , even if it is self-signed or cannot be
validated by a certificate authority (CA).
Output variables
None.
Remarks
Use this task to upload files to a remote machine using FTP or securely with FTPS.
7 Note
Requirements
ノ Expand table
Requirement Description
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Command This task runs using the following command restrictions: restricted
restrictions
Settable variables This task has permission to set the following variables: Setting variables is
disabled
Use this task to write a comment to your GitHub entity, for example an issue or a Pull
Request (PR).
Syntax
# GitHub Comment v0
# Write a comment to your GitHub entity i.e. issue or a pull request (PR).
- task: GitHubComment@0
inputs:
gitHubConnection: # string. Required. GitHub connection (OAuth or PAT).
repositoryName: '$(Build.Repository.Name)' # string. Required.
Repository. Default: $(Build.Repository.Name).
#id: # string. ID of the github pr/issue.
#comment: # string. Comment.
Inputs
gitHubConnection - GitHub connection (OAuth or PAT)
string . Required.
Specifies the name of the GitHub service connection to use to connect to the GitHub
repository. The connection must be based on a GitHub user's OAuth or a GitHub
personal access token. For more information about service connections, see Manage
service connections .
repositoryName - Repository
string . Required. Default value: $(Build.Repository.Name) .
Specifies the name of the GitHub repository where the GitHub comment will be created.
string .
Specifies the issue or PR number. If used in a PR pipeline, leave this field empty to
dynamically figure out the ID.
comment - Comment
string .
Output variables
None.
Requirements
ノ Expand table
Requirement Description
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Feedback
Was this page helpful? Yes No
Syntax
YAML
# GitHub Release v1
# Create, edit, or delete a GitHub release.
- task: GitHubRelease@1
inputs:
gitHubConnection: # string. Required. GitHub connection (OAuth or PAT).
repositoryName: '$(Build.Repository.Name)' # string. Required.
Repository. Default: $(Build.Repository.Name).
action: 'create' # 'create' | 'edit' | 'delete'. Required. Action.
Default: create.
#target: '$(Build.SourceVersion)' # string. Required when action =
create || action = edit. Target. Default: $(Build.SourceVersion).
tagSource: 'gitTag' # 'gitTag' | 'userSpecifiedTag'. Required when
action = create. Tag source. Default: gitTag.
#tagPattern: # string. Optional. Use when tagSource = gitTag. Tag
Pattern.
#tag: # string. Required when action = edit || action = delete ||
tagSource = userSpecifiedTag. Tag.
#title: # string. Optional. Use when action = create || action = edit.
Release title.
#releaseNotesSource: 'filePath' # 'filePath' | 'inline'. Optional. Use
when action = create || action = edit. Release notes source. Default:
filePath.
#releaseNotesFilePath: # string. Optional. Use when releaseNotesSource =
filePath. Release notes file path.
#releaseNotesInline: # string. Optional. Use when releaseNotesSource =
inline. Release notes.
#assets: '$(Build.ArtifactStagingDirectory)/*' # string. Optional. Use
when action = create || action = edit. Assets. Default:
$(Build.ArtifactStagingDirectory)/*.
#assetUploadMode: 'delete' # 'delete' | 'replace'. Optional. Use when
action = edit. Asset upload mode. Default: delete.
#isDraft: false # boolean. Optional. Use when action = create || action
= edit. Draft release. Default: false.
#isPreRelease: false # boolean. Optional. Use when action = create ||
action = edit. Pre-release. Default: false.
#addChangeLog: true # boolean. Optional. Use when action = create ||
action = edit. Add changelog. Default: true.
# Changelog configuration
changeLogCompareToRelease: 'lastFullRelease' # 'lastFullRelease' |
'lastNonDraftRelease' | 'lastNonDraftReleaseByTag'. Required when
addChangeLog = true. Compare to. Default: lastFullRelease.
#changeLogCompareToReleaseTag: # string. Required when
changeLogCompareToRelease = lastNonDraftReleaseByTag && addChangeLog = true.
Release Tag.
changeLogType: 'commitBased' # 'commitBased' | 'issueBased'. Required
when addChangeLog = true. Changelog type. Default: commitBased.
#changeLogLabels: '[{ "label" : "bug", "displayName" : "Bugs", "state" :
"closed" }]' # string. Optional. Use when changeLogType = issueBased &&
addChangeLog = true. Categories. Default: [{ "label" : "bug", "displayName"
: "Bugs", "state" : "closed" }].
Inputs
gitHubConnection - GitHub connection (OAuth or PAT)
string . Required.
Specifies the name of the GitHub service connection to use to connect to the GitHub
repository. The connection must be based on a GitHub user's OAuth or a GitHub
personal access token. For more information about service connections, see Manage
service connections.
repositoryName - Repository
Specifies the name of the GitHub repository where you will create, edit, or delete the
GitHub release.
action - Action
string . Required. Allowed values: create , edit , delete . Default value: create .
Specifies the type of release operation to perform. This task can create, edit, or delete a
GitHub release.
target - Target
Specifies the commit SHA you want to use to create the GitHub release, for example
48b11d8d6e92a22e3e9563a3f643699c16fd6e27 . You can also use a variable, like
string . Required when action = create . Allowed values: gitTag (Git tag),
userSpecifiedTag (User specified tag). Default value: gitTag .
Specifies the tag you want to use for release creation. The gitTag option automatically
uses the tag that is associated with the Git commit. Use the userSpecifiedTag option to
manually provide a tag.
Specifies the Git tag pattern by using regex, for example release-v1.* . A GitHub release
will be created only for commits that have matching Git tag.
tag - Tag
userSpecifiedTag .
Specifies the tag you want to use when you create, edit, or delete a release. You can also
use a variable, like $(myTagName) , in this field.
Specifies the title of the GitHub release. If left empty, the tag will be used as the release
title.
filePath (Release notes file), inline (Inline release notes). Default value: filePath .
Specifies the description of the GitHub release. Use the filePath (Release notes file)
option to use file contents as release notes. Use the inline (Inline release notes) option
to manually enter release notes
releaseNotesFilePath - Release notes file path
string . Optional. Use when releaseNotesSource = filePath .
assets - Assets
string . Optional. Use when action = create || action = edit . Default value:
$(Build.ArtifactStagingDirectory)/* .
Specifies the files you want to upload as assets of the release. You can use wildcard
characters to specify multiple files. For example, use
$(Build.ArtifactStagingDirectory)/*.zip or use
You can also specify multiple patterns, one per line. By default, all files in the
$(Build.ArtifactStagingDirectory) directory will be uploaded. For more information
about the list of pre-defined variables that are available, see build variables and
release variables .
Specifies the asset upload mode you want to use. Use the delete (Delete existing
assets) option to first delete any existing assets in the release and then upload all assets.
Use the replace (Replace existing assets) option to replace any assets that have the
same name.
boolean . Optional. Use when action = create || action = edit . Default value: false .
Indicates whether the release should be saved as a draft (unpublished). If false , the
release will be published.
isPreRelease - Pre-release
boolean . Optional. Use when action = create || action = edit . Default value: false .
boolean . Optional. Use when action = create || action = edit . Default value: true .
Specifies if you want to include a changelog. If set to true , a list of changes (commits
and issues) between the current release and the last published release will be generated
and appended to the release notes.
changeLogCompareToRelease - Compare to
string . Required when addChangeLog = true . Allowed values: lastFullRelease (Last full
lastFullRelease (Last full release): Compares the current release with the most
release with the last non-draft release matching the specified tag. You can also
specify a regex instead of an exact tag.
Specifies the regex for release tag. Release matching this tag will be used as base for
changelog computation.
changeLogLabels - Categories
Categorizes changes based on the label associated with the issue or PR. For a label, you
can mention the display name for the category and the state of issue. Examples of labels
include: "[{ "label" : "bug", "displayName" : "Bugs", "state" : "closed" }]" . In
cases where a change has multiple labels on it, the first specified label takes priority.
Leave this field empty to see a flat list of issues or PRs.
Output variables
None.
Remarks
Use this task in your pipeline to create, edit, or discard a GitHub release .
Examples
YAML
- task: GithubRelease@1
displayName: 'Create GitHub Release'
inputs:
gitHubConnection: zenithworks
repositoryName: zenithworks/javaAppWithMaven
tagSource: manual
tag: $(Build.BuildNumber)
assets: |
$(Build.ArtifactStagingDirectory)/*.exe
$(Build.ArtifactStagingDirectory)/README.txt
You can also control the creation of the release based on repository tags. The following
YAML creates a GitHub release only when the commit that triggers the pipeline has a Git
tag associated with it. The GitHub release is created with the same tag version as the
associated Git tag.
YAML
- task: GithubRelease@1
displayName: 'Create GitHub Release'
inputs:
gitHubConnection: zenithworks
repositoryName: zenithworks/javaAppWithMaven
assets: $(Build.ArtifactStagingDirectory)/*.exe
You may also want to use the task in conjunction with task conditions to get even finer
control over when the task runs, thereby restricting the creation of releases. For
example, in the following YAML the task runs only when the pipeline is triggered by a
Git tag matching the pattern 'refs/tags/release-v*'.
YAML
- task: GithubRelease@1
displayName: 'Create GitHub Release'
condition: startsWith(variables['Build.SourceBranch'], 'refs/tags/release-
v')
inputs:
gitHubConnection: zenithworks
repositoryName: zenithworks/javaAppWithMaven
assets: $(Build.ArtifactStagingDirectory)/*.exe
YAML
- task: GithubRelease@1
displayName: 'Edit GitHub Release'
inputs:
gitHubConnection: zenithworks
repositoryName: zenithworks/javaAppWithMaven
action: edit
tag: $(myDraftReleaseVersion)
isDraft: false
YAML
- task: GithubRelease@1
displayName: 'Delete GitHub Release'
inputs:
gitHubConnection: zenithworks
repositoryName: zenithworks/javaAppWithMaven
action: delete
tag: $(myDraftReleaseVersion)
YAML
- task: GitHubRelease@1
inputs:
gitHubConnection: <GITHUB_SERVICE_CONNECTION>
repositoryName: '$(Build.Repository.Name)'
action: 'create'
target: '$(Build.SourceVersion)'
tagSource: 'userSpecifiedTag'
tag: <YOUR_TAG>
title: <YOUR_TITLE>
releaseNotesSource: 'inline'
releaseNotesInline: <YOUR_RELEASE_NOTES>
Requirements
ノ Expand table
Requirement Description
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Feedback
Was this page helpful? Yes No
Syntax
# GitHub Release v0
# Create, edit, or delete a GitHub release.
- task: GitHubRelease@0
inputs:
gitHubConnection: # string. Required. GitHub connection (OAuth or PAT).
repositoryName: '$(Build.Repository.Name)' # string. Required.
Repository. Default: $(Build.Repository.Name).
action: 'create' # 'create' | 'edit' | 'delete'. Required. Action.
Default: create.
#target: '$(Build.SourceVersion)' # string. Required when action =
create || action = edit. Target. Default: $(Build.SourceVersion).
tagSource: 'auto' # 'auto' | 'manual'. Required when action = create.
Tag source. Default: auto.
#tagPattern: # string. Optional. Use when tagSource = auto. Tag Pattern.
#tag: # string. Required when action = edit || action = delete ||
tagSource = manual. Tag.
#title: # string. Optional. Use when action = create || action = edit.
Release title.
#releaseNotesSource: 'file' # 'file' | 'input'. Optional. Use when
action = create || action = edit. Release notes source. Default: file.
#releaseNotesFile: # string. Optional. Use when releaseNotesSource =
file. Release notes file path.
#releaseNotes: # string. Optional. Use when releaseNotesSource = input.
Release notes.
#assets: '$(Build.ArtifactStagingDirectory)/*' # string. Optional. Use
when action = create || action = edit. Assets. Default:
$(Build.ArtifactStagingDirectory)/*.
#assetUploadMode: 'delete' # 'delete' | 'replace'. Optional. Use when
action = edit. Asset upload mode. Default: delete.
#isDraft: false # boolean. Optional. Use when action = create || action
= edit. Draft release. Default: false.
#isPreRelease: false # boolean. Optional. Use when action = create ||
action = edit. Pre-release. Default: false.
#addChangeLog: true # boolean. Optional. Use when action = create ||
action = edit. Add changelog. Default: true.
# Changelog configuration
changeLogCompareToRelease: 'lastFullRelease' # 'lastFullRelease' |
'lastNonDraftRelease' | 'lastNonDraftReleaseByTag'. Required when
addChangeLog = true. Compare to. Default: lastFullRelease.
#changeLogCompareToReleaseTag: # string. Required when
changeLogCompareToRelease = lastNonDraftReleaseByTag && addChangeLog = true.
Release Tag.
changeLogType: 'commitBased' # 'commitBased' | 'issueBased'. Required
when addChangeLog = true. Changelog type. Default: commitBased.
#changeLogLabels: '[{ "label" : "bug", "displayName" : "Bugs", "state" :
"closed" }]' # string. Optional. Use when changeLogType = issueBased &&
addChangeLog = true. Categories. Default: [{ "label" : "bug", "displayName"
: "Bugs", "state" : "closed" }].
Inputs
gitHubConnection - GitHub connection (OAuth or PAT)
string . Required.
Specifies the name of the GitHub service connection to use to connect to the GitHub
repository. The connection must be based on a GitHub user's OAuth or a GitHub
personal access token. For more information about service connections, see Manage
service connections.
repositoryName - Repository
Specifies the name of the GitHub repository where you will create, edit, or delete the
GitHub release.
action - Action
string . Required. Allowed values: create , edit , delete . Default value: create .
Specifies the type of release operation to perform. This task can create, edit, or delete a
GitHub release.
target - Target
Specifies the commit SHA you want to use to create the GitHub release, for example
48b11d8d6e92a22e3e9563a3f643699c16fd6e27 . You can also use a variable, like
$(myCommitSHA) , in this field.
tagSource - Tag source
string . Required when action = create . Allowed values: auto (Git tag), manual (User
Specifies the tag you want to use for release creation. The auto (Git tag) option
automatically uses the tag that is associated with the Git commit. Use the manual (User
specified tag) option to manually provide a tag.
Specifies the Git tag pattern by using regex, for example release-v1.* . GitHub release
will be created only for commits that have matching Git tag.
tag - Tag
string . Required when action = edit || action = delete || tagSource = manual .
Specifies the tag you want to use when you create, edit, or delete a release. You can also
use a variable, like $(myTagName) , in this field.
Specifies the title of the GitHub release. If left empty, the tag will be used as the release
title.
(Release notes file), input (Inline release notes). Default value: file .
Specifies the description of the GitHub release. Use the file (Release notes file) option
to use file contents as release notes. Use the input (Inline release notes) option to
manually enter release notes.
assets - Assets
string . Optional. Use when action = create || action = edit . Default value:
$(Build.ArtifactStagingDirectory)/* .
Specifies the files you want to upload as assets of the release. You can use wildcard
characters to specify multiple files. For example, use
$(Build.ArtifactStagingDirectory)/*.zip for build pipelines or use
$(System.DefaultWorkingDirectory)/*.zip for release pipelines.
You can also specify multiple patterns, one per line. By default, all files in the
$(Build.ArtifactStagingDirectory) directory will be uploaded. For more information
about the list of pre-defined variables that are available, see build variables and
release variables .
Specifies the asset upload mode you want to use. Use the delete (Delete existing
assets) option to first delete any existing assets in the release and then upload all assets.
Use the replace (Replace existing assets) option to replace any assets that have the
same name.
boolean . Optional. Use when action = create || action = edit . Default value: false .
Indicates whether you want to save the release as a draft (unpublished). If false , the
release will be published.
isPreRelease - Pre-release
boolean . Optional. Use when action = create || action = edit . Default value: false .
Indicates whether you want to mark the release as a pre-release.
Specifies if you want to include a changelog. If set to true , a list of changes (commits
and issues) between the current release and the last published release will be generated
and appended to the release notes.
changeLogCompareToRelease - Compare to
string . Required when addChangeLog = true . Allowed values: lastFullRelease (Last full
lastFullRelease (Last full release): Compares the current release with the most
release with the last non-draft release matching the specified tag. You can also
specify a regex instead of an exact tag.
Specifies the regex for the release tag. A release matching this tag will be used as the
base for changelog computation.
Categorizes changes based on the label associated with the issue or PR. For a label, you
can mention the display name for the category and the state of issue. Examples of labels
include: "[{ "label" : "bug", "displayName" : "Bugs", "state" : "closed" }]" . In
cases where a change has multiple labels on it, the first specified label takes priority.
Leave this field empty to see a flat list of issues or PRs.
Output variables
None.
Remarks
There is a newer version of this task available at GitHubRelease@1.
Requirements
ノ Expand table
Requirement Description
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Feedback
Was this page helpful? Yes No
Use this task to get, build, or test a Go application, or to run a custom Go command.
Syntax
YAML
# Go v0
# Get, build, or test a Go application, or run a custom Go command.
- task: Go@0
inputs:
command: 'get' # 'get' | 'build' | 'test' | 'custom'. Required. Command.
Default: get.
#customCommand: # string. Required when command == custom. Custom
command.
#arguments: # string. Arguments.
# Advanced
#workingDirectory: # string. Working directory.
Inputs
command - Command
string . Required. Allowed values: get , build , test , custom . Default value: get .
Specifies a Go command to run. Use Custom to run a command not listed here.
arguments - Arguments
string .
The optional arguments to the selected command. For example, use build-time
arguments for the go build command.
workingDirectory - Working directory
string .
The working directory where you want the command to run. When empty, the root of
the repository (for builds) or artifacts (for releases) is used, which is the value of
$(System.DefaultWorkingDirectory) .
Output variables
None.
Remarks
Use this task to get, build, or test a Go application, or to run a custom Go command.
Examples
yml
variables:
GOBIN: '$(GOPATH)/bin' # Go binaries path
GOROOT: '/usr/local/go1.11' # Go installation path
GOPATH: '$(system.defaultWorkingDirectory)/gopath' # Go workspace path
modulePath: '$(GOPATH)/src/github.com/$(build.repository.name)' # Path to
the module's code
steps:
- task: GoTool@0
displayName: 'Use Go 1.10'
- task: Go@0
displayName: 'go get'
inputs:
arguments: '-d'
- task: Go@0
displayName: 'go build'
inputs:
command: build
arguments: '-o "$(System.TeamProject).exe"'
- task: ArchiveFiles@2
displayName: 'Archive files'
inputs:
rootFolderOrFile: '$(Build.Repository.LocalPath)'
includeRootFolder: False
- task: PublishBuildArtifacts@1
displayName: 'Publish artifact'
condition: succeededOrFailed()
Requirements
ノ Expand table
Requirement Description
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Feedback
Was this page helpful? Yes No
Use this task to find in the tools cache or download a specific version of Go and add it
to the PATH.
Syntax
# Go tool installer v0
# Find in cache or download a specific version of Go and add it to the PATH.
- task: GoTool@0
inputs:
version: '1.10' # string. Required. Version. Default: 1.10.
# Advanced
#goPath: # string. GOPATH.
#goBin: # string. GOBIN.
Inputs
version - Version
The Go version to download (if necessary) and use, for example 1.9.3 .
goPath - GOPATH
string .
goBin - GOBIN
string .
Remarks
Use this task to find or download a specific version of the Go tool into the tools cache
and add it to the PATH. Use the task to change the version of Go Lang used in
subsequent tasks.
Requirements
ノ Expand table
Requirement Description
Demands None
Capabilities Running this task satisfies the following demands for any subsequent tasks
in the same job: GO
Command Any
restrictions
Feedback
Was this page helpful? Yes No
Syntax
YAML
# Gradle v3
# Build using a Gradle wrapper script.
- task: Gradle@3
inputs:
gradleWrapperFile: 'gradlew' # string. Alias: wrapperScript. Required.
Gradle wrapper. Default: gradlew.
#workingDirectory: # string. Alias: cwd. Working directory.
#options: # string. Options.
tasks: 'build' # string. Required. Tasks. Default: build.
# JUnit Test Results
#publishJUnitResults: true # boolean. Publish to Azure Pipelines.
Default: true.
testResultsFiles: '**/TEST-*.xml' # string. Required when
publishJUnitResults = true. Test results files. Default: **/TEST-*.xml.
#testRunTitle: # string. Optional. Use when publishJUnitResults = true.
Test run title.
# Code Coverage
#codeCoverageToolOption: 'None' # 'None' | 'Cobertura' | 'JaCoCo'.
Alias: codeCoverageTool. Code coverage tool. Default: None.
codeCoverageClassFilesDirectories: 'build/classes/main/' # string.
Alias: classFilesDirectories. Required when codeCoverageTool != None. Class
files directories. Default: build/classes/main/.
#codeCoverageClassFilter: # string. Alias: classFilter. Optional. Use
when codeCoverageTool != None. Class inclusion/exclusion filters.
#codeCoverageFailIfEmpty: false # boolean. Alias: failIfCoverageEmpty.
Optional. Use when codeCoverageTool != None. Fail when code coverage results
are missing. Default: false.
#codeCoverageGradle5xOrHigher: true # boolean. Alias: gradle5xOrHigher.
Optional. Use when codeCoverageTool = JaCoCo. Gradle version >= 5.x.
Default: true.
# Advanced
javaHomeOption: 'JDKVersion' # 'JDKVersion' | 'Path'. Alias:
javaHomeSelection. Required. Set JAVA_HOME by. Default: JDKVersion.
#jdkVersionOption: 'default' # 'default' | '1.17' | '1.11' | '1.10' |
'1.9' | '1.8' | '1.7' | '1.6'. Alias: jdkVersion. Optional. Use when
javaHomeSelection = JDKVersion. JDK version. Default: default.
#jdkDirectory: # string. Alias: jdkUserInputPath. Required when
javaHomeSelection = Path. JDK path.
#jdkArchitectureOption: 'x64' # 'x86' | 'x64'. Alias: jdkArchitecture.
Optional. Use when jdkVersion != default. JDK architecture. Default: x64.
#gradleOptions: '-Xmx1024m' # string. Alias: gradleOpts. Set
GRADLE_OPTS. Default: -Xmx1024m.
# Code Analysis
#sonarQubeRunAnalysis: false # boolean. Alias: sqAnalysisEnabled. Run
SonarQube or SonarCloud Analysis. Default: false.
#sqGradlePluginVersionChoice: 'specify' # 'specify' | 'build'. Required
when sqAnalysisEnabled = true. SonarQube scanner for Gradle version.
Default: specify.
#sonarQubeGradlePluginVersion: '2.6.1' # string. Alias:
sqGradlePluginVersion. Required when sqAnalysisEnabled = true &&
sqGradlePluginVersionChoice = specify. SonarQube scanner for Gradle plugin
version. Default: 2.6.1.
#checkStyleRunAnalysis: false # boolean. Alias:
checkstyleAnalysisEnabled. Run Checkstyle. Default: false.
#findBugsRunAnalysis: false # boolean. Alias: findbugsAnalysisEnabled.
Run FindBugs. Default: false.
#pmdRunAnalysis: false # boolean. Alias: pmdAnalysisEnabled. Run PMD.
Default: false.
#spotBugsAnalysis: false # boolean. Alias: spotBugsAnalysisEnabled. Run
SpotBugs. Default: false.
#spotBugsGradlePluginVersionChoice: 'specify' # 'specify' | 'build'.
Required when spotBugsAnalysisEnabled = true. Spotbugs plugin version.
Default: specify.
#spotbugsGradlePluginVersion: '4.7.0' # string. Required when
spotBugsAnalysisEnabled = true && spotBugsGradlePluginVersionChoice =
specify. Version number. Default: 4.7.0.
Inputs
gradleWrapperFile - Gradle wrapper
Specifies the gradlew wrapper's location within the repository that will be used for the
build. Agents on Windows (including Microsoft-hosted agents) must use the
gradlew.bat wrapper. Agents on Linux or macOS can use the gradlew shell script. Learn
Specifies the working directory to run the Gradle build. The task uses the repository root
directory if the working directory is not specified.
options - Options
string .
Specifies the command line options that will be passed to the Gradle wrapper. See
Gradle Command Line for more information.
tasks - Tasks
The task(s) for Gradle to execute. A list of task names should be separated by spaces
and can be taken from gradlew tasks issued from a command prompt.
Publishes JUnit test results produced by the Gradle build to Azure Pipelines. The task
publishes each test results file matching Test Results Files as a test run in Azure
Pipelines.
The file path for test results. Wildcards can be used. For example, **/TEST-*.xml for all
XML files whose name starts with TEST- .
Provides a name for the JUnit test case results for this build.
Input alias: codeCoverageTool . string . Allowed values: None , Cobertura , JaCoCo . Default
value: None .
Specifies a code coverage tool to determine the code that is covered by the test cases
for the build.
The comma-separated list of directories containing class files and archive files (.jar, .war,
and more). Code coverage is reported for class files in these directories. Normally, the
task searches classes under build/classes/java/main (for Gradle 4+), which is the
default class directory for Gradle builds.
The comma-separated list of filters to include or exclude classes from collecting code
coverage. For example: +:com.* , +:org.* , -:my.app*.* .
Fails the build if code coverage did not produce any results to publish.
Sets JAVA_HOME by selecting a JDK version that the task discovers during builds or by
manually entering a JDK path.
This option has changed from version 1 of the Gradle task to use the SonarQube and
SonarCloud marketplace extensions. Enable this option to run SonarQube or
SonarCloud analysis after executing tasks in the Tasks field. You must also add a
Prepare Analysis Configuration task from one of the extensions to the build pipeline
before this Gradle task.
version number), build (Use plugin applied in your build.gradle). Default value: specify .
Specifies the SonarQube Gradle plugin version to use. Declare the version in the Gradle
configuration file, or specify a version with this string.
sonarQubeGradlePluginVersion - SonarQube scanner for Gradle plugin version
Runs the Checkstyle tool with the default Sun checks. Results are uploaded as build
artifacts.
Uses the FindBugs static analysis tool to look for bugs in the code. Results are uploaded
as build artifacts. In Gradle 6.0, this plugin was removed . Use the SpotBugs plugin
instead.
Uses the PMD Java static analysis tool to look for bugs in the code. The results are
uploaded as build artifacts.
Runs spotBugs when true . This plugin works with Gradle v5.6 or later. Learn more about
using the SpotBugs Gradle plugin . The plugin may work in an unexpected way or may
not work at all with an earlier Gradle version.
(Specify version number), build (Use plugin applied in your build.gradle). Default value:
specify .
Specifies the SpotBugs Gradle plugin version to use. The version can be declared in the
Gradle configuration file, or the version can be specified in this string.
Output variables
None.
Remarks
Configuration of the SonarQube analysis was moved to the SonarQube or
SonarCloud extensions in the task Prepare Analysis Configuration .
1. Create the Gradle wrapper by issuing the following command from the root
project directory where your build.gradle resides:
|-- gradle/
`-- wrapper/
`-- gradle-wrapper.jar
`-- gradle-wrapper.properties
|-- src/
|-- .gitignore
|-- build.gradle
|-- gradlew
|-- gradlew.bat
to 1 minute.
Examples
Build your Java app with Gradle
Requirements
ノ Expand table
Requirement Description
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Feedback
Was this page helpful? Yes No
Syntax
YAML
# Gradle v2
# Build using a Gradle wrapper script.
- task: Gradle@2
inputs:
gradleWrapperFile: 'gradlew' # string. Alias: wrapperScript. Required.
Gradle wrapper. Default: gradlew.
#workingDirectory: # string. Alias: cwd. Working directory.
#options: # string. Options.
tasks: 'build' # string. Required. Tasks. Default: build.
# JUnit Test Results
#publishJUnitResults: true # boolean. Publish to Azure Pipelines.
Default: true.
testResultsFiles: '**/TEST-*.xml' # string. Required when
publishJUnitResults = true. Test results files. Default: **/TEST-*.xml.
#testRunTitle: # string. Optional. Use when publishJUnitResults = true.
Test run title.
# Code Coverage
#codeCoverageToolOption: 'None' # 'None' | 'Cobertura' | 'JaCoCo'.
Alias: codeCoverageTool. Code coverage tool. Default: None.
codeCoverageClassFilesDirectories: 'build/classes/main/' # string.
Alias: classFilesDirectories. Required when codeCoverageTool != None. Class
files directories. Default: build/classes/main/.
#codeCoverageClassFilter: # string. Alias: classFilter. Optional. Use
when codeCoverageTool != None. Class inclusion/exclusion filters.
#codeCoverageFailIfEmpty: false # boolean. Alias: failIfCoverageEmpty.
Optional. Use when codeCoverageTool != None. Fail when code coverage results
are missing. Default: false.
#codeCoverageGradle5xOrHigher: true # boolean. Alias: gradle5xOrHigher.
Optional. Use when codeCoverageTool = JaCoCo. Gradle version >= 5.x.
Default: true.
# Advanced
javaHomeOption: 'JDKVersion' # 'JDKVersion' | 'Path'. Alias:
javaHomeSelection. Required. Set JAVA_HOME by. Default: JDKVersion.
#jdkVersionOption: 'default' # 'default' | '1.17' | '1.11' | '1.10' |
'1.9' | '1.8' | '1.7' | '1.6'. Alias: jdkVersion. Optional. Use when
javaHomeSelection = JDKVersion. JDK version. Default: default.
#jdkDirectory: # string. Alias: jdkUserInputPath. Required when
javaHomeSelection = Path. JDK path.
#jdkArchitectureOption: 'x64' # 'x86' | 'x64'. Alias: jdkArchitecture.
Optional. Use when jdkVersion != default. JDK architecture. Default: x64.
#gradleOptions: '-Xmx1024m' # string. Alias: gradleOpts. Set
GRADLE_OPTS. Default: -Xmx1024m.
# Code Analysis
#sonarQubeRunAnalysis: false # boolean. Alias: sqAnalysisEnabled. Run
SonarQube or SonarCloud Analysis. Default: false.
#sqGradlePluginVersionChoice: 'specify' # 'specify' | 'build'. Required
when sqAnalysisEnabled = true. SonarQube scanner for Gradle version.
Default: specify.
#sonarQubeGradlePluginVersion: '2.6.1' # string. Alias:
sqGradlePluginVersion. Required when sqAnalysisEnabled = true &&
sqGradlePluginVersionChoice = specify. SonarQube scanner for Gradle plugin
version. Default: 2.6.1.
#checkStyleRunAnalysis: false # boolean. Alias:
checkstyleAnalysisEnabled. Run Checkstyle. Default: false.
#findBugsRunAnalysis: false # boolean. Alias: findbugsAnalysisEnabled.
Run FindBugs. Default: false.
#pmdRunAnalysis: false # boolean. Alias: pmdAnalysisEnabled. Run PMD.
Default: false.
#spotBugsAnalysis: false # boolean. Alias: spotBugsAnalysisEnabled. Run
SpotBugs. Default: false.
#spotBugsGradlePluginVersionChoice: 'specify' # 'specify' | 'build'.
Required when spotBugsAnalysisEnabled = true. Spotbugs plugin version.
Default: specify.
#spotbugsGradlePluginVersion: '4.7.0' # string. Required when
spotBugsAnalysisEnabled = true && spotBugsGradlePluginVersionChoice =
specify. Version number. Default: 4.7.0.
Inputs
gradleWrapperFile - Gradle wrapper
Specifies the gradlew wrapper's location within the repository that will be used for the
build. Agents on Windows (including Microsoft-hosted agents) must use the
gradlew.bat wrapper. Agents on Linux or macOS can use the gradlew shell script. Learn
Specifies the working directory to run the Gradle build. The task uses the repository root
directory if the working directory is not specified.
options - Options
string .
Specifies the command line options that will be passed to the Gradle wrapper. See
Gradle Command Line for more information.
tasks - Tasks
The task(s) for Gradle to execute. A list of task names should be separated by spaces
and can be taken from gradlew tasks issued from a command prompt.
Publishes JUnit test results produced by the Gradle build to Azure Pipelines. The task
publishes each test results file matching Test Results Files as a test run in Azure
Pipelines.
The file path for test results. Wildcards can be used. For example, **/TEST-*.xml for all
XML files whose name starts with TEST- .
Provides a name for the JUnit test case results for this build.
Input alias: codeCoverageTool . string . Allowed values: None , Cobertura , JaCoCo . Default
value: None .
Specifies a code coverage tool to determine the code that is covered by the test cases
for the build.
The comma-separated list of directories containing class files and archive files (.jar, .war,
and more). Code coverage is reported for class files in these directories. Normally, the
task searches classes under build/classes/java/main (for Gradle 4+), which is the
default class directory for Gradle builds.
The comma-separated list of filters to include or exclude classes from collecting code
coverage. For example: +:com.* , +:org.* , -:my.app*.* .
Fails the build if code coverage did not produce any results to publish.
Sets JAVA_HOME by selecting a JDK version that the task discovers during builds or by
manually entering a JDK path.
This option has changed from version 1 of the Gradle task to use the SonarQube and
SonarCloud marketplace extensions. Enable this option to run SonarQube or
SonarCloud analysis after executing tasks in the Tasks field. You must also add a
Prepare Analysis Configuration task from one of the extensions to the build pipeline
before this Gradle task.
version number), build (Use plugin applied in your build.gradle). Default value: specify .
Specifies the SonarQube Gradle plugin version to use. Declare the version in the Gradle
configuration file, or specify a version with this string.
sonarQubeGradlePluginVersion - SonarQube scanner for Gradle plugin version
Runs the Checkstyle tool with the default Sun checks. Results are uploaded as build
artifacts.
Uses the FindBugs static analysis tool to look for bugs in the code. Results are uploaded
as build artifacts. In Gradle 6.0, this plugin was removed . Use the SpotBugs plugin
instead.
Uses the PMD Java static analysis tool to look for bugs in the code. The results are
uploaded as build artifacts.
Runs spotBugs when true . This plugin works with Gradle v5.6 or later. Learn more about
using the SpotBugs Gradle plugin . The plugin may work in an unexpected way or may
not work at all with an earlier Gradle version.
(Specify version number), build (Use plugin applied in your build.gradle). Default value:
specify .
Specifies the SpotBugs Gradle plugin version to use. The version can be declared in the
Gradle configuration file, or the version can be specified in this string.
Output variables
None.
Remarks
7 Note
1. Create the Gradle wrapper by issuing the following command from the root
project directory where your build.gradle resides:
updating. If you need to change the Gradle configuration run on the build agent,
you update the gradle-wrapper.properties .
|-- gradle/
`-- wrapper/
`-- gradle-wrapper.jar
`-- gradle-wrapper.properties
|-- src/
|-- .gitignore
|-- build.gradle
|-- gradlew
|-- gradlew.bat
to 1 minute.
Examples
Build your Java app with Gradle
Requirements
ノ Expand table
Requirement Description
Demands Self-hosted agents must have capabilities that match the following demands
to run jobs that use this task: java
Requirement Description
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Command Any
restrictions
Feedback
Was this page helpful? Yes No
Syntax
YAML
# Gradle v1
# Build using a Gradle wrapper script.
- task: Gradle@1
inputs:
gradleWrapperFile: 'gradlew' # string. Alias: wrapperScript. Required.
Gradle Wrapper. Default: gradlew.
#options: # string. Options.
tasks: 'build' # string. Required. Tasks. Default: build.
# Advanced
#workingDirectory: # string. Alias: cwd. Working Directory.
javaHomeOption: 'JDKVersion' # 'JDKVersion' | 'Path'. Alias:
javaHomeSelection. Required. Set JAVA_HOME by. Default: JDKVersion.
#jdkVersionOption: 'default' # 'default' | '1.9' | '1.8' | '1.7' |
'1.6'. Alias: jdkVersion. Optional. Use when javaHomeSelection = JDKVersion.
JDK Version. Default: default.
#jdkDirectory: # string. Alias: jdkUserInputPath. Required when
javaHomeSelection = Path. JDK Path.
#jdkArchitectureOption: 'x64' # 'x86' | 'x64'. Alias: jdkArchitecture.
Optional. Use when jdkVersion != default. JDK Architecture. Default: x64.
#gradleOptions: '-Xmx1024m' # string. Alias: gradleOpts. Set
GRADLE_OPTS. Default: -Xmx1024m.
# JUnit Test Results
#publishJUnitResults: true # boolean. Publish to TFS/Team Services.
Default: true.
testResultsFiles: '**/build/test-results/TEST-*.xml' # string. Required
when publishJUnitResults = true. Test Results Files. Default: **/build/test-
results/TEST-*.xml.
#testRunTitle: # string. Optional. Use when publishJUnitResults = true.
Test Run Title.
# Code Coverage
#codeCoverageToolOption: 'None' # 'None' | 'Cobertura' | 'JaCoCo'.
Alias: codeCoverageTool. Code Coverage Tool. Default: None.
#codeCoverageClassFilesDirectories: 'build/classes/main/' # string.
Alias: classFilesDirectories. Required when codeCoverageTool = false. Class
Files Directories. Default: build/classes/main/.
#codeCoverageClassFilter: # string. Alias: classFilter. Optional. Use
when codeCoverageTool != None. Class Inclusion/Exclusion Filters.
#codeCoverageFailIfEmpty: false # boolean. Alias: failIfCoverageEmpty.
Optional. Use when codeCoverageTool != None. Fail When Code Coverage Results
Are Missing. Default: false.
# Code Analysis
#sonarQubeRunAnalysis: false # boolean. Alias: sqAnalysisEnabled. Run
SonarQube Analysis. Default: false.
#sonarQubeServiceEndpoint: # string. Alias: sqConnectedServiceName.
Required when sqAnalysisEnabled = true. SonarQube Endpoint.
#sonarQubeProjectName: # string. Alias: sqProjectName. Required when
sqAnalysisEnabled = true. SonarQube Project Name.
#sonarQubeProjectKey: # string. Alias: sqProjectKey. Required when
sqAnalysisEnabled = true. SonarQube Project Key.
#sonarQubeProjectVersion: # string. Alias: sqProjectVersion. Required
when sqAnalysisEnabled = true. SonarQube Project Version.
#sonarQubeGradlePluginVersion: '2.0.1' # string. Alias:
sqGradlePluginVersion. Required when sqAnalysisEnabled = true. SonarQube
Gradle Plugin Version. Default: 2.0.1.
#sonarQubeSpecifyDB: false # boolean. Alias: sqDbDetailsRequired.
Optional. Use when sqAnalysisEnabled = true. The SonarQube server version is
lower than 5.2. Default: false.
#sonarQubeDBUrl: # string. Alias: sqDbUrl. Optional. Use when
sqDbDetailsRequired = true. Db Connection String.
#sonarQubeDBUsername: # string. Alias: sqDbUsername. Optional. Use when
sqDbDetailsRequired = true. Db Username.
#sonarQubeDBPassword: # string. Alias: sqDbPassword. Optional. Use when
sqDbDetailsRequired = true. Db User Password.
#sonarQubeIncludeFullReport: true # boolean. Alias:
sqAnalysisIncludeFullReport. Optional. Use when sqAnalysisEnabled = true.
Include full analysis report in the build summary (SQ 5.3+). Default: true.
#sonarQubeFailWhenQualityGateFails: # boolean. Alias:
sqAnalysisBreakBuildIfQualityGateFailed. Optional. Use when
sqAnalysisEnabled = true. Fail the build on quality gate failure (SQ 5.3+).
#checkStyleRunAnalysis: false # boolean. Alias:
checkstyleAnalysisEnabled. Run Checkstyle. Default: false.
#findBugsRunAnalysis: false # boolean. Alias: findbugsAnalysisEnabled.
Run FindBugs. Default: false.
#pmdRunAnalysis: false # boolean. Alias: pmdAnalysisEnabled. Run PMD.
Default: false.
Inputs
gradleWrapperFile - Gradle Wrapper
Specifies the gradlew wrapper's location within the repository that will be used for the
build. Agents on Windows (including Microsoft-hosted agents) must use the
gradlew.bat wrapper. Agents on Linux or macOS can use the gradlew shell script. Learn
options - Options
string .
Specifies the command line options that will be passed to the Gradle wrapper. See
Gradle Command Line for more information.
tasks - Tasks
The task(s) for Gradle to execute. A list of task names should be separated by spaces
and can be taken from gradlew tasks issued from a command prompt.
Specifies the working directory to run the Gradle build. The task uses the repository root
directory if the working directory is not specified.
Publishes JUnit test results produced by the Gradle build to Azure Pipelines. The task
publishes each test results file matching Test Results Files as a test run in Azure
Pipelines.
results/TEST-*.xml .
The file path for test results. Wildcards can be used. For example, **/TEST-*.xml for all
XML files whose name starts with TEST- .
Provides a name for the JUnit test case results for this build.
Input alias: codeCoverageTool . string . Allowed values: None , Cobertura , JaCoCo . Default
value: None .
Specifies a code coverage tool to determine the code that is covered by the test cases
for the build.
The comma-separated list of directories containing class files and archive files (.jar, .war,
and more). Code coverage is reported for class files in these directories. Normally, the
task searches classes under build/classes/java/main (for Gradle 4+), which is the
default class directory for Gradle builds.
The comma-separated list of filters to include or exclude classes from collecting code
coverage. For example: +:com.* , +:org.* , -:my.app*.* .
Fails the build if code coverage did not produce any results to publish.
Sets JAVA_HOME by selecting a JDK version that the task discovers during builds or by
manually entering a JDK path.
Runs a SonarQube analysis after executing the current goals. install or package goals
should be executed first.
SonarQube server 5.1 and lower only. Specifies the database connection details.
SonarQube server version 5.1 and lower only. Enters the database connection setting,
that is sonar.jdbc.url . For example:
jdbc:jtds:sqlserver://localhost/sonar;SelectMethod=Cursor .
sonarQubeDBUsername - Db Username
SonarQube server 5.1 and lower only. Enters the username for the database user, that is
sonar.jdbc.username .
5.3+)
Input alias: sqAnalysisIncludeFullReport . boolean . Optional. Use when
sqAnalysisEnabled = true . Default value: true .
SonarQube server version 5.3 or above only. Introduces delays as the build must wait for
SonarQube to complete the analysis. Learn more about using SonarQube for builds .
Runs the Checkstyle tool with the default Sun checks. Results are uploaded as build
artifacts.
Uses the FindBugs static analysis tool to look for bugs in the code. Results are uploaded
as build artifacts. In Gradle 6.0, this plugin was removed . Use the SpotBugs plugin
instead.
Uses the PMD Java static analysis tool to look for bugs in the code. The results are
uploaded as build artifacts.
Output variables
None.
Remarks
7 Note
1. Create the Gradle wrapper by issuing the following command from the root
project directory where your build.gradle resides:
updating. If you need to change the Gradle configuration run on the build agent,
you update the gradle-wrapper.properties .
|-- gradle/
`-- wrapper/
`-- gradle-wrapper.jar
`-- gradle-wrapper.properties
|-- src/
|-- .gitignore
|-- build.gradle
|-- gradlew
|-- gradlew.bat
to 1 minute.
Requirements
ノ Expand table
Requirement Description
Demands Self-hosted agents must have capabilities that match the following demands
to run jobs that use this task: java
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Command Any
restrictions
Feedback
Was this page helpful? Yes No
Syntax
# Grunt v0
# Run the Grunt JavaScript task runner.
- task: Grunt@0
inputs:
gruntFile: 'gruntfile.js' # string. Required. Grunt File Path. Default:
gruntfile.js.
#targets: # string. Grunt Task(s).
#arguments: # string. Arguments.
# Advanced
#workingDirectory: # string. Alias: cwd. Working Directory.
gruntCli: 'node_modules/grunt-cli/bin/grunt' # string. Required. grunt-
cli location. Default: node_modules/grunt-cli/bin/grunt.
# JUnit Test Results
#publishJUnitResults: false # boolean. Publish to Azure Pipelines.
Default: false.
#testResultsFiles: '**/TEST-*.xml' # string. Required when
publishJUnitResults = true. Test Results Files. Default: **/TEST-*.xml.
#testRunTitle: # string. Optional. Use when publishJUnitResults = true.
Test Run Title.
# Code Coverage
#enableCodeCoverage: false # boolean. Enable Code Coverage. Default:
false.
#testFramework: 'Mocha' # 'Mocha' | 'Jasmine'. Optional. Use when
enableCodeCoverage = true. Test Framework. Default: Mocha.
#srcFiles: # string. Optional. Use when enableCodeCoverage = true.
Source Files.
#testFiles: 'test/*.js' # string. Required when enableCodeCoverage =
true. Test Script Files. Default: test/*.js.
Inputs
gruntFile - Grunt File Path
string . Required. Default value: gruntfile.js .
Specifies the relative path from the repo root to the Grunt script.
targets - Grunt Task(s)
string .
Optional. Specifies the space-delimited list of tasks to run. If not specified, the default
task will run.
arguments - Arguments
string .
Specifies the additional arguments passed to Grunt. See Using the CLI for more
information.
Note: --gruntfile is not needed because it was already added via the gruntFile input
above.
Optional. Specifies the current working directory when the script is run. If not specified,
the working directory defaults to the folder where the script is located.
Specifies the grunt-cli to run when the agent can't find the globally installed grunt-cli.
Defaults to the grunt-cli under the node_modules folder of the working directory.
Select this option to publish the JUnit test results produced by the Grunt build to Azure
Pipelines/TFS.
For example, **/TEST-*.xml for all XML file names that start with TEST- .
testRunTitle - Test Run Title
Specifies the path to your source files which you want to hookRequire() .
Output variables
None.
Remarks
Use this task to run Grunt tasks using the JavaScript Task Runner.
Examples
See a Sample Gruntfile .
Requirements
ノ Expand table
Requirement Description
Demands Self-hosted agents must have capabilities that match the following demands
to run jobs that use this task: node.js
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Command Any
restrictions
Feedback
Was this page helpful? Yes No
Use this task to run the gulp Node.js streaming task-based build system.
Syntax
YAML
# gulp v1
# Run the gulp Node.js streaming task-based build system.
- task: gulp@1
inputs:
#gulpFile: 'gulpfile.js' # string. gulp File Path. Default: gulpfile.js.
#targets: # string. gulp Task(s).
#arguments: # string. Arguments.
# Advanced
#workingDirectory: # string. Alias: cwd. Working Directory.
#gulpjs: # string. gulp.js location.
# JUnit Test Results
#publishJUnitResults: false # boolean. Publish to Azure Pipelines.
Default: false.
#testResultsFiles: '**/TEST-*.xml' # string. Required when
publishJUnitResults = true. Test Results Files. Default: **/TEST-*.xml.
#testRunTitle: # string. Optional. Use when publishJUnitResults = true.
Test Run Title.
# Code Coverage
#enableCodeCoverage: false # boolean. Enable code Coverage. Default:
false.
#testFramework: 'Mocha' # 'Mocha' | 'Jasmine'. Optional. Use when
enableCodeCoverage = true. Test Framework. Default: Mocha.
#srcFiles: # string. Optional. Use when enableCodeCoverage = true.
Source Files.
#testFiles: 'test/*.js' # string. Required when enableCodeCoverage =
true. Test Script Files. Default: test/*.js.
Inputs
gulpFile - gulp File Path
string . Default value: gulpfile.js .
The relative path from the repo root of the gulp file script file you want to run.
targets - gulp Task(s)
string .
Optional space-delimited list of tasks to run. If this input isn't specified, the default task
will run.
arguments - Arguments
string .
Additional arguments passed to gulp. --gulpfile is not needed since it's already added
via gulpFile input above.
The current working directory to use when the script is run. This input defaults to the
folder where the script is located.
Publishes JUnit test results produced by the gulp build to Azure Pipelines/TFS.
Test results files path. You can use wildcards. For example, you can use **/TEST-*.xml
for all XML files whose name starts with TEST- .
Output variables
None.
Remarks
Use this task to run gulp tasks using the Node.js streaming task-based build system.
7 Note
Gulp is not preinstalled on all hosted agents. See installed software on virtual
machine images.
Examples
Run gulp.js
yml
- task: Npm@1
inputs:
command: 'install'
- task: gulp@1
inputs:
gulpFile: 'gulpfile.js'
gulpjs: 'node_modules/gulp/bin/gulp.js'
Requirements
ノ Expand table
Requirement Description
Demands Self-hosted agents must have capabilities that match the following demands
to run jobs that use this task: node.js
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Command Any
restrictions
See also
Build your Node.js app with gulp
Feedback
Was this page helpful? Yes No
Use this task to run the gulp Node.js streaming task-based build system.
Syntax
YAML
# gulp v0
# Run the gulp Node.js streaming task-based build system.
- task: gulp@0
inputs:
gulpFile: 'gulpfile.js' # string. Required. gulp File Path. Default:
gulpfile.js.
#targets: # string. gulp Task(s).
#arguments: # string. Arguments.
# Advanced
#workingDirectory: # string. Alias: cwd. Working Directory.
gulpjs: 'node_modules/gulp/bin/gulp.js' # string. Required. gulp.js
location. Default: node_modules/gulp/bin/gulp.js.
# JUnit Test Results
#publishJUnitResults: false # boolean. Publish to Azure Pipelines.
Default: false.
#testResultsFiles: '**/TEST-*.xml' # string. Required when
publishJUnitResults = true. Test Results Files. Default: **/TEST-*.xml.
#testRunTitle: # string. Optional. Use when publishJUnitResults = true.
Test Run Title.
# Code Coverage
#enableCodeCoverage: false # boolean. Enable code Coverage. Default:
false.
#testFramework: 'Mocha' # 'Mocha' | 'Jasmine'. Optional. Use when
enableCodeCoverage = true. Test Framework. Default: Mocha.
#srcFiles: # string. Optional. Use when enableCodeCoverage = true.
Source Files.
#testFiles: 'test/*.js' # string. Required when enableCodeCoverage =
true. Test Script Files. Default: test/*.js.
Inputs
gulpFile - gulp File Path
string . Required. Default value: gulpfile.js .
The relative path from the repo root of the gulp file script file you want to run.
targets - gulp Task(s)
string .
Optional space-delimited list of tasks to run. If this input isn't specified, the default task
will run.
arguments - Arguments
string .
Additional arguments passed to gulp. --gulpfile is not needed since it's already added
via gulpFile input above.
The current working directory to use when the script is run. This input defaults to the
folder where the script is located.
Runs gulp.js when the agent can't find global-installed gulp. This input defaults to the
gulp.js installed under the node_modules folder of the working directory.
Publishes JUnit test results from the gulp build to Azure Pipelines/TFS.
The test results files path. You can use wildcards. For example, you can use **/TEST-
*.xml for all XML files whose name starts with TEST- .
Provides the path to the source files that you want to hookRequire().
Output variables
None.
Remarks
7 Note
THere is a newer version of this task available at gulp@1.
Use this task to run gulp tasks using the Node.js streaming task-based build system.
7 Note
Gulp is not preinstalled on all hosted agents. See installed software on virtual
machine images.
Examples
Run gulp.js
yml
- task: Npm@1
inputs:
command: 'install'
- task: gulp@0
inputs:
gulpFile: 'gulpfile.js'
gulpjs: 'node_modules/gulp/bin/gulp.js'
Requirements
ノ Expand table
Requirement Description
Demands Self-hosted agents must have capabilities that match the following demands
to run jobs that use this task: node.js
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Requirement Description
Command Any
restrictions
Feedback
Was this page helpful? Yes No
Syntax
YAML
Inputs
helmVersionToInstall - Helm Version Spec
Specifies the version of Helm to install. Acceptable values include any semantic version
string, like 2.14.1 .
Output variables
None.
Remarks
This task can be used for installing a specific version of helm binary on agents.
Troubleshooting
The HelmInstaller task does not use the proxy settings to download the file
https://get.helm.sh/helm-v3.1.0-linux-amd64.zip . You can work around this by pre-
Examples
The following YAML example showcases the installation of latest version of helm binary
on the agent -
YAML
- task: HelmInstaller@1
displayName: Helm installer
inputs:
helmVersionToInstall: latest
The following YAML example demonstrates the use of an explicit version string rather
than installing the latest version available at the time of task execution -
YAML
- task: HelmInstaller@1
displayName: Helm installer
inputs:
helmVersionToInstall: 2.14.1
Requirements
ノ Expand table
Requirement Description
Demands None
Requirement Description
Capabilities Running this task satisfies the following demands for any subsequent tasks
in the same job: Helm
Command Any
restrictions
Feedback
Was this page helpful? Yes No
Syntax
# Helm tool installer v0
# Install Helm and Kubernetes on an agent machine.
- task: HelmInstaller@0
inputs:
helmVersion: '2.14.1' # string. Required. Helm Version Spec. Default:
2.14.1.
#checkLatestHelmVersion: true # boolean. Check for latest version of
Helm. Default: true.
# Prerequisite
#installKubeCtl: true # boolean. Install Kubectl. Default: true.
#kubectlVersion: '1.8.9' # string. Optional. Use when installKubeCtl ==
true. Kubectl Version Spec. Default: 1.8.9.
#checkLatestKubeCtl: true # boolean. Optional. Use when installKubeCtl
== true. Check for latest version of kubectl. Default: true.
Inputs
helmVersion - Helm Version Spec
string . Required. Default value: 2.14.1 .
Installs Kubectl.
kubectlVersion - Kubectl Version Spec
string . Optional. Use when installKubeCtl == true . Default value: 1.8.9 .
Output variables
None.
Remarks
There is a newer version of this task available at HelmInstaller@1.
Requirements
ノ Expand table
Requirement Description
Demands None
Capabilities Running this task satisfies the following demands for any subsequent tasks
in the same job: Helm
Command Any
restrictions
Requirement Description
Feedback
Was this page helpful? Yes No
Use this task to deploy a website or web application using Web Deploy.
Syntax
YAML
Inputs
WebSiteName - Website Name
string . Required.
string .
Specifies the name of an already existing Azure Virtual application on the target
machines.
Specifies the file path to the package or folder generated by MSBuild or a compressed
archive file. Variables ( Build | Release) and wildcards are supported. For example,
$(System.DefaultWorkingDirectory)\**\*.zip .
string .
Selects the option to delete files on the Web App that have no matching files in the Web
App zip package.
Selects the option to prevent files in the App_Data folder from being deployed to the
Web App.
Selects the option to take the Web App offline by placing an app_offline.htm file in the
root directory of the Web App before the sync operation begins. The file will be
removed after the sync operation completes successfully.
For a list of Web Deploy arguments, see Web Deploy Operation Settings.
Specifies the config transforms that are run for *.Release.config and *.
<EnvironmentName>.config on the *.config file . Config transforms are run prior to the
Specifies the variables defined in the build or release pipeline. These variables are
matched against the key or name entries in the appSettings, applicationSettings, and
connectionStrings sections of any config file and parameters.xml . Variable Substitution
is run after config transforms.
Note: If the same variables are defined in the release pipeline and in the environment,
then the environment variables will supersede the release pipeline variables.
Specifies a new line separated list of JSON files to substitute the variable values. File
names must be relative to the root folder.
To substitute JSON variables that are nested or hierarchical, specify them using
JSONPath expressions. For example, to replace the value of ConnectionString in the
sample below, you must define a variable as Data.DefaultConnection.ConnectionString
in the build or release pipeline (or in the release pipeline's stage).
{
"Data": {
"DefaultConnection": {
"ConnectionString": "Server=
(localdb)\SQLEXPRESS;Database=MyDB;Trusted_Connection=True"
}
}
}
Output variables
None.
Remarks
Use this task to deploy a website or web app using WebDeploy.
Requirements
ノ Expand table
Requirement Description
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Use this task to deploy IIS Web App using MSDeploy, then create or update websites
and app pools.
) Important
This task is deprecated and will be retired January 31, 2024. Use IIS Web App
Deployment Using WinRM - Viual Studio Marketplace .
Syntax
# IIS Web App deployment (Deprecated) v1
# Deploy using MSDeploy, then create/update websites and app pools.
- task: IISWebAppDeployment@1
inputs:
EnvironmentName: # string. Required. Machines.
#AdminUserName: # string. Admin Login.
#AdminPassword: # string. Password.
#WinRMProtocol: # 'Http' | 'Https'. Protocol.
#TestCertificate: true # boolean. Optional. Use when WinRMProtocol =
Https. Test Certificate. Default: true.
# Deployment
WebDeployPackage: # string. Required. Web Deploy Package.
#WebDeployParamFile: # string. Web Deploy Parameter File.
#OverRideParams: # string. Override Parameters.
# Website
#CreateWebSite: false # boolean. Create or Update Website. Default:
false.
#WebSiteName: # string. Required when CreateWebSite = true. Website
Name.
#WebSitePhysicalPath: '%SystemDrive%\inetpub\wwwroot' # string. Required
when CreateWebSite = true. Physical Path. Default:
%SystemDrive%\inetpub\wwwroot.
#WebSitePhysicalPathAuth: 'Application User (Pass-through)' #
'WebSiteUserPassThrough' | 'WebSiteWindowsAuth'. Required when CreateWebSite
= true. Physical Path Authentication. Default: Application User (Pass-
through).
#WebSiteAuthUserName: # string. Required when WebSitePhysicalPathAuth =
WebSiteWindowsAuth. User Name.
#WebSiteAuthUserPassword: # string. Optional. Use when
WebSitePhysicalPathAuth = WebSiteWindowsAuth. Password.
#AddBinding: true # boolean. Optional. Use when CreateWebSite = true.
Add Binding. Default: true.
#AssignDuplicateBinding: false # boolean. Optional. Use when AddBinding
= true. Assign Duplicate Binding. Default: false.
Protocol: 'http' # 'https' | 'http'. Required when AddBinding = true.
Protocol. Default: http.
IPAddress: 'All Unassigned' # string. Required when AddBinding = true.
IP Address. Default: All Unassigned.
Port: '80' # string. Required when AddBinding = true. Port. Default: 80.
#ServerNameIndication: false # boolean. Optional. Use when Protocol =
https. Server Name Indication Required. Default: false.
#HostNameWithOutSNI: # string. Optional. Use when ServerNameIndication =
false. Host Name.
#HostNameWithHttp: # string. Optional. Use when Protocol = http. Host
Name.
#HostNameWithSNI: # string. Required when ServerNameIndication = true.
Host Name.
#SSLCertThumbPrint: # string. Required when Protocol = https. SSL
Certificate Thumb Print.
# Application Pool
#CreateAppPool: false # boolean. Create or Update Application Pool.
Default: false.
#AppPoolName: # string. Required when CreateAppPool = true. Name.
#DotNetVersion: 'v4.0' # 'v4.0' | 'v2.0' | 'No Managed Code'. Required
when CreateAppPool = true. .NET Version. Default: v4.0.
#PipeLineMode: 'Integrated' # 'Integrated' | 'Classic'. Required when
CreateAppPool = true. Managed Pipeline Mode. Default: Integrated.
#AppPoolIdentity: 'ApplicationPoolIdentity' # 'ApplicationPoolIdentity'
| 'LocalService' | 'LocalSystem' | 'NetworkService' | 'SpecificUser'.
Required when CreateAppPool = true. Identity. Default:
ApplicationPoolIdentity.
#AppPoolUsername: # string. Required when AppPoolIdentity =
SpecificUser. Username.
#AppPoolPassword: # string. Optional. Use when AppPoolIdentity =
SpecificUser. Password.
# Advanced
#AppCmdCommands: # string. Additional AppCmd.exe Commands.
#DeployInParallel: true # boolean. Deploy in Parallel. Default: true.
#ResourceFilteringMethod: 'machineNames' # 'machineNames' | 'tags'.
Select Machines By. Default: machineNames.
#MachineFilter: # string. Deploy to Machines.
Inputs
EnvironmentName - Machines
string . Required.
string .
AdminPassword - Password
string .
Specifies the administrator password for the target machines. It can accept variables
defined in build/release definitions, such as $(passwordVariable) . You may mark the
variable type as secret to secure it.
WinRMProtocol - Protocol
Specifies the protocol used for the WinRM connection with the machine(s). The default
is HTTPS .
Selects the option to skip validating the authenticity of the machine's certificate by a
trusted certification authority. The parameter is required for the WinRM HTTPS protocol.
string . Required.
Specifies the location of the Web Deploy (MSDeploy) zip file on the target machines or
on a UNC path like, \\BudgetIT\WebDeploy\WebDeployPackage.zip . The UNC path should
be accessible to the machine's administrator account. Environment variables are also
supported, like $env:windir , $env:systemroot , and $env:windir\FabrikamFibre\Web .
string .
Specifies the location of the parameter file on the target machines or on a UNC path.
The parameter file is used to override Web application configuration settings, like the IIS
Web application name or database connection string.
Parameters specified here will override the parameters in the MSDeploy zip file and the
parameter file. To override more than one parameter, use a line separator.
For example, "IIS Web Application Name"="Fabrikam" or
"ConnectionString"="Server=localhost;Database=Fabrikam;" .
Specifies the name of the IIS website that will be created if it does not exist, or it will be
updated if it is already present on the IIS server. The name of the website should be the
same as that specified in the web deploy zip package file. If a parameter file and
override parameters setting is also specified, then the name of the website should be
the same as that in the override parameters setting.
Specifies the physical path where the website content is stored. The content can reside
on the local computer or on a remote directory or share, like C:\Fabrikam or
\\ContentShare\Fabrikam .
Specifies the authentication mechanism for accessing the physical path of the website.
WebSiteAuthUserName - User Name
Specifies the user name for accessing the website's physical path.
WebSiteAuthUserPassword - Password
string . Optional. Use when WebSitePhysicalPathAuth = WebSiteWindowsAuth .
Specifies the password for accessing the website's physical path. If you are using a
gMSA, this is not required.
Specifies the option to add the bindings specified here (even if there is another website
with the same bindings). If there are binding conflicts, only one of the websites will start.
Protocol - Protocol
string . Required when AddBinding = true . Allowed values: https , http . Default value:
http .
Specifies either HTTP for the website to have an HTTP binding or HTTPS for the website
to have a Secure Sockets Layer (SSL) binding.
IPAddress - IP Address
Specifies an IP address that users can use to access the website. If All Unassigned is
selected, the site will respond to requests for all IP addresses on the port and the
optional host name that is specified for the site. The site will not respond to requests if
another site on the server has a binding on the same port but with a specific IP address.
Port - Port
string . Required when AddBinding = true . Default value: 80 .
Specifies the port on which Hypertext Transfer Protocol Stack (HTTP.sys) must monitor
for requests made to this website.
Determines whether the website requires Server Name Indication (SNI). SNI extends the
SSL and TLS protocols to indicate what host name the client is attempting to connect to.
It allows multiple secure websites with different certificates to use the same IP address.
Assigns one or more host names (or domain names) to a computer that uses a single IP
address. If a host name is specified then the clients must use the host name instead of
the IP address to access the website.
Assigns one or more host names (or domain names) to a computer that uses a single IP
address. If a host name is specified then the clients must use the host name instead of
the IP address to access the website.
Assigns one or more host names (or domain names) to a computer that uses a single IP
address. If a host name is specified then the clients must use the host name instead of
the IP address to access the website.
Specifies the thumb-print of the Secure Socket Layer certificate that the website is going
to use. The certificate should already be installed on the machine and present under the
Local Computer Personal store.
AppPoolName - Name
string . Required when CreateAppPool = true .
Specifies the name of the IIS application pool to create or update. The existing
application pool will be updated with the settings specified.
Specifies the version of the .NET Framework that is loaded by this application pool. If the
applications assigned to this application pool do not contain managed code, select the
No Managed Code option from the list.
Managed pipeline mode specifies how IIS processes requests for managed content. Use
classic mode only when the applications in the application pool cannot run in integrated
mode.
AppPoolIdentity - Identity
Configures the account under which an application pool's worker process runs. Specify
one of the predefined security accounts, or configure a custom account.
AppPoolUsername - Username
string . Required when AppPoolIdentity = SpecificUser .
AppPoolPassword - Password
If set to true , the Web application is deployed in-parallel on the target machines.
This input is only valid for machine groups and is not supported for a flat list of
machines or output variables yet.
will run in all of the machines with the specified tags. For Azure Resource Groups,
specify the virtual machine's name, like ffweb, ffdb . The default runs the task in all
machines.
Output variables
None.
Remarks
) Important
This task is deprecated. Use IIS Web App Deployment Using WinRM - Viual Studio
Marketplace .
Requirements
ノ Expand table
Requirement Description
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Use this task to create or update websites, web apps, virtual directories, or application
pools.
Syntax
# IIS web app manage v0
# Create or update websites, web apps, virtual directories, or application
pools.
- task: IISWebAppManagementOnMachineGroup@0
inputs:
#EnableIIS: false # boolean. Enable IIS. Default: false.
IISDeploymentType: 'IISWebsite' # 'IISWebsite' | 'IISWebApplication' |
'IISVirtualDirectory' | 'IISApplicationPool'. Required. Configuration type.
Default: IISWebsite.
ActionIISWebsite: 'CreateOrUpdateWebsite' # 'CreateOrUpdateWebsite' |
'StartWebsite' | 'StopWebsite'. Required when IISDeploymentType =
IISWebsite. Action. Default: CreateOrUpdateWebsite.
#ActionIISApplicationPool: 'CreateOrUpdateAppPool' #
'CreateOrUpdateAppPool' | 'StartAppPool' | 'StopAppPool' | 'RecycleAppPool'.
Required when IISDeploymentType = IISApplicationPool. Action. Default:
CreateOrUpdateAppPool.
#StartStopWebsiteName: # string. Required when ActionIISWebsite =
StartWebsite || ActionIISWebsite = StopWebsite. Website name.
#Protocol: 'http' # 'https' | 'http'. Required when IISDeploymentType =
randomDeployment. Protocol. Default: http.
#IPAddress: 'All Unassigned' # string. Required when IISDeploymentType =
randomDeployment. IP address. Default: All Unassigned.
#Port: '80' # string. Required when IISDeploymentType =
randomDeployment. Port. Default: 80.
#ServerNameIndication: false # boolean. Optional. Use when
IISDeploymentType = randomDeployment. Server Name Indication required.
Default: false.
#HostNameWithOutSNI: # string. Optional. Use when IISDeploymentType =
randomDeployment. Host name.
#HostNameWithHttp: # string. Optional. Use when IISDeploymentType =
randomDeployment. Host name.
#HostNameWithSNI: # string. Required when IISDeploymentType =
randomDeployment. Host name.
#SSLCertThumbPrint: # string. Required when IISDeploymentType =
randomDeployment. SSL certificate thumbprint.
#StartStopRecycleAppPoolName: # string. Required when
ActionIISApplicationPool = StartAppPool || ActionIISApplicationPool =
StopAppPool || ActionIISApplicationPool = RecycleAppPool. Application pool
name.
# IIS Website
WebsiteName: # string. Required when ActionIISWebsite =
CreateOrUpdateWebsite. Website name.
WebsitePhysicalPath: '%SystemDrive%\inetpub\wwwroot' # string. Required
when ActionIISWebsite = CreateOrUpdateWebsite. Physical path. Default:
%SystemDrive%\inetpub\wwwroot.
WebsitePhysicalPathAuth: 'WebsiteUserPassThrough' #
'WebsiteUserPassThrough' | 'WebsiteWindowsAuth'. Required when
ActionIISWebsite = CreateOrUpdateWebsite. Physical path authentication.
Default: WebsiteUserPassThrough.
#WebsiteAuthUserName: # string. Required when WebsitePhysicalPathAuth =
WebsiteWindowsAuth && ActionIISWebsite = CreateOrUpdateWebsite. Username.
#WebsiteAuthUserPassword: # string. Optional. Use when
WebsitePhysicalPathAuth = WebsiteWindowsAuth && ActionIISWebsite =
CreateOrUpdateWebsite. Password.
#AddBinding: false # boolean. Optional. Use when ActionIISWebsite =
CreateOrUpdateWebsite. Add binding. Default: false.
#CreateOrUpdateAppPoolForWebsite: false # boolean. Optional. Use when
ActionIISWebsite = CreateOrUpdateWebsite. Create or update app pool.
Default: false.
#ConfigureAuthenticationForWebsite: false # boolean. Optional. Use when
ActionIISWebsite = CreateOrUpdateWebsite. Configure authentication. Default:
false.
# IIS Bindings
#Bindings: # string. Required when IISDeploymentType = IISWebsite &&
ActionIISWebsite = CreateOrUpdateWebsite && AddBinding = true. Add bindings.
# IIS Application pool
#AppPoolNameForWebsite: # string. Required when IISDeploymentType =
IISWebsite && ActionIISWebsite = CreateOrUpdateWebsite &&
CreateOrUpdateAppPoolForWebsite = true. Name.
#DotNetVersionForWebsite: 'v4.0' # 'v4.0' | 'v2.0' | 'No Managed Code'.
Required when IISDeploymentType = IISWebsite && ActionIISWebsite =
CreateOrUpdateWebsite && CreateOrUpdateAppPoolForWebsite = true. .NET
version. Default: v4.0.
#PipeLineModeForWebsite: 'Integrated' # 'Integrated' | 'Classic'.
Required when IISDeploymentType = IISWebsite && ActionIISWebsite =
CreateOrUpdateWebsite && CreateOrUpdateAppPoolForWebsite = true. Managed
pipeline mode. Default: Integrated.
#AppPoolIdentityForWebsite: 'ApplicationPoolIdentity' #
'ApplicationPoolIdentity' | 'LocalService' | 'LocalSystem' |
'NetworkService' | 'SpecificUser'. Required when IISDeploymentType =
IISWebsite && ActionIISWebsite = CreateOrUpdateWebsite &&
CreateOrUpdateAppPoolForWebsite = true. Identity. Default:
ApplicationPoolIdentity.
#AppPoolUsernameForWebsite: # string. Required when
AppPoolIdentityForWebsite = SpecificUser && IISDeploymentType = IISWebsite
&& ActionIISWebsite = CreateOrUpdateWebsite &&
CreateOrUpdateAppPoolForWebsite = true. Username.
#AppPoolPasswordForWebsite: # string. Optional. Use when
AppPoolIdentityForWebsite = SpecificUser && IISDeploymentType = IISWebsite
&& ActionIISWebsite = CreateOrUpdateWebsite &&
CreateOrUpdateAppPoolForWebsite = true. Password.
# IIS Authentication
#AnonymousAuthenticationForWebsite: false # boolean. Optional. Use when
IISDeploymentType = IISWebsite && ActionIISWebsite = CreateOrUpdateWebsite
&& ConfigureAuthenticationForWebsite = true. Anonymous authentication.
Default: false.
#BasicAuthenticationForWebsite: false # boolean. Optional. Use when
IISDeploymentType = IISWebsite && ActionIISWebsite = CreateOrUpdateWebsite
&& ConfigureAuthenticationForWebsite = true. Basic authentication. Default:
false.
#WindowsAuthenticationForWebsite: true # boolean. Optional. Use when
IISDeploymentType = IISWebsite && ActionIISWebsite = CreateOrUpdateWebsite
&& ConfigureAuthenticationForWebsite = true. Windows authentication.
Default: true.
# IIS Virtual directory
#ParentWebsiteNameForVD: # string. Required when IISDeploymentType =
IISVirtualDirectory. Parent website name.
#VirtualPathForVD: # string. Required when IISDeploymentType =
IISVirtualDirectory. Virtual path.
#PhysicalPathForVD: '%SystemDrive%\inetpub\wwwroot' # string. Required
when IISDeploymentType = IISVirtualDirectory. Physical path. Default:
%SystemDrive%\inetpub\wwwroot.
#VDPhysicalPathAuth: 'VDUserPassThrough' # 'VDUserPassThrough' |
'VDWindowsAuth'. Optional. Use when IISDeploymentType = IISVirtualDirectory.
Physical path authentication. Default: VDUserPassThrough.
#VDAuthUserName: # string. Required when VDPhysicalPathAuth =
VDWindowsAuth && IISDeploymentType = IISVirtualDirectory. Username.
#VDAuthUserPassword: # string. Optional. Use when VDPhysicalPathAuth =
VDWindowsAuth && IISDeploymentType = IISVirtualDirectory. Password.
# IIS Application
#ParentWebsiteNameForApplication: # string. Required when
IISDeploymentType = IISWebApplication. Parent website name.
#VirtualPathForApplication: # string. Required when IISDeploymentType =
IISWebApplication. Virtual path.
#PhysicalPathForApplication: '%SystemDrive%\inetpub\wwwroot' # string.
Required when IISDeploymentType = IISWebApplication. Physical path. Default:
%SystemDrive%\inetpub\wwwroot.
#ApplicationPhysicalPathAuth: 'ApplicationUserPassThrough' #
'ApplicationUserPassThrough' | 'ApplicationWindowsAuth'. Optional. Use when
IISDeploymentType = IISWebApplication. Physical path authentication.
Default: ApplicationUserPassThrough.
#ApplicationAuthUserName: # string. Required when
ApplicationPhysicalPathAuth = ApplicationWindowsAuth && IISDeploymentType =
IISWebApplication. Username.
#ApplicationAuthUserPassword: # string. Optional. Use when
ApplicationPhysicalPathAuth = ApplicationWindowsAuth && IISDeploymentType =
IISWebApplication. Password.
#CreateOrUpdateAppPoolForApplication: false # boolean. Optional. Use
when IISDeploymentType = IISWebApplication. Create or update app pool.
Default: false.
# IIS Application pool
#AppPoolNameForApplication: # string. Required when IISDeploymentType =
IISWebApplication && CreateOrUpdateAppPoolForApplication = true. Name.
#DotNetVersionForApplication: 'v4.0' # 'v4.0' | 'v2.0' | 'No Managed
Code'. Required when IISDeploymentType = IISWebApplication &&
CreateOrUpdateAppPoolForApplication = true. .NET version. Default: v4.0.
#PipeLineModeForApplication: 'Integrated' # 'Integrated' | 'Classic'.
Required when IISDeploymentType = IISWebApplication &&
CreateOrUpdateAppPoolForApplication = true. Managed pipeline mode. Default:
Integrated.
#AppPoolIdentityForApplication: 'ApplicationPoolIdentity' #
'ApplicationPoolIdentity' | 'LocalService' | 'LocalSystem' |
'NetworkService' | 'SpecificUser'. Required when IISDeploymentType =
IISWebApplication && CreateOrUpdateAppPoolForApplication = true. Identity.
Default: ApplicationPoolIdentity.
#AppPoolUsernameForApplication: # string. Required when
AppPoolIdentityForApplication = SpecificUser && IISDeploymentType =
IISWebApplication && CreateOrUpdateAppPoolForApplication = true. Username.
#AppPoolPasswordForApplication: # string. Optional. Use when
AppPoolIdentityForApplication = SpecificUser && IISDeploymentType =
IISWebApplication && CreateOrUpdateAppPoolForApplication = true. Password.
# IIS Application pool
AppPoolName: # string. Required when ActionIISApplicationPool =
CreateOrUpdateAppPool. Name.
DotNetVersion: 'v4.0' # 'v4.0' | 'v2.0' | 'No Managed Code'. Required
when ActionIISApplicationPool = CreateOrUpdateAppPool. .NET version.
Default: v4.0.
PipeLineMode: 'Integrated' # 'Integrated' | 'Classic'. Required when
ActionIISApplicationPool = CreateOrUpdateAppPool. Managed pipeline mode.
Default: Integrated.
AppPoolIdentity: 'ApplicationPoolIdentity' # 'ApplicationPoolIdentity' |
'LocalService' | 'LocalSystem' | 'NetworkService' | 'SpecificUser'. Required
when ActionIISApplicationPool = CreateOrUpdateAppPool. Identity. Default:
ApplicationPoolIdentity.
#AppPoolUsername: # string. Required when AppPoolIdentity = SpecificUser
&& ActionIISApplicationPool = CreateOrUpdateAppPool. Username.
#AppPoolPassword: # string. Optional. Use when AppPoolIdentity =
SpecificUser && ActionIISApplicationPool = CreateOrUpdateAppPool. Password.
# Advanced
#AppCmdCommands: # string. Additional appcmd.exe commands.
Inputs
EnableIIS - Enable IIS
boolean . Default value: false .
string . Required. Allowed values: IISWebsite (IIS Website), IISWebApplication (IIS Web
Specifies the appropriate action that you want to perform on an IIS website.
ActionIISApplicationPool - Action
Specifies the appropriate action that you want to perform on an IIS application pool.
Create Or Update will create an application pool or update an existing application pool.
Start, Stop, Recycle will start, stop or recycle the application pool respectively.
%SystemDrive%\inetpub\wwwroot .
Specifies the physical path where the website content will be stored. The content can
reside on the local computer, in a remote directory, or on a network share, like
C:\Fabrikam or \\ContentShare\Fabrikam .
WebsitePhysicalPathAuth - Physical path authentication
Specifies the authentication mechanism that will be used to access the physical path of
the website.
WebsiteAuthUserName - Username
ActionIISWebsite = CreateOrUpdateWebsite .
Specifies the user name that will be used to access the website's physical path.
WebsiteAuthUserPassword - Password
ActionIISWebsite = CreateOrUpdateWebsite .
Specifies the user's password that will be used to access the website's physical path.
The best practice is to create a variable in the build or release pipeline, mark it as Secret
to secure it, and then provide it when using this input, like $(userCredentials) .
Note: Special characters in the password are interpreted per command-line arguments.
Protocol - Protocol
Specifies either HTTP for the website to have an HTTP binding or HTTPS for the website
to have a Secure Sockets Layer (SSL) binding.
IPAddress - IP address
string . Required when IISDeploymentType = randomDeployment . Default value: All
Unassigned .
Port - Port
Specifies the port where the Hypertext Transfer Protocol Stack (HTTP.sys) will monitor
the website requests.
Specifies the option to set the Server Name Indication (SNI) for the website.
SNI extends the SSL and TLS protocols to indicate the host name that the clients are
attempting to connect to. It allows multiple secure websites with different certificates to
use the same IP address.
Specifies the thumb-print of the Secure Socket Layer certificate that the website uses for
the HTTPS communication. The thumb-print is a 40 character long hexadecimal string.
The SSL certificate should already be installed on the computer in the Local Computer
Personal store.
Click on the extension button ... to add bindings for the website.
false .
Specifies the option to create or update an application pool. If checked, the website will
be created in the specified application pool.
false .
AppPoolNameForWebsite - Name
string . Required when IISDeploymentType = IISWebsite && ActionIISWebsite =
Specifies the version of the .NET Framework that is loaded by the application pool. If the
applications assigned to this application pool do not contain managed code, select the
No Managed Code option from the list.
Specifies the managed pipeline mode to determine how IIS processes requests for
managed content. Use classic mode only when the applications in the application pool
cannot run in integrated mode.
AppPoolIdentityForWebsite - Identity
Configures the account under which an application pool's worker process runs. Specifies
one of the predefined security accounts or configures a custom account.
AppPoolUsernameForWebsite - Username
string . Required when AppPoolIdentityForWebsite = SpecificUser &&
Specifies the username of the custom account that you want to use.
AppPoolPasswordForWebsite - Password
string . Optional. Use when AppPoolIdentityForWebsite = SpecificUser &&
false .
true .
Specifies the physical path where the virtual directory's content is stored. The content
can reside on the local computer, in a remote directory, or on a network share, like
C:\Fabrikam or \\ContentShare\Fabrikam .
Specifies the authentication mechanism that is used to access the physical path of the
virtual directory.
VDAuthUserName - Username
IISVirtualDirectory .
Specifies the user name that is used to access the virtual directory's physical path.
VDAuthUserPassword - Password
Specifies the user's password that is used to access the virtual directory's physical path.
The best practice is to create a variable in the build or release pipeline, mark it as Secret
to secure it, and then provide it when using this input, like $(userCredentials) .
Note: Special characters in the password are interpreted per command-line arguments.
Specifies the physical path where the application's content is stored. The content can
reside on the local computer, in a remote directory, or on a network share, like
C:\Fabrikam or \\ContentShare\Fabrikam .
Specifies the authentication mechanism that is used to access the physical path of the
application.
ApplicationAuthUserName - Username
Specifies the user name that is used to access the application's physical path.
ApplicationAuthUserPassword - Password
false .
Specifies the option to create or update an application pool. If checked, the application
will be created in the specified application pool.
AppPoolNameForApplication - Name
Specifies the version of the .NET Framework that is loaded by the application pool. If the
applications assigned to this application pool do not contain managed code, select the
No Managed Code option from the list.
Specifies the managed pipeline mode to determine how IIS processes requests for
managed content. Use classic mode only when the applications in the application pool
cannot run in the integrated mode.
AppPoolIdentityForApplication - Identity
string . Required when IISDeploymentType = IISWebApplication &&
ApplicationPoolIdentity .
Configures the account under which an application pool's worker process runs. Specifies
one of the predefined security accounts or configures a custom account.
AppPoolUsernameForApplication - Username
true .
Specifies the username of the custom account that you want to use.
AppPoolPasswordForApplication - Password
string . Optional. Use when AppPoolIdentityForApplication = SpecificUser &&
AppPoolName - Name
string . Required when ActionIISApplicationPool = CreateOrUpdateAppPool .
Specifies the version of the .NET Framework that is loaded by the application pool. If the
applications assigned to this application pool do not contain managed code, select the
No Managed Code option from the list.
Specifies the managed pipeline mode to determine how IIS processes requests for
managed content. Use classic mode only when the applications in the application pool
cannot run in the integrated mode.
AppPoolIdentity - Identity
Configures the account under which an application pool's worker process runs. Specifies
one of the predefined security accounts or configures a custom account.
AppPoolUsername - Username
string . Required when AppPoolIdentity = SpecificUser && ActionIISApplicationPool =
CreateOrUpdateAppPool .
Specifies the username of the custom account that you want to use.
AppPoolPassword - Password
string . Optional. Use when AppPoolIdentity = SpecificUser &&
ActionIISApplicationPool = CreateOrUpdateAppPool .
string .
Specifies additional AppCmd.exe commands. For more than one command, use a line
separator.
For example:
list apppools
list sites
recycle apppool /apppool.name:ExampleAppPoolName
Output variables
None.
Remarks
Use this task to create or update a website, web app, virtual directory, or application
pool.
Requirements
ノ Expand table
Requirement Description
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Feedback
Was this page helpful? Yes No
Use this task to index your source code and publish your symbols to a file share or
Azure Artifacts symbol server.
Indexing your source code allows you to use your symbol files to debug your
application on a machine other than the one you used to build your application. For
example, you can debug an application built by a build agent from a dev machine that
does not have the source code.
Symbol servers enable your debugger to automatically retrieve the correct symbol files
without knowing product names, build numbers, or package names.
Syntax
YAML
Inputs
SymbolsFolder - Path to symbols folder
Specifies the path to the folder that is searched for with symbol files. The default is
$(Build.SourcesDirectory) . Otherwise, specify a rooted path, such as
$(Build.BinariesDirectory)/MyProject .
7 Note
UNC paths aren't supported if you select the Azure Artifacts symbol server as the
server type.
Specifies the pattern used to discover the PDB files to publish. See File matching
patterns reference for more information.
Specifies whether to inject source server information into the PDB files. This option is
only supported on Windows agents.
Specifies where to publish symbols. Symbols published to the Azure Artifacts symbol
server are accessible by any user with access to the organization/collection. Azure
DevOps Server only supports the File share option. See instructions to Publish symbols
for debugging to use Symbol Server in Azure Artifacts.
Specifies the file share that hosts your symbols. This value will be used in the call to
symstore.exe add as the /s parameter. To prepare your SymStore symbol store:
1. Set up a folder on a file-sharing server to store the symbols. For example, set up
\fabrikam-share\symbols .
If you leave this argument blank, your symbols will be source indexed but not published.
You can also store your symbols with your drops. See Publish Build Artifacts.
TeamServices . Allowed values: Default (The Default set of symbols to upload), Pdb (Only
Pdb based symbols Windows pdb's and managed Portable pdb's.), SourceMap (Only
JavaScript based SourceMap symbols (*.js.map)), All (All supported symbol formats).
Default value: Default .
Specifies which debug formats to publish to the symbol server.
Specifies whether to warn if sources are not indexed for a PDB file. Otherwise, the
messages are logged as normal output.
Specifies whether to use a version of the symbol upload tool that supports DWARF and
ELF files. This option only matters on Windows agents. On non-Windows agents, the
version of the symbol upload tool that supports DWARF and ELF files will always be
used.
string .
SymbolsProduct - Product
string .
SymbolsVersion - Version
string .
Specifies the artifact name to use for the symbols artifact. This should only be used with
the FileShare symbol server type. The default is Symbols_$(BuildConfiguration) .
Output variables
None.
Remarks
Use this task to index your source code and publish your symbols to a file share or
Azure Artifacts symbol server.
Indexing your source code allows you to use your symbol files to debug your
application on a machine other than the one you used to build your application. For
example, you can debug an application built by a build agent from a dev machine that
does not have the source code.
Symbol servers enables your debugger to automatically retrieve the correct symbol files
without knowing product names, build numbers, or package names.
) Important
To delete symbols that were published using the Index Sources & Publish Symbols
task, you must first delete the build that generated those symbols. This can be
accomplished by using retention policies or by manually deleting the run.
The Visual Studio debugger will use the mapping information to retrieve the source file
from the server. An actual command to retrieve the source file is included in the
mapping information. Example:
command
Requirements
ノ Expand table
Requirement Description
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
See also
Publish symbols for debugging
Debug with Visual Studio
Debug with WinDbg
Feedback
Was this page helpful? Yes No
Use this task to index your source code and publish your symbols to a file share or
Azure Artifacts symbol server.
Indexing your source code allows you to use your symbol files to debug your
application on a machine other than the one you used to build your application. For
example, you can debug an application built by a build agent from a dev machine that
does not have the source code.
Symbol servers enable your debugger to automatically retrieve the correct symbol files
without knowing product names, build numbers, or package names.
Syntax
# Index sources and publish symbols v1
# Index your source code and publish symbols to a file share.
- task: PublishSymbols@1
inputs:
#SymbolsPath: # string. Path to publish symbols.
SearchPattern: '**/bin/**/*.pdb' # string. Required. Search pattern.
Default: **/bin/**/*.pdb.
#SymbolsFolder: # string. Path to symbols folder.
# Advanced
#SkipIndexing: false # boolean. Skip indexing. Default: false.
#TreatNotIndexedAsWarning: false # boolean. Warn if not indexed.
Default: false.
#SymbolsMaximumWaitTime: # string. Max wait time (min).
#SymbolsProduct: # string. Product.
#SymbolsVersion: # string. Version.
#SymbolsArtifactName: 'Symbols_$(BuildConfiguration)' # string. Artifact
name. Default: Symbols_$(BuildConfiguration).
Inputs
SymbolsPath - Path to publish symbols
string .
Specifies the path to the symbol store share. If this value is not set, source indexing will
occur, but symbols will not be published.
SearchPattern - Search pattern
Specifies the path to the folder that is searched for symbol files. The default is
$(Build.SourcesDirectory) . Otherwise, specify a rooted path, for example:
$(Build.BinariesDirectory)/MyProject .
Specifies whether to skip injecting source server information into the PDB files.
Specifies whether to warn if sources are not indexed for a PDB file. Otherwise, the
messages are logged as normal output.
SymbolsProduct - Product
string .
SymbolsVersion - Version
string .
Specifies the version parameter to symstore.exe . The default is $(Build.BuildNumber) .
Specifies the artifact name to use for the symbols artifact. The default is
Symbols_$(BuildConfiguration) .
Output variables
None.
Requirements
ノ Expand table
Requirement Description
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Feedback
Was this page helpful? Yes No
Use this task to install the Apple certificate that is required to build on a macOS agent.
You can use this task to install an Apple certificate that is stored as a secure file on the
server.
Syntax
YAML
Inputs
certSecureFile - Certificate (P12)
string . Required.
Specifies the certificate (.p12) that was uploaded to Secure Files to install on the
macOS agent.
certPwd - Certificate (P12) password
string .
Specifies the password to the Apple certificate (.p12). Use a new build variable with its
lock enabled on the Variables tab to encrypt this value.
keychain - Keychain
string . Required. Allowed values: default (Default Keychain), temp (Temporary
Specifies the keychain in which to install the Apple certificate. For Microsoft-hosted
builds, use Temporary Keychain . A temporary keychain will always be deleted after the
build or release is complete.
Specifies the password to unlock the keychain. Use a new build variable with its lock
enabled on the Variables tab to encrypt this value. A password is generated for the
temporary keychain if not specified.
Specifies the full path to a custom keychain file. The keychain will be created if it does
not already exist.
Specifies the certificate to delete from the keychain after the build or release is
complete.
Specifies the custom keychain to delete from the agent after the build or release is
complete.
signingIdentity - Certificate signing identity
string .
Specifies the Common Name of the subject in the signing certificate. Will attempt to parse
the Common Name if this is left empty.
key
boolean .
If true , sets the partition_id ACL for the imported private key so that codesign won't
prompt to use the key for signing. This isn't necessary for temporary keychains on
MacOS High Sierra. Learn more about Open Radar .
string .
Output variables
This task defines the following output variables, which you can consume in downstream
steps, jobs, and stages.
signingIdentity
Specifies the resolved Common Name of the subject in the signing certificate. Either
supplied as an input or parsed from the P12 certificate file.
keychainPath
Specifies the path for the keychain file with the certificate.
Remarks
Use this task to install an Apple certificate that is required to build on a macOS agent.
You can use this task to install an Apple certificate that is stored as a secure file on the
server.
Requirements
ノ Expand table
Requirement Description
Demands Self-hosted agents must have capabilities that match the following demands to
run jobs that use this task: xcode
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Command This task runs using the following command restrictions: restricted
restrictions
Settable This task has permission to set the following variables: signingIdentity,
variables keychainPassword, keychainPath, APPLE_CERTIFICATE_SIGNING_IDENTITY,
APPLE_CERTIFICATE_KEYCHAIN
Feedback
Was this page helpful? Yes No
Use this task to install the Apple certificate that is required to build on a macOS agent.
You can use this task to install an Apple certificate that is stored as a secure file on the
server.
Syntax
# Install Apple Certificate v1
# Install an Apple certificate required to build on a macOS agent.
- task: InstallAppleCertificate@1
inputs:
certSecureFile: # string. Required. Certificate (P12).
#certPwd: # string. Certificate (P12) password.
# Advanced
keychain: 'temp' # 'default' | 'temp' | 'custom'. Required. Keychain.
Default: temp.
#keychainPassword: # string. Keychain password.
#customKeychainPath: # string. Required when keychain = custom. Custom
keychain path.
#deleteCert: # boolean. Optional. Use when keychain = custom || keychain
= default. Delete certificate from keychain.
#deleteCustomKeychain: # boolean. Optional. Use when keychain = custom.
Delete custom keychain.
#signingIdentity: # string. Certificate signing identity.
Inputs
certSecureFile - Certificate (P12)
string . Required.
Specifies the certificate (.p12) that was uploaded to Secure Files to install on the
macOS agent.
string .
Specifies the password to the Apple certificate (.p12). Use a new build variable with its
lock enabled on the Variables tab to encrypt this value.
keychain - Keychain
Specifies the keychain in which to install the Apple certificate. A temporary keychain will
always be deleted after the build or release is complete.
Specifies the password to unlock the keychain. Use a new build variable with its lock
enabled on the Variables tab to encrypt this value. A password is generated for the
temporary keychain if one is not already specified.
Specifies the full path to a custom keychain file. The keychain will be created if it does
not already exist.
Specifies the certificate to delete from the keychain after the build or release is
complete.
Specifies the custom keychain to delete from the agent after the build or release is
complete.
string .
Specifies the Common Name of the subject in the signing certificate. Will attempt to parse
the Common Name if this is left empty.
Task control options
All tasks have control options in addition to their task inputs. For more information, see
Control options and common task properties.
Output variables
This task defines the following output variables, which you can consume in downstream
steps, jobs, and stages.
signingIdentity
Specifies the resolved Common Name of the subject in the signing certificate. Either
supplied as an input or parsed from the P12 certificate file.
keychainPath
Specifies the path for the keychain file with the certificate.
Requirements
ノ Expand table
Requirement Description
Demands Self-hosted agents must have capabilities that match the following demands
to run jobs that use this task: xcode
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Command Any
restrictions
Use this task to install the Apple certificate that is required to build on a macOS agent.
You can use this task to install an Apple certificate that is stored as a secure file on the
server.
Syntax
# Install Apple Certificate v0
# Install an Apple certificate required to build on a macOS agent.
- task: InstallAppleCertificate@0
inputs:
certSecureFile: # string. Required. Certificate (P12).
#certPwd: # string. Certificate (P12) Password.
# Advanced
keychain: 'temp' # 'default' | 'temp' | 'custom'. Required. Keychain.
Default: temp.
#keychainPassword: # string. Keychain Password.
#customKeychainPath: # string. Required when keychain = custom. Custom
Keychain Path.
#deleteCert: # boolean. Optional. Use when keychain = custom || keychain
= default. Delete Certificate from Keychain.
#deleteCustomKeychain: # boolean. Optional. Use when keychain = custom.
Delete Custom Keychain.
#signingIdentity: # string. Certificate Signing Identity.
Inputs
certSecureFile - Certificate (P12)
string . Required.
Specifies the certificate (.p12) that was uploaded to Secure Files to install on the
macOS agent.
string .
Specifies the password to the Apple certificate (.p12). Use a new build variable with its
lock enabled on the Variables tab to encrypt this value.
keychain - Keychain
Specifies the keychain in which to install the Apple certificate. A temporary keychain will
always be deleted after the build or release is complete.
Specifies the password to unlock the keychain. Use a new build variable with its lock
enabled on the Variables tab to encrypt this value. A password is generated for the
temporary keychain if not specified.
Specifies the full path to a custom keychain file. The keychain will be created if it does
not already exist.
Specifies the certificate to delete from the keychain after the build or release is
complete.
Specifies the custom keychain to delete from the agent after the build or release is
complete.
string .
Specifies the Common Name of the subject in the signing certificate. Will attempt to parse
the Common Name if this is left empty.
Task control options
All tasks have control options in addition to their task inputs. For more information, see
Control options and common task properties.
Output variables
None.
Requirements
ノ Expand table
Requirement Description
Demands Self-hosted agents must have capabilities that match the following demands
to run jobs that use this task: xcode
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Command Any
restrictions
Feedback
Was this page helpful? Yes No
Use this task to install an Apple provisioning profile, which is required in order to build
on a macOS agent.
Syntax
# Install Apple provisioning profile v1
# Install an Apple provisioning profile required to build on a macOS agent
machine.
- task: InstallAppleProvisioningProfile@1
inputs:
provisioningProfileLocation: 'secureFiles' # 'secureFiles' |
'sourceRepository'. Required. Provisioning profile location. Default:
secureFiles.
provProfileSecureFile: # string. Required when
provisioningProfileLocation == secureFiles. Provisioning profile.
#provProfileSourceRepository: # string. Required when
provisioningProfileLocation == sourceRepository. Provisioning profile.
#removeProfile: true # boolean. Remove profile after build. Default:
true.
Inputs
provisioningProfileLocation - Provisioning profile location
Specifies the location of the provisioning profile to install. The provisioning profile can
be uploaded to Secure Files , or stored in your source repository or a local path on the
agent.
Specifies the provisioning profile that was uploaded to Secure Files to install on the
macOS agent.
provProfileSourceRepository - Provisioning profile
string . Required when provisioningProfileLocation == sourceRepository .
Specifies the provisioning profile from the source repository or the local path to a
provisioning profile on the macOS agent.
Specifies that the provisioning profile should be removed from the agent after the build
or release is complete.
Output variables
This task defines the following output variables, which you can consume in downstream
steps, jobs, and stages.
provisioningProfileUuid
provisioningProfileName
Remarks
You can use this task to install provisioning profiles needed to build iOS Apps, Apple
WatchKit apps, and App extensions.
Requirement Description
Demands Self-hosted agents must have capabilities that match the following demands
to run jobs that use this task: xcode
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Command This task runs using the following command restrictions: restricted
restrictions
Settable variables This task has permission to set the following variables:
provisioningProfileUuid, provisioningProfileName,
APPLE_PROV_PROFILE_UUID
Feedback
Was this page helpful? Yes No
Use this task to install an Apple provisioning profile, which is required in order to build
on a macOS agent.
Syntax
YAML
Inputs
provProfileSecureFile - Provisioning Profile
string . Required.
Specifies the provisioning profile that was uploaded to Secure Files to install on the
macOS agent.
Specifies that the provisioning profile should be removed from the agent after the build
or release is complete.
Remarks
You can use this task to install provisioning profiles needed to build iOS Apps, Apple
WatchKit apps, and App extensions.
Requirements
ノ Expand table
Requirement Description
Demands Self-hosted agents must have capabilities that match the following demands
to run jobs that use this task: xcode
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Command Any
restrictions
Feedback
Was this page helpful? Yes No
Syntax
# Install Azure Func Core Tools v0
# Install Azure Func Core Tools.
- task: FuncToolsInstaller@0
inputs:
#version: 'latest' # string. Version. Default: latest.
Inputs
version - Version
Specifies the version of Azure Functions Core Tools to install. For example:
2.7.1575
v2.7.1575
latest
Output variables
None.
Requirements
ノ Expand table
Requirement Description
Demands None
Capabilities Running this task satisfies the following demands for any subsequent tasks
in the same job: Func
Command Any
restrictions
Feedback
Was this page helpful? Yes No
Use this task in a pipeline to install an SSH key prior to a build or release step.
Syntax
YAML
Inputs
knownHostsEntry - Known Hosts Entry
string .
string . Required.
Specifies the SSH key that was uploaded to Secure Files to install on the agent.
Optional. Adds an entry related to the key that was installed to the SSH config file. The
key file will be available for all subsequent tasks.
configHostAlias - Alias
configUser - User
configPort - Port
Output variables
None.
Remarks
Use this task in a pipeline to install an SSH key prior to a build or release step.
7 Note
We recommend that you don't pass in your public key as plain text to the task
configuration. Instead, set a secret variable in your pipeline for the contents of your
mykey.pub file. Then, call the variable in your pipeline definition as $(myPubKey) . For the
secret part of your key, use the Secure File library in Azure Pipelines.
To create your task, use the following example of a well-configured Install SSH Key task:
YAML
steps:
- task: InstallSSHKey@0
displayName: 'Install an SSH key'
inputs:
knownHostsEntry: 'SHA256:1Hyr55tsxGifESBMc0s+2NtutnR/4+LOkVwrOGrIp8U
johndoe@contoso'
sshPublicKey: '$(myPubKey)'
sshKeySecureFile: 'id_rsa'
7 Note
Your public key should be added to the repository\organization; otherwise, there
will be access issues. For GitHub, follow the guide above. For Azure DevOps
Services, use Add the public key to Azure DevOps Services/TFS.
These parameters allow you to add a host to the SSH config file (for example,
/root/.ssh/config for Linux) in order to use it in custom scripts via an alias.
After the build is completed, the task will attempt to restore the original SSH config file.
If there was no SSH config file initially, then the host is removed from the agent.
An example of multiple SSH keys installation. The case with several GitHub repos and
their own key for each one:
yml
steps:
- task: InstallSSHKey@0
inputs:
knownHostsEntry: $(known_host)
sshPublicKey: $(first_public_key)
sshKeySecureFile: $(first_private_key)
addEntryToConfig: true
configHostAlias: <first-host-alias>
configHostname: github.com
configUser: git
displayName: Install First Repo SSH Key
- task: InstallSSHKey@0
inputs:
knownHostsEntry: $(known_host)
sshPublicKey: $(second_public_key)
sshKeySecureFile: $(second_private_key)
addEntryToConfig: true
configHostAlias: <second-host-alias>
configHostname: github.com
configUser: git
displayName: Install Second Repo SSH Key
Examples
If you have a repository that you don't want to expose to the open-source community, a
common practice is to make the repository private. However, a CI/CD tool like Azure
DevOps needs access to the repository if you want to use the tool to manage the
repository. To give Azure DevOps access, you might need an SSH key to authenticate
access to GitHub.
Here are the steps to use an SSH key to authenticate access to GitHub:
1. Generate a key pair to use to authenticate access from GitHub to Azure DevOps:
Bash
ssh-keygen -t rsa
b. Enter a name for the SSH key pair. In our example, we use myKey.
c. (Optional) You can enter a passphrase to encrypt your private key. This step is
optional. Using a passphrase is more secure than not using one.
ssh-keygen creates the SSH key pairs, and the following success message
appears:
2. Add the public key to the GitHub repository. (The public key ends in ".pub"). To do
this, go the following URL in your browser: https://github.com/(organization-
name)/(repository-name)/settings/keys .
b. In the Add new dialog box, enter a title, and then copy and paste the SSH key:
c. Select Add key.
Bash
ssh-keyscan github.com
Your "Known Hosts Entry" is the displayed value that doesn't begin with # in the
GitBash results:
To create a YAML pipeline, in the YAML definition, add the following task:
Bash
- task: InstallSSHKey@0
inputs:
knownHostsEntry: #{Enter your Known Hosts Entry Here}
sshPublicKey: #{Enter your Public key Here}
sshKeySecureFile: #{Enter the name of your key in "Secure Files"
Here}
The SSH keys are now installed, and you can proceed with the script to connect by using
SSH, and not the default HTTPS.
Requirements
ノ Expand table
Requirement Description
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Command This task runs using the following command restrictions: restricted
restrictions
Settable This task has permission to set the following variables: SSH_AGENT_PID,
variables SSH_AUTH_SOCK, INSTALL_SSH_KEY_CONFIG_LOCATION,
INSTALL_SSH_KEY_KNOWN_HOSTS_LOCATION
Feedback
Was this page helpful? Yes No
Use this task in an agentless job of a release pipeline to invoke an HTTP triggered
function in a function app and parse the response. The function app must be created
and hosted in Azure Functions.
Syntax
YAML
Inputs
function - Azure function URL
string . Required.
string . Required.
The function or the host key used to access and invoke the function. To keep the key
secure, use a secret pipeline variable to store the function key. Example:
$(myFunctionKey) . myFunctionKey is an environment-level secret variable with a value as
method - Method
string . Required. Allowed values: OPTIONS , GET , HEAD , POST , PUT , DELETE , TRACE , PATCH .
headers - Headers
string . Default value: {\n"Content-Type":"application/json", \n"PlanUrl":
The header in JSON format to be attached to the request sent to the function.
string .
The string query to append to the function URL. Must not start with ? or & .
body - Body
string . Optional. Use when method != GET && method != HEAD .
string . Required. Allowed values: true (Callback), false (ApiResponse). Default value:
false .
false - API response - the function returns success and success criteria evaluates
to true.
true - Callback - the function makes a callback to update the timeline record.
The criteria for a successful task. By default, the task returns 200 OK status when
successful.
Output variables
None.
Remarks
Use this task in an agentless job of a release pipeline to invoke an HTTP triggered
function in a function app that is created and hosted in Azure Functions and parse the
response.
{planUri}/{projectId}/_apis/distributedtask/hubs/{hubName}/plans/{planId}/ev
ents?api-version=2.0-preview.1
**Request Body**
{ "name": "TaskCompleted", "taskId": "taskInstanceId", "jobId": "jobId",
"result": "succeeded" }
See this simple cmdline application for specifics. In addition, a C# helper library is
available to enable live logging and managing task status for agentless tasks. Learn
more
Why does the task fail within 1 minute when the timeout
is longer?
If the function executes for more than 1 minute, use the Callback completion event. The
API Response completion option is supported for requests that complete within 60
seconds.
Examples
#r "Newtonsoft.Json"
using System;
using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Primitives;
using Newtonsoft.Json;
Requirements
ノ Expand table
Requirement Description
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
See also
Automate Azure Functions deployments with Azure Pipelines
Agentless job
Feedback
Was this page helpful? Yes No
Use this task in an agentless job of a release pipeline to invoke an HTTP triggered
function in a function app and parse the response. The function app must be created
and hosted in Azure Functions.
Syntax
# Invoke Azure Function v0
# Invoke Azure function as a part of your process.
- task: AzureFunction@0
inputs:
function: # string. Required. Azure function url.
key: # string. Required. Function key.
method: 'POST' # 'OPTIONS' | 'GET' | 'HEAD' | 'POST' | 'PUT' | 'DELETE'
| 'TRACE' | 'PATCH'. Required. Method. Default: POST.
#headers: # string. Headers.
#queryParameters: # string. Query parameters.
#body: '{"JobId": "$(system.jobId)", "PlanId": "$(system.planId)",
"TimelineId": "$(system.timelineId)", "ProjectId":
"$(system.teamProjectId)", "VstsUrl": "$(system.CollectionUri)","AuthToken":
"$(system.AccessToken)"}' # string. Optional. Use when method != GET &&
method != HEAD. Body. Default: {"JobId": "$(system.jobId)", "PlanId":
"$(system.planId)", "TimelineId": "$(system.timelineId)", "ProjectId":
"$(system.teamProjectId)", "VstsUrl": "$(system.CollectionUri)","AuthToken":
"$(system.AccessToken)"}.
# Completion Options
waitForCompletion: 'false' # 'true' | 'false'. Required. Complete based
on. Default: false.
#successCriteria: # string. Optional. Use when waitForCompletion =
false. Success criteria.
Inputs
function - Azure function url
string . Required.
The function or the host key used to access and invoke the function. To keep the key
secure, use a secret pipeline variable to store the function key. Example:
$(myFunctionKey) . myFunctionKey is an environment-level secret variable with a value as
method - Method
string . Required. Allowed values: OPTIONS , GET , HEAD , POST , PUT , DELETE , TRACE , PATCH .
headers - Headers
string . Default value: {\n"Content-Type":"application/json"\n} .
The header in JSON format to be attached to the request sent to the function.
string .
The string query to append to the function URL. Must not start with ? or & .
body - Body
string . Optional. Use when method != GET && method != HEAD . Default value: {"JobId":
"$(system.CollectionUri)","AuthToken": "$(system.AccessToken)"} .
false .
to true.
true - Callback - the function makes a callback to update the timeline record.
The criteria for a successful task. By default, the task returns 200 OK status when
successful.
Output variables
None.
Remarks
AzureFunction@2 is a newer version of the Invoke Azure Function task.
Requirements
ノ Expand table
Requirement Description
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Requirement Description
See also
AzureFunction@2 is a newer version of the Invoke Azure Function task.
Feedback
Was this page helpful? Yes No
Syntax
YAML
Inputs
connectionType - Connection type
Specifies the service connection type to use to invoke the REST API. Select Azure
Resource Manager to invoke an Azure management API or Generic for all other APIs.
serviceConnection - Generic service connection
Specifies the generic service connection that provides the baseUrl for the call and the
authorization to use for the task.
Specifies the Azure Resource Manager subscription to configure and use for invoking
Azure management APIs.
method - Method
string . Required. Allowed values: OPTIONS , GET , HEAD , POST , PUT , DELETE , TRACE , PATCH .
headers - Headers
Defines the header in JSON format. The header is attached with the request sent to the
API.
body - Body
string . Optional. Use when method != GET && method != HEAD .
Specifies the request body for the function call in JSON format.
urlSuffix - URL suffix and parameters
string .
Specifies the string to append to the baseUrl from the generic service connection while
making the HTTP call.
false .
Specifies how the task reports completion. The allowed values are:
false - API response: reports completion when the function returns success within
Specifies the task's criteria for success. The response content does not influence the
result if no criteria is defined. By default, the task passes when the call returns 200 OK .
Output variables
None.
Remarks
7 Note
Succeeds if the API returns success and the response body parsing is successful, or when
the API updates the timeline record with success.
The Invoke REST API task does not perform deployment actions directly. Instead, it
allows you to invoke any generic HTTP REST API as part of the automated pipeline and,
optionally, wait for it to be completed.
For more information about using this task, see Approvals and gates overview.
{planUri}/{projectId}/_apis/distributedtask/hubs/{hubName}/plans/{planId}/ev
ents?api-version=2.0-preview.1
**Request Body**
{ "name": "TaskCompleted", "taskId": "taskInstanceId", "jobId": "jobId",
"result": "succeeded" }
In addition, a C# helper library is available to enable live logging and managing task
status for agentless tasks. Learn more
Example
YAML
yml
steps:
- task: InvokeRESTAPI@1
displayName: 'Invoke REST API: GET'
inputs:
serviceConnection: 'generic_demo'
method: GET
successCriteria: 'eq(root[''count''], ''1425'')'
In this example, the task succeeds when the response matched our
successCriteria : eq(root[''count''], ''1425'').
Requirements
ノ Expand table
Requirement Description
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Feedback
Was this page helpful? Yes No
Syntax
YAML
Inputs
serviceConnection - Generic endpoint
Specifies the generic service connection that provides the baseURL for the call and the
authorization to use for the task.
method - Method
string . Required. Allowed values: OPTIONS , GET , HEAD , POST , PUT , DELETE , TRACE , PATCH .
headers - Headers
string . Default value: {\n"Content-Type":"application/json"\n} .
Defines the header in JSON format. The header is attached with the request sent to the
API.
body - Body
string . Optional. Use when method != GET && method != HEAD . Default value: {"JobId":
"$(system.CollectionUri)","AuthToken": "$(system.AccessToken)"} .
Specifies the request body for the function call in JSON format.
Specifies the string to append to the baseUrl from the generic service connection while
making the HTTP call.
false .
Specifies how the task reports completion. The allowed values are:
false - API response: Reports completion when the function returns success
Specifies the task's criteria for success. The response content does not influence the
result if no criteria is defined. By default, the task passes when the call returns 200 OK .
Output variables
None.
Remarks
7 Note
Succeeds if the API returns success and the response body parsing is successful, or when
the API updates the timeline record with success.
The Invoke REST API task does not perform deployment actions directly. Instead, it
allows you to invoke any generic HTTP REST API as part of the automated pipeline and,
optionally, wait for it to be completed.
For more information about using this task, see Approvals and gates overview.
**Request Body**
{ "name": "TaskCompleted", "taskId": "taskInstanceId", "jobId": "jobId",
"result": "succeeded" }
In addition, a C# helper library is available to enable live logging and managing task
status for agentless tasks. Learn more
Requirements
ノ Expand table
Requirement Description
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Feedback
Was this page helpful? Yes No
Use this task to acquire a specific version of Java from a user-supplied Azure blob or the
tool cache and set JAVA_HOME .
Syntax
YAML
Inputs
versionSpec - JDK version
Specifies the source for the compressed JDK. The source can be Azure blob storage or a
local directory on the agent or source repository, or you can use the pre-installed
version of Java (available for Microsoft-hosted agents). Please see the example below
about how to use the pre-installed version of Java.
Specifies the path to the JDK archive file that contains the compressed JDK. The path
could be in your source repository or a local path on the agent. The file should be an
archive (.zip, .tar.gz, .7z) containing the bin folder on the root level or inside a single
directory. MacOS supports .pkg and .dmg files containing only one .pkg file inside.
Specifies Azure Classic or Resource Manager storage accounts. Select the storage
account name in which the JDK is located.
Specifies the path to the JDK inside the Azure storage container.
Specifies the destination directory where the JDK should be extracted. On Linux and
Windows, this is used as the destination directory for the JDK installation. On macOS,
this directory is used as a temporary folder for extracting .dmg's because macOS doesn't
support installing JDK to a specific directory.
Specifies the option to clean the destination directory before JDK is extracted into it.
Remarks
Use this task to acquire a specific version of Java from a user-supplied Azure blob, a
location in the source or on the agent, or the tools cache. The task also sets the
JAVA_HOME environment variable. Use this task to change the version of Java used in Java
tasks.
7 Note
To run the Java Tool Installer task on macOS, it is required for the user under which
the agent is running to have permission to execute the sudo command without a
password. You can follow the next steps to enable this permission:
1. Run the sudo visudo command. The sudoers file opens for editing.
2. Go to the bottom of the file and add the following line: user ALL=NOPASSWD:
/usr/sbin/installer (Replace user with the actual user alias).
Examples
Here's an example of getting the archive file from a local directory on Linux. The file
should be an archive (.zip, .gz) of the JAVA_HOME directory, so it includes the bin , lib ,
include , jre , etc. directories.
YAML
- task: JavaToolInstaller@0
inputs:
versionSpec: "11"
jdkArchitectureOption: x64
jdkSourceOption: LocalDirectory
jdkFile: "/builds/openjdk-11.0.2_linux-x64_bin.tar.gz"
jdkDestinationDirectory: "/builds/binaries/externals"
cleanDestinationDirectory: true
Here's an example of downloading the archive file from Azure Storage. The file should
be an archive (.zip, .gz) of the JAVA_HOME directory, so it includes the bin , lib , include ,
jre , etc. directories.
YAML
- task: JavaToolInstaller@0
inputs:
versionSpec: '6'
jdkArchitectureOption: 'x64'
jdkSourceOption: AzureStorage
azureResourceManagerEndpoint: myARMServiceConnection
azureStorageAccountName: myAzureStorageAccountName
azureContainerName: myAzureStorageContainerName
azureCommonVirtualFile: 'jdk1.6.0_45.zip'
jdkDestinationDirectory: '$(agent.toolsDirectory)/jdk6'
cleanDestinationDirectory: false
Here's an example of using "pre-installed" feature. This feature allows you to use Java
versions that are pre-installed on the Microsoft-hosted agent. You can find available
pre-installed versions of Java in the included software column in the hosted agents
table.
YAML
- task: JavaToolInstaller@0
inputs:
versionSpec: '8'
jdkArchitectureOption: 'x64'
jdkSourceOption: 'PreInstalled'
Requirements
ノ Expand table
Requirement Description
Demands None
Capabilities Running this task satisfies the following demands for any subsequent tasks
in the same job: Java, JDK
Command This task runs using the following command restrictions: restricted
restrictions
Requirement Description
Settable variables This task has permission to set the following variables: PATH, JAVA_HOME*
See also
For an explanation of tool installers and examples, see Tool installers.
Feedback
Was this page helpful? Yes No
Syntax
# Jenkins download artifacts v1
# Download artifacts produced by a Jenkins job.
- task: JenkinsDownloadArtifacts@1
inputs:
jenkinsServerConnection: # string. Alias: serverEndpoint. Required.
Jenkins service connection.
jobName: # string. Required. Job name.
#jenkinsJobType: # string. Optional. Use when jobName = invalidjobName.
Jenkins job type.
saveTo: 'jenkinsArtifacts' # string. Required. Save to. Default:
jenkinsArtifacts.
# Advanced
jenkinsBuild: 'LastSuccessfulBuild' # 'LastSuccessfulBuild' |
'BuildNumber'. Required. Download artifacts produced by. Default:
LastSuccessfulBuild.
#jenkinsBuildNumber: '1' # string. Required when jenkinsBuild ==
BuildNumber. Jenkins build number. Default: 1.
#itemPattern: '**' # string. Item Pattern. Default: **.
#downloadCommitsAndWorkItems: false # boolean. Download Commits and
WorkItems. Default: false.
#startJenkinsBuildNumber: # string. Optional. Use when
downloadCommitsAndWorkItems == true && jenkinsBuild == BuildNumber. Download
commits and work items from.
#artifactDetailsFileNameSuffix: # string. Optional. Use when
downloadCommitsAndWorkItems == invalid. Commit and WorkItem FileName.
# Propagated Artifacts
#propagatedArtifacts: false # boolean. Artifacts are propagated to
Azure. Default: false.
#artifactProvider: 'azureStorage' # 'azureStorage'. Required when
propagatedArtifacts == notValid. Artifact Provider. Default: azureStorage.
#ConnectedServiceNameARM: # string. Required when propagatedArtifacts ==
true. Azure Subscription.
#storageAccountName: # string. Required when propagatedArtifacts ==
true. Storage Account Name.
#containerName: # string. Required when propagatedArtifacts == true.
Container Name.
#commonVirtualPath: # string. Optional. Use when propagatedArtifacts ==
true. Common Virtual Path.
Inputs
jenkinsServerConnection - Jenkins service connection
Specifies the service connection for your Jenkins instance. To create a new service
connection, click the Manage link.
string . Required.
Specifies the name of the Jenkins job to download artifacts from. This must exactly
match the job name on the Jenkins server.
saveTo - Save to
Specifies the directory where Jenkins artifacts are downloaded and saved. This directory
is created if it does not exist.
Downloads artifacts produced by the last successful build or from a specific build
instance.
The default pattern ** downloads all files across all artifacts produced by the Jenkins
job. To download all files within the artifact drop, use drop/** .
Enables downloading the commits and work item details associated with the Jenkins
Job.
BuildNumber .
Starts the build number for downloading commits and work items. If provided, all
commits and work items between the start build number and the build number given as
input to download artifacts are downloaded.
Specifies the file name suffix for commits and work item attachments. Attachments are
created with commits_{suffix}.json and workitem_{suffix}.json . If this input is not
provided, attachments are created with the names commits.json and workitems.json .
Use this input if Jenkins artifacts were propagated to Azure. To upload Jenkins artifacts
to Azure, refer to this Jenkins plugin .
Specifies the external storage provider used in Jenkins job to upload the artifacts.
Specifies Azure Classic or Resource Manager storage accounts. Select the storage
account name where the artifacts are propagated.
Specifies the name of the container in the storage account where artifacts are uploaded.
Specifies the path to the artifacts inside the Azure storage container.
Output variables
None.
Remarks
Use this task to download artifacts produced by a Jenkins job.
Requirements
ノ Expand table
Requirement Description
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Feedback
Was this page helpful? Yes No
Syntax
# Jenkins queue job v2
# Queue a job on a Jenkins server.
- task: JenkinsQueueJob@2
inputs:
serverEndpoint: # string. Required. Jenkins service connection.
jobName: # string. Required. Job name.
#isMultibranchJob: false # boolean. Job is of multibranch pipeline type.
Default: false.
#multibranchPipelineBranch: # string. Required when isMultibranchJob =
true. Multibranch pipeline branch.
#captureConsole: true # boolean. Capture console output and wait for
completion. Default: true.
#capturePipeline: true # boolean. Optional. Use when captureConsole =
true. Capture pipeline output and wait for pipeline completion. Default:
true.
# Advanced
#isParameterizedJob: false # boolean. Alias: parameterizedJob.
Parameterized job. Default: false.
#jobParameters: # string. Optional. Use when parameterizedJob = true.
Job parameters.
#failOnUnstableResult: false # boolean. Fail on unstable result.
Default: false.
#retryCount: '3' # string. Number of retries for failed connection.
Default: 3.
#delayBetweenRetries: '60' # string. Time between retries. Default: 60.
Inputs
serverEndpoint - Jenkins service connection
string . Required.
Specifies the service connection for your Jenkins instance. Click the Manage link to
create a new Jenkins service connection.
jobName - Job name
string . Required.
The name of the Jenkins job to queue. This must exactly match the job name on the
Jenkins server.
This job is a multibranch pipeline. If specified, add the appropriate branch name. This
input requires Team Foundation Server Plugin for Jenkins v5.3.4 or later.
Queues this multibranch pipeline job on the specified branch. This input requires Team
Foundation Server Plugin for Jenkins v5.3.4 or later.
If specified, this input captures the Jenkins build console output, waits for the Jenkins
build to complete, and succeeds/fails based on the Jenkins build result. Otherwise, once
the Jenkins job queues, this task successfully completes without waiting for the Jenkins
build to run.
If specified, this task captures the full Jenkins build pipeline console output, waits for the
full Jenkins build pipeline to complete, and succeeds/fails based on the Jenkins build
pipeline result. Otherwise, once the first Jenkins job completes, this task successfully
completes without waiting for full Jenkins build pipeline to run.
Specifies if the Jenkins job accepts parameters. Use this input even if all default
parameter values are used and no parameters are actually specified.
jobParameters - Job parameters
Specifies job parameters, with one per line, in the format of <parameterName>=
<parameterValue> .
To set a parameter to an empty value, which is useful for overriding a default value,
leave off the parameter value. For example, specify parameterName= .
Variables are supported. To set a commitId parameter value to the Git commit ID of the
build, for example, you can use: commitId=$(Build.SourceVersion) . For more
information, see the documentation on variables.
Boolean
Choice
Password
String
Specifies the amount of connection retries when connection failure or error occurs.
Specifies the amount of time between connection retries when an error occurs. This
value is specified in seconds.
Task control options
All tasks have control options in addition to their task inputs. For more information, see
Control options and common task properties.
Output variables
This task defines the following output variables, which you can consume in downstream
steps, jobs, and stages.
JENKINS_JOB_ID
The ID of the Jenkins job instance queued by this task. Use this variable in the Jenkins
Download Artifacts task to download the artifacts for this particular job instance.
Remarks
Use this task to queue a job on a Jenkins server.
To set it up:
2. On the Jenkins server, for each job you would like to collect results from, add the
Collect results for Azure Pipelines/TFS post-build action and then configure it with
one or more pairs of result type and include file pattern.
3. On the Jenkins Queue Job, build task enable the Capture console output and wait
for completion to collect results from the root level job, or the Capture pipeline
output and wait for pipeline completion to collect results from all pipeline jobs.
Requirements
ノ Expand table
Requirement Description
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Feedback
Was this page helpful? Yes No
Syntax
YAML
Inputs
serverEndpoint - Jenkins service endpoint
string . Required.
Specifies the service endpoint for your Jenkins instance. Click the Manage link (when
using the task assistant) to create a new Jenkins service endpoint.
This job is a multibranch pipeline. If specified, add the appropriate branch name. This
input requires Team Foundation Server Plugin for Jenkins v5.3.4 or later.
Queues this multibranch pipeline job on the specified branch. This input requires Team
Foundation Server Plugin for Jenkins v5.3.4 or later.
If specified, this input captures the Jenkins build console output, waits for the Jenkins
build to complete, and succeeds/fails based on the Jenkins build result. Otherwise, once
the Jenkins job queues, this step successfully completes without waiting for the Jenkins
build to run.
If specified, this input captures the full Jenkins build pipeline console output, waits for
the full Jenkins build pipeline to complete, and succeeds/fails based on the Jenkins build
pipeline result. Otherwise, once the first Jenkins job completes, this input successfully
completes without waiting for the full Jenkins build pipeline to run.
Specifies if the Jenkins job accepts parameters. Use this input even if all default
parameter values are used and no parameters are actually specified.
jobParameters - Job parameters
string . Optional. Use when parameterizedJob = true .
Specifies job parameters with one per line, for example: <parameterName>=
<parameterValue> .
To set a parameter to an empty value, which is useful for overriding a default value,
leave off the parameter value. For example, specify <parameterName>= .
Variables are supported. To set a commitId parameter value to the Git commit ID of the
build, for example, you can use: commitId=$(Build.SourceVersion) . For more
information, see the documentation on variables .
Boolean
Choice
Password
String
Output variables
None.
Requirements
ノ Expand table
Requirement Description
Demands None
Requirement Description
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Feedback
Was this page helpful? Yes No
Syntax
YAML
# Kubectl v1
# Deploy, configure, update a Kubernetes cluster in Azure Container Service
by running kubectl commands.
- task: Kubernetes@1
inputs:
# Kubernetes Cluster
#connectionType: 'Kubernetes Service Connection' # 'Azure Resource
Manager' | 'Kubernetes Service Connection' | 'None'. Required when command
!= logout. Service connection type. Default: Kubernetes Service Connection.
#kubernetesServiceEndpoint: # string. Required when connectionType =
Kubernetes Service Connection && command != logout. Kubernetes service
connection.
#azureSubscriptionEndpoint: # string. Required when connectionType =
Azure Resource Manager && command != logout. Azure subscription.
#azureResourceGroup: # string. Required when connectionType = Azure
Resource Manager && command != logout. Resource group.
#kubernetesCluster: # string. Required when connectionType = Azure
Resource Manager && command != logout. Kubernetes cluster.
#useClusterAdmin: false # boolean. Optional. Use when connectionType =
Azure Resource Manager && command != logout. Use cluster admin credentials.
Default: false.
#namespace: # string. Optional. Use when command != logout. Namespace.
# Commands
#command: # 'apply' | 'create' | 'delete' | 'exec' | 'expose' | 'get' |
'login' | 'logout' | 'logs' | 'run' | 'set' | 'top'. Command.
#useConfigurationFile: false # boolean. Optional. Use when command !=
login && command != logout. Use configuration. Default: false.
#configurationType: 'configuration' # 'configuration' | 'inline'.
Optional. Use when useConfigurationFile = true. Configuration type. Default:
configuration.
configuration: # string. Required when configurationType =
configuration. File path.
#inline: # string. Required when configurationType = inline. Inline
configuration.
#arguments: # string. Optional. Use when command != login && command !=
logout. Arguments.
# Secrets
#secretType: 'dockerRegistry' # 'dockerRegistry' | 'generic'. Required
when command != login && command != logout. Type of secret. Default:
dockerRegistry.
#secretArguments: # string. Optional. Use when secretType = generic &&
command != login && command != logout. Arguments.
#containerRegistryType: 'Azure Container Registry' # 'Azure Container
Registry' | 'Container Registry'. Required when secretType = dockerRegistry
&& command != login && command != logout. Container registry type. Default:
Azure Container Registry.
#dockerRegistryEndpoint: # string. Optional. Use when secretType =
dockerRegistry && containerRegistryType = Container Registry && command !=
login && command != logout. Docker registry service connection.
#azureSubscriptionEndpointForSecrets: # string. Optional. Use when
secretType = dockerRegistry && containerRegistryType = Azure Container
Registry && command != login && command != logout. Azure subscription.
#azureContainerRegistry: # string. Optional. Use when secretType =
dockerRegistry && containerRegistryType = Azure Container Registry &&
command != login && command != logout. Azure container registry.
#secretName: # string. Optional. Use when command != login && command !=
logout. Secret name.
#forceUpdate: true # boolean. Optional. Use when command != login &&
command != logout. Force update secret. Default: true.
# ConfigMaps
#configMapName: # string. Optional. Use when command != login && command
!= logout. ConfigMap name.
#forceUpdateConfigMap: false # boolean. Optional. Use when command !=
login && command != logout. Force update configmap. Default: false.
#useConfigMapFile: false # boolean. Optional. Use when command != login
&& command != logout. Use file. Default: false.
#configMapFile: # string. Required when useConfigMapFile = true &&
command != login && command != logout. ConfigMap file.
#configMapArguments: # string. Optional. Use when useConfigMapFile =
false && command != login && command != logout. Arguments.
# Advanced
#versionOrLocation: 'version' # 'version' | 'location'. Kubectl.
Default: version.
#versionSpec: '1.13.2' # string. Optional. Use when versionOrLocation =
version. Version spec. Default: 1.13.2.
#checkLatest: false # boolean. Optional. Use when versionOrLocation =
version. Check for latest version. Default: false.
#specifyLocation: # string. Required when versionOrLocation = location.
Path to kubectl.
#workingDirectory: '$(System.DefaultWorkingDirectory)' # string. Alias:
cwd. Working directory. Default: $(System.DefaultWorkingDirectory).
#outputFormat: 'json' # 'json' | 'yaml' | 'none'. Output format.
Default: json.
Inputs
connectionType - Service connection type
string . Required when command != logout . Allowed values: Azure Resource Manager ,
Service Account, or import an AKS instance with the Azure Subscription option.
Importing an AKS instance with the Azure Subscription option requires Kubernetes
cluster access at Service Connection configuration time.
Azure Resource Manager - Lets you select an AKS instance. Does not access
For more information, see Service connection in the following Remarks section.
Specifies the Azure Resource Manager subscription, which contains the Azure Container
Registry.
7 Note
To configure a new service connection, specify the Azure subscription from the list
and click Authorize . If your subscription is not listed or if you want to use an
existing Service Principal, you can setup an Azure service connection using the Add
or Manage buttons.
logout .
logout .
namespace - Namespace
string . Optional. Use when command != logout .
Set the namespace for the kubectl command by using the –namespace flag. If the
namespace is not provided, the commands will run in the default namespace.
command - Command
string . Allowed values: apply , create , delete , exec , expose , get , login , logout , logs ,
Select or specify a kubectl command to run. The list of allowed values provides some
common choices for ease of selection when using the task assistant, but you can specify
other kubectl commands such as scale . Use the arguments input to specify additional
parameters to the specified kubectl command.
boolean . Optional. Use when command != login && command != logout . Default value:
false .
Specifies the Kubernetes configuration to use with the kubectl command. The inline
script, filename, directory, or URL to Kubernetes configuration files can be provided.
Specifies the filename, directory, or URL to kubernetes configuration files that is used
with the commands.
arguments - Arguments
string . Optional. Use when command != login && command != logout .
string . Required when command != login && command != logout . Allowed values:
dockerRegistry , generic . Default value: dockerRegistry .
secretArguments - Arguments
string . Optional. Use when secretType = generic && command != login && command !=
logout .
Specifies the keys and literal values to insert in secret. For example, --from-
literal=key1=value1 or --from-literal=key2="top secret" .
string . Required when secretType = dockerRegistry && command != login && command
!= logout . Allowed values: Azure Container Registry , Container Registry . Default
Select a Container registry type. The task can use Azure Subscription details to work with
an Azure Container registry. Other standard Container registries are also supported.
Select a Docker registry service connection. Required for commands that need to
authenticate with a registry.
Specifies the Azure Resource Manager subscription, which contains Azure Container
Registry.
7 Note
To configure a new service connection, select the Azure subscription from the list
and click Authorize . If your subscription is not listed or if you want to use an
existing Service Principal, you can setup an Azure service connection using the Add
or Manage buttons.
Specifies an Azure Container Registry which is used for pulling container images and
deploying applications to the Kubernetes cluster. Required for commands that need to
authenticate with a registry.
boolean . Optional. Use when command != login && command != logout . Default value:
true .
Delete the secret if it exists and create a new one with updated values.
ConfigMaps allow you to decouple configuration artifacts from image content to keep
containerized applications portable.
boolean . Optional. Use when command != login && command != logout . Default value:
false .
Delete the configmap if it exists and create a new one with updated values.
boolean . Optional. Use when command != login && command != logout . Default value:
false .
logout .
configMapArguments - Arguments
string . Optional. Use when useConfigMapFile = false && command != login && command
!= logout .
Specifies the keys and literal values to insert in configMap . For example, --from-
literal=key1=value1 or --from-literal=key2="top secret" .
versionOrLocation - Kubectl
string . Allowed values: version , location (Specify location). Default value: version .
kubectl is a command line interface for running commands against Kubernetes clusters.
Specifies the version spec of the version to get. Examples: 1.7.0 , 1.x.0 , 4.x.0 , 6.10.0 ,
>=6.10.0 .
Always checks online for the latest available version (stable.txt) that satisfies the version
spec. This is typically false unless you have a specific scenario to always get latest. This
will cause it to incur download costs when potentially not necessary, especially with the
hosted build pool.
Output format.
Task control options
All tasks have control options in addition to their task inputs. For more information, see
Control options and common task properties.
Output variables
This task defines the following output variables, which you can consume in downstream
steps, jobs, and stages.
KubectlOutput
Remarks
What's new in Version 1.0.
Added a new service connection type input for easy selection of Azure AKS
clusters.
Replaced the output variable input with an output variables section that we added
in all tasks.
Use this task to deploy, configure, or update a Kubernetes cluster by running kubectl
commands.
Service connection
The task works with two service connection types: Azure Resource Manager and
Kubernetes Service Connection, described below.
This YAML example shows how Azure Resource Manager is used to refer to the
Kubernetes cluster. This is to be used with one of the kubectl commands and the
appropriate values required by the command.
YAML
variables:
azureSubscriptionEndpoint: Contoso
azureContainerRegistry: contoso.azurecr.io
azureResourceGroup: Contoso
kubernetesCluster: Contoso
useClusterAdmin: false
steps:
- task: Kubernetes@1
displayName: kubectl apply
inputs:
connectionType: Azure Resource Manager
azureSubscriptionEndpoint: $(azureSubscriptionEndpoint)
azureResourceGroup: $(azureResourceGroup)
kubernetesCluster: $(kubernetesCluster)
useClusterAdmin: $(useClusterAdmin)
This YAML example shows how a Kubernetes Service Connection is used to refer to the
Kubernetes cluster. This is to be used with one of the kubectl commands and the
appropriate values required by the command.
YAML
- task: Kubernetes@1
displayName: kubectl apply
inputs:
connectionType: Kubernetes Service Connection
kubernetesServiceEndpoint: Contoso
You can create a Kubernetes service connection with any of the following options.
KubeConfig
Service Account
Azure Subscription
When selecting the Azure Subscription option, Kubernetes needs to be accessible to
Azure DevOps at service connection configuration time. There may be various reasons a
service connection cannot be created, for example you created a private cluster or the
cluster has local accounts disabled. In these cases, Azure DevOps can't connect to your
cluster at service connection configuration time and you'll see a stuck Loading
namespaces screen.
Starting with Kubernetes 1.24, long-lived tokens are no longer created by default .
Kubernetes recommends not using long-lived tokens. As a result, tasks using a
Kubernetes service connection created with the Azure Subscription option don't have
access to the permanent token required to authenticate and can’t access your
Kubernetes cluster. This also results in the frozen Loading namespaces dialog.
I receive the following error message: Could not find any secret
associated with the service account. What is happening?
You are using the Kubernetes service connection with Azure Subscription option. We are
updating this method to create long-lived tokens. This is expected to be available mid-
May. However, it is recommended to start using the Azure service connection type and
not o use long-lived tokens as per Kubernetes guidance .
I'm using AKS and don't want to change anything, can I continue
to use tasks with the Kubernetes service connection?
Our Kubernetes tasks work with any Kubernetes cluster, regardless where they are
running. The Kubernetes service connection will continue to exist.
There is no need to change anything. If you are using the Kubernetes service connection
and selected Azure Subscription during creation, you should be aware of the Kubernetes
guidance on using long-lived tokens .
I'm creating a Kubernetes Environment, and have no option to use
service connections
In case you can’t access your AKS during environment creation time, you can use an
empty environment and set the connectionType input to an Azure Resource Manager
service connection.
Commands
The command input accepts kubectl commands .
YAML
- task: Kubernetes@1
displayName: kubectl apply using arguments
inputs:
connectionType: Azure Resource Manager
azureSubscriptionEndpoint: $(azureSubscriptionEndpoint)
azureResourceGroup: $(azureResourceGroup)
kubernetesCluster: $(kubernetesCluster)
command: apply
arguments: -f mhc-aks.yaml
This YAML example demonstrates the use of a configuration file with the apply
command:
YAML
- task: Kubernetes@1
displayName: kubectl apply using configFile
inputs:
connectionType: Azure Resource Manager
azureSubscriptionEndpoint: $(azureSubscriptionEndpoint)
azureResourceGroup: $(azureResourceGroup)
kubernetesCluster: $(kubernetesCluster)
command: apply
useConfigurationFile: true
configuration: mhc-aks.yaml
This YAML example shows the use of how to use the scale command to decrease the
number of replicas in a deployment to 0.
YAML
- task: Kubernetes@1
displayName: 'Scale down deployment $(k8sDeployment) to 0'
inputs:
connectionType: 'Kubernetes Service Connection'
kubernetesServiceEndpoint: $(kubernetesServiceConnection)
command: 'scale'
arguments: 'deployment/$(k8sDeployment) --replicas=0'
namespace: $(namespace)
Secrets
Kubernetes objects of type secret are intended to hold sensitive information such as
passwords, OAuth tokens, and ssh keys. Putting this information in a secret is safer and
more flexible than putting it verbatim in a pod definition or in a Docker image. Azure
Pipelines simplifies the addition of ImagePullSecrets to a service account, or setting up
of any generic secret, as described below.
ImagePullSecret
This YAML example demonstrates the setting up of ImagePullSecrets:
YAML
- task: Kubernetes@1
displayName: kubectl apply for secretType dockerRegistry
inputs:
azureSubscriptionEndpoint: $(azureSubscriptionEndpoint)
azureResourceGroup: $(azureResourceGroup)
kubernetesCluster: $(kubernetesCluster)
command: apply
arguments: -f mhc-aks.yaml
secretType: dockerRegistry
containerRegistryType: Azure Container Registry
azureSubscriptionEndpointForSecrets: $(azureSubscriptionEndpoint)
azureContainerRegistry: $(azureContainerRegistry)
secretName: mysecretkey2
forceUpdate: true
Generic Secrets
This YAML example creates generic secrets from literal values specified for the
secretArguments input:
YAML
- task: Kubernetes@1
displayName: secretType generic with literal values
inputs:
azureSubscriptionEndpoint: $(azureSubscriptionEndpoint)
azureResourceGroup: $(azureResourceGroup)
kubernetesCluster: $(kubernetesCluster)
command: apply
arguments: -f mhc-aks.yaml
secretType: generic
secretArguments: --from-literal=contoso=5678
secretName: mysecretkey
Pipeline variables can be used to pass arguments for specifying literal values, as shown
here:
YAML
- task: Kubernetes@1
displayName: secretType generic with pipeline variables
inputs:
azureSubscriptionEndpoint: $(azureSubscriptionEndpoint)
azureResourceGroup: $(azureResourceGroup)
kubernetesCluster: $(kubernetesCluster)
command: apply
arguments: -f mhc-aks.yaml
secretType: generic
secretArguments: --from-literal=contoso=$(contosovalue)
secretName: mysecretkey
ConfigMap
ConfigMaps allow you to decouple configuration artifacts from image content to
maintain portability for containerized applications.
YAML
- task: Kubernetes@1
displayName: kubectl apply
inputs:
configMapName: myconfig
useConfigMapFile: true
configMapFile: src/configmap
This YAML example creates a ConfigMap by specifying the literal values directly as the
configMapArguments input, and setting forceUpdate to true:
YAML
- task: Kubernetes@1
displayName: configMap with literal values
inputs:
azureSubscriptionEndpoint: $(azureSubscriptionEndpoint)
azureResourceGroup: $(azureResourceGroup)
kubernetesCluster: $(kubernetesCluster)
command: apply
arguments: -f mhc-aks.yaml
secretType: generic
secretArguments: --from-literal=contoso=$(contosovalue)
secretName: mysecretkey4
configMapName: myconfig
forceUpdateConfigMap: true
configMapArguments: --from-literal=myname=contoso
You can use pipeline variables to pass literal values when creating ConfigMap, as shown
here:
YAML
- task: Kubernetes@1
displayName: configMap with pipeline variables
inputs:
azureSubscriptionEndpoint: $(azureSubscriptionEndpoint)
azureResourceGroup: $(azureResourceGroup)
kubernetesCluster: $(kubernetesCluster)
command: apply
arguments: -f mhc-aks.yaml
secretType: generic
secretArguments: --from-literal=contoso=$(contosovalue)
secretName: mysecretkey4
configMapName: myconfig
forceUpdateConfigMap: true
configMapArguments: --from-literal=myname=$(contosovalue)
Troubleshooting
Requirements
ノ Expand table
Requirement Description
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Feedback
Was this page helpful? Yes No
Use this task to deploy, configure, or update a Kubernetes cluster in Azure Container
Service by running kubectl commands.
Syntax
# Kubectl v0
# Deploy, configure, update a Kubernetes cluster in Azure Container Service
by running kubectl commands.
- task: Kubernetes@0
inputs:
#kubernetesServiceConnection: # string. Alias:
kubernetesServiceEndpoint. Kubernetes service connection.
#namespace: # string. Namespace.
# Commands
#command: # 'apply' | 'create' | 'delete' | 'exec' | 'expose' | 'get' |
'logs' | 'run' | 'set' | 'top'. Command.
#useConfigurationFile: false # boolean. Use Configuration files.
Default: false.
#configuration: # string. Required when useConfigurationFile = true.
Configuration file.
#arguments: # string. Arguments.
# Secrets
secretType: 'dockerRegistry' # 'dockerRegistry' | 'generic'. Required.
Type of secret. Default: dockerRegistry.
#secretArguments: # string. Optional. Use when secretType = generic.
Arguments.
containerRegistryType: 'Azure Container Registry' # 'Azure Container
Registry' | 'Container Registry'. Required when secretType = dockerRegistry.
Container Registry type. Default: Azure Container Registry.
#dockerRegistryConnection: # string. Alias: dockerRegistryEndpoint.
Optional. Use when secretType = dockerRegistry && containerRegistryType =
Container Registry. Docker Registry service connection.
#azureSubscription: # string. Alias: azureSubscriptionEndpoint.
Optional. Use when secretType = dockerRegistry && containerRegistryType =
Azure Container Registry. Azure subscription.
#azureContainerRegistry: # string. Optional. Use when secretType =
dockerRegistry && containerRegistryType = Azure Container Registry. Azure
Container Registry.
#secretName: # string. Secret name.
#forceUpdate: true # boolean. Force update secret. Default: true.
# ConfigMaps
#configMapName: # string. ConfigMap name.
#forceUpdateConfigMap: false # boolean. Force update configmap. Default:
false.
#useConfigMapFile: false # boolean. Use file. Default: false.
#configMapFile: # string. Required when useConfigMapFile = true.
ConfigMap file.
#configMapArguments: # string. Optional. Use when useConfigMapFile =
false. Arguments.
# Advanced
#versionOrLocation: 'version' # 'version' | 'location'. Kubectl.
Default: version.
#versionSpec: '1.7.0' # string. Optional. Use when versionOrLocation =
version. Version spec. Default: 1.7.0.
#checkLatest: false # boolean. Optional. Use when versionOrLocation =
version. Check for latest version. Default: false.
#specifyLocation: # string. Required when versionOrLocation = location.
Path to Kubectl.
#workingDirectory: '$(System.DefaultWorkingDirectory)' # string. Alias:
cwd. Working directory. Default: $(System.DefaultWorkingDirectory).
# Output
#outputFormat: 'json' # 'json' | 'yaml'. Output format. Default: json.
#kubectlOutput: # string. Output variable name.
Inputs
kubernetesServiceConnection - Kubernetes service connection
namespace - Namespace
string .
Specifies the namespace for the kubectl command by using the –namespace flag. If the
namespace is not provided, the commands will run in the default namespace.
command - Command
string . Allowed values: apply , create , delete , exec , expose , get , logs , run , set , top .
Use Kubernetes configuration file with the kubectl command. Filename, directory, or
URL to Kubernetes configuration files can also be provided.
configuration - Configuration file
string . Required when useConfigurationFile = true .
Specifies the filename, directory, or URL to kubernetes configuration files that is used
with the commands.
arguments - Arguments
string .
secretArguments - Arguments
string . Optional. Use when secretType = generic .
Specifies keys and literal values to insert in secret. For example, --from-
literal=key1=value1 or --from-literal=key2="top secret" .
Select a Container registry type. The task can use Azure Subscription details to work with
an Azure Container registry. Other standard Container registries are also supported.
Specifies the Azure Resource Manager subscription, which contains Azure Container
Registry.
7 Note
To configure a new service connection, select the Azure subscription from the list
and click Authorize . If your subscription is not listed or if you want to use an
existing Service Principal, you can setup an Azure service connection using the Add
or Manage buttons.
Specifies an Azure Container Registry which is used for pulling container images and
deploying applications to the Kubernetes cluster. Required for commands that need to
authenticate with a registry.
string .
Name of the secret. You can use this secret name in the Kubernetes YAML configuration
file.
Delete the secret if it exists and create a new one with updated values.
configMapName - ConfigMap name
string .
ConfigMaps allow you to decouple configuration artifacts from image content to keep
containerized applications portable.
Delete the configmap if it exists and create a new one with updated values.
configMapArguments - Arguments
Specifies keys and literal values to insert in configMap .For example, --from-
literal=key1=value1 or --from-literal=key2="top secret" .
versionOrLocation - Kubectl
string . Allowed values: version , location (Specify location). Default value: version .
kubectl is a command line interface for running commands against Kubernetes clusters.
Specifies the Version Spec of the version to get. Examples: 1.7.0 , 1.x.0 , 4.x.0 , 6.10.0 ,
>=6.10.0 .
checkLatest - Check for latest version
Always checks online for the latest available version (stable.txt) that satisfies the version
spec. This is typically false unless you have a specific scenario to always get latest. This
will cause it to incur download costs when potentially not necessary, especially with the
hosted build pool.
Output format.
Output variables
None.
Requirements
ノ Expand table
Requirement Description
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Feedback
Was this page helpful? Yes No
Use this task for installing a specific version of kubectl binary on agents.
Syntax
YAML
Inputs
kubectlVersion - Kubectl Version Spec
Specifies the version of kubectl to install. The acceptable values are latest or any
semantic version string, e.g. 1.15.0 .
Output variables
None.
Remarks
This task is used for installing a specific version of kubectl binary on agents.
Examples
The following YAML example showcases the installation of latest version of kubectl
binary on the agent:
YAML
- task: KubectlInstaller@0
displayName: Kubectl installer
inputs:
kubectlVersion: latest
The following YAML example demonstrates the use of an explicit version string rather
than installing the latest version available at the time of task execution:
YAML
- task: KubectlInstaller@0
displayName: Kubectl installer
inputs:
kubectlVersion: 1.15.0
Requirements
ノ Expand table
Requirement Description
Demands None
Capabilities Running this task satisfies the following demands for any subsequent tasks
in the same job: Kubectl
Command Any
restrictions
Syntax
YAML
Inputs
kubeloginVersion - kubelogin version
The version of kubelogin to use, for example 0.0.30 , or latest to use the latest version.
For more information about kubelogin versions, see kubelogin releases .
Output variables
None.
Remarks
The kubelogin installer task acquires the specified version of kubelogin from the
internet or the tools cache and adds it to the PATH of the agent (hosted or private). Use
this task to change the version of kubelogin used in subsequent tasks like
KubernetesManifest@1, HelmDeploy@0, AzureFunctionOnKubernetes@1, and
Kubernetes@1.
The tool installer approach also allows you to decouple from the agent update cycles. If
the kubelogin version you are looking for is missing from the agent (hosted or private),
then you can use KubeloginInstaller@0 to get the right version installed on the agent.
Examples
The following example shows how to install the latest version of kubelogin. The default
value for kubeloginVersion is latest , so you can omit the kubeloginVersion input if
desired.
yml
- task: KubeloginInstaller@0
yml
- task: KubeloginInstaller@0
inputs:
kubeloginVersion: 'latest' # or a specific version like '0.0.30'
Requirements
ノ Expand table
Requirement Description
Demands None
Capabilities Running this task satisfies the following demands for any subsequent tasks
in the same job: Kubelogin
Command Any
restrictions
See also
Non-interactive sign-in with kubelogin
Feedback
Was this page helpful? Yes No
Use this task to pause deployment in a release pipeline and wait for manual
intervention.
Syntax
YAML
# Manual intervention v8
# Pause deployment and wait for manual intervention.
- task: ManualIntervention@8
inputs:
#instructions: # string. Instructions.
#emailRecipients: # string. Notify users.
#onTimeout: 'reject' # 'reject' | 'resume'. On timeout. Default: reject.
Inputs
instructions - Instructions
string .
Specifies the instructions that are shown to the user when resuming or rejecting the
manual intervention. Based on these instructions, the user will make an informed
decision about this manual intervention.
string .
Sends a manual intervention pending email to specific users (or groups). Only users with
manage deployment permission can act on a manual intervention.
onTimeout - On timeout
Automatically rejects or resumes the manual intervention after it is pending for the
specified timeout, or 60 days, whichever is earlier.
Task control options
All tasks have control options in addition to their task inputs. For more information, see
Control options and common task properties.
Output variables
None.
Remarks
Use this task in a release pipeline to pause an active deployment within a stage. This is
typically executed to perform various manual steps or actions and then the automated
deployment tasks are resumed.
7 Note
This task can only be used in an agentless job and is intended for use in a classic
release pipeline. This article refers to classic pipelines. For YAML usage, see Manual
Validation task.
The Manual Intervention task does not perform deployment actions directly. Instead, it
allows you to pause an active deployment within a stage, typically to perform various
manual steps or actions, and then the automated deployment tasks are resumed. For
example, the user may need to edit the details of the current release before continuing
(perhaps by entering the values for custom variables used by the tasks in the release).
7 Note
You can use built-in and custom variables to generate portions of your instructions.
When the Manual Intervention task is activated during a deployment, it sets the
deployment state to IN PROGRESS. A message bar is displayed with a link that opens
the Manual Intervention dialog, which contains the instructions. After carrying out the
manual steps, the administrator or user can choose to resume the deployment or reject
it. Users with Manage deployment permission on the stage can resume or reject the
manual intervention.
For more information about using this task, see Approvals and gates overview.
Requirements
ノ Expand table
Requirement Description
Runs on Server
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Feedback
Was this page helpful? Yes No
Use this task to pause a YAML pipeline run to wait for manual interaction.
Syntax
YAML
# Manual validation v0
# [PREVIEW] Pause a pipeline run to wait for manual interaction. Works only
with YAML pipelines.
- task: ManualValidation@0
inputs:
notifyUsers: # string. Required. Notify users.
#instructions: # string. Instructions.
#onTimeout: 'reject' # 'reject' | 'resume'. On timeout. Default: reject.
Inputs
notifyUsers - Notify users
string . Required.
Sends a manual validation pending email to specific users (or groups). Only users with
queue build permission can act on a manual validation. You can send an email to a
group using the [org name]\group name syntax.
This task input is required, but you can specify an empty string if you don't want to
notify anyone, for example during a test run: notifyUsers: '' .
instructions - Instructions
string .
Specifies the instructions that are shown to the user when resuming or rejecting the
manual intervention. Based on these instructions, the user will make an informed
decision about this manual intervention.
onTimeout - On timeout
string . Allowed values: reject , resume . Default value: reject .
Automatically rejects or resumes this manual validation after it is pending for the
specified timeout, or 30 days, whichever is earlier.
Output variables
None.
Remarks
Use this task in a YAML pipeline to pause a run within a stage. This is typically executed
to perform various manual steps or actions and then the run is resumed or rejected.
) Important
This task is only supported in YAML pipelines and can only be used in an agentless
job of a YAML pipeline.
The Manual Validation task allows you to pause a pipeline run within a stage, typically
to perform some manual steps or actions, and then continue with the pipeline. For
example, the user may need to manually validate certain deployment configurations
before the pipeline starts a long running computational intensive job.
You can specify the timeout value for the task using the optional timeoutInMinutes
parameter, available in the common task properties.
7 Note
For the task to run completely, the timeoutInMinutes value of the job ( default = 60
minutes ) containing this task should be higher than the timeoutInMinutes value of
Tip
You can use variables to specify email addresses in the notifyUsers parameter.
When the Manual Validation task is activated during a pipeline, it displays a message bar
with a link that opens the Manual validation dialog, which contains the instructions.
After carrying out the manual steps, the administrator or user can choose to resume the
run or reject it. Users with Queue builds permission on the pipeline can resume or reject
the run.
Examples
YAML
jobs:
- job: waitForValidation
displayName: Wait for external validation
pool: server
timeoutInMinutes: 4320 # job times out in 3 days
steps:
- task: ManualValidation@0
timeoutInMinutes: 1440 # task times out in 1 day
inputs:
notifyUsers: |
[email protected]
[email protected]
instructions: 'Please validate the build configuration and resume'
onTimeout: 'resume'
This example uses timeoutInMinutes which is a common task property available in all
tasks.
Requirements
ノ Expand table
Requirement Description
Runs on Server
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Feedback
Was this page helpful? Yes No
Syntax
# Maven v4
# Build, test, and deploy with Apache Maven.
- task: Maven@4
inputs:
mavenPOMFile: 'pom.xml' # string. Required. Maven POM file. Default:
pom.xml.
#goals: 'package' # string. Goal(s). Default: package.
#options: # string. Options.
# JUnit Test Results
#publishJUnitResults: true # boolean. Publish to Azure Pipelines.
Default: true.
testResultsFiles: '**/surefire-reports/TEST-*.xml' # string. Required
when publishJUnitResults = true. Test results files. Default: **/surefire-
reports/TEST-*.xml.
#testRunTitle: # string. Optional. Use when publishJUnitResults = true.
Test run title.
#allowBrokenSymlinks: true # boolean. Alias: allowBrokenSymbolicLinks.
Optional. Use when publishJUnitResults = true. Allow broken symbolic links.
Default: true.
# Code Coverage
#codeCoverageToolOption: 'None' # 'None' | 'Cobertura' | 'JaCoCo'.
Alias: codeCoverageTool. Code coverage tool. Default: None.
#codeCoverageClassFilter: # string. Alias: classFilter. Optional. Use
when codeCoverageTool != None. Class inclusion/exclusion filters.
#codeCoverageClassFilesDirectories: # string. Alias:
classFilesDirectories. Optional. Use when codeCoverageTool = JaCoCo. Class
files directories.
#codeCoverageSourceDirectories: # string. Alias: srcDirectories.
Optional. Use when codeCoverageTool = JaCoCo. Source files directories.
#codeCoverageFailIfEmpty: false # boolean. Alias: failIfCoverageEmpty.
Optional. Use when codeCoverageTool != None. Fail when code coverage results
are missing. Default: false.
#codeCoverageRestoreOriginalPomXml: false # boolean. Alias:
restoreOriginalPomXml. Optional. Use when codeCoverageTool != None. Restore
original pom.xml after task execution. Default: false.
# Advanced
javaHomeOption: 'JDKVersion' # 'JDKVersion' | 'Path'. Alias:
javaHomeSelection. Required. Set JAVA_HOME by. Default: JDKVersion.
#jdkVersionOption: 'default' # 'default' | '1.17' | '1.11' | '1.10' |
'1.9' | '1.8' | '1.7' | '1.6'. Alias: jdkVersion. Optional. Use when
javaHomeSelection = JDKVersion. JDK version. Default: default.
#jdkDirectory: # string. Alias: jdkUserInputPath. Required when
javaHomeSelection = Path. JDK path.
#jdkArchitectureOption: 'x64' # 'x86' | 'x64'. Alias: jdkArchitecture.
Optional. Use when jdkVersion != default. JDK architecture. Default: x64.
mavenVersionOption: 'Default' # 'Default' | 'Path'. Alias:
mavenVersionSelection. Required. Maven version. Default: Default.
#mavenDirectory: # string. Alias: mavenPath. Required when
mavenVersionSelection = Path. Maven path.
#mavenSetM2Home: false # boolean. Optional. Use when
mavenVersionSelection = Path. Set M2_HOME variable. Default: false.
#mavenOptions: '-Xmx1024m' # string. Alias: mavenOpts. Set MAVEN_OPTS
to. Default: -Xmx1024m.
#mavenAuthenticateFeed: false # boolean. Alias: mavenFeedAuthenticate.
Authenticate with Artifacts feeds. Default: false.
#effectivePomSkip: false # boolean. Alias: skipEffectivePom. Skip
generating effective POM while authenticating with Artifacts feeds. Default:
false.
# Code Analysis
#sonarQubeRunAnalysis: false # boolean. Alias: sqAnalysisEnabled. Run
SonarQube or SonarCloud analysis. Default: false.
#isJacocoCoverageReportXML: false # boolean. Optional. Use when
sqAnalysisEnabled = true && codeCoverageTool = JaCoCo. Use XML Jacoco
reports for SonarQube analysis. Default: false.
#sqMavenPluginVersionChoice: 'latest' # 'latest' | 'pom'. Required when
sqAnalysisEnabled = true. SonarQube scanner for Maven version. Default:
latest.
#checkStyleRunAnalysis: false # boolean. Alias:
checkstyleAnalysisEnabled. Run Checkstyle. Default: false.
#pmdRunAnalysis: false # boolean. Alias: pmdAnalysisEnabled. Run PMD.
Default: false.
#findBugsRunAnalysis: false # boolean. Alias: findbugsAnalysisEnabled.
Run FindBugs. Default: false.
#spotBugsRunAnalysis: false # boolean. Alias: spotBugsAnalysisEnabled.
Run SpotBugs analysis. Default: false.
#spotBugsVersion: '4.5.3.0' # string. Alias: spotBugsMavenPluginVersion.
Optional. Use when spotBugsAnalysisEnabled = true. Version number. Default:
4.5.3.0.
#spotBugsGoal: 'spotbugs' # 'spotbugs' | 'check'. Optional. Use when
spotBugsAnalysisEnabled = true. The goal for the spotbugs plugin. Default:
spotbugs.
#failWhenBugsFound: true # boolean. Alias: spotBugsFailWhenBugsFound |
sbFailWhenBugsFound. Optional. Use when spotBugsAnalysisEnabled = true &&
spotBugsGoal = check. Fail when bugs are found with spotbugs:check. Default:
true.
Inputs
mavenPOMFile - Maven POM file
string . Required. Default value: pom.xml .
Specifies the relative path from the repository root to the Maven POM file. See
Introduction to the POM for more information.
goals - Goal(s)
string . Default value: package .
(Optional) Set to package to compile your code and package it into a .war file. If you
leave this argument blank, the build will fail. See Introduction to the Maven build
lifecycle for more information.
options - Options
string .
Specifies the option to publish the JUnit test results produced by the Maven build to
Azure Pipelines. Each test results file matching Test Results Files will be published as
a test run in Azure Pipelines.
If set to false , fails the build when the task finds a broken symbolic link while
publishing tests result.
Input alias: codeCoverageTool . string . Allowed values: None , Cobertura , JaCoCo . Default
value: None .
Specifies the code coverage tool. Enabling code coverage inserts the clean goal into the
Maven goals list when Maven runs.
Fails the build if code coverage did not produce any results to publish.
Code coverage modifies pom.xml to produce results. Use this option if you need to keep
the original pom.xml .
Sets JAVA_HOME either by selecting a JDK version that will be discovered during builds or
by manually entering a JDK path. If you already have Java installed on the agent
machine, you can specify it by setting up javaHomeOption as path and jdkDirectory as a
path to the JDK installed directory.
Attempts to discover the path to the selected JDK version and sets JAVA_HOME
accordingly.
Note: If running on an agent that is not hosted by Microsoft, and the requested Java
version is not the one indicated by the JAVA_HOME variable set on the agent machine, the
task will rely on the variable JAVA_HOME_{version}_{arch} (for example: JAVA_HOME_8_X64 )
to locate the necessary JDK. Ensure this variable is set on self-hosted agents for any
version and architecture of the JDK that may be requested by this parameter and/or by
jdkArchitecture .
jdkDirectory - JDK path
Specifies either the default Maven version or the version in the specified custom path.
Supplies the custom path to the Maven installation (for example: /usr/share/maven ).
feeds
Input alias: skipEffectivePom . boolean . Default value: false .
This option has changed from using version 1 of the Maven task to using the
SonarQube and SonarCloud marketplace extensions.
Enable this option to run SonarQube or SonarCloud analysis after executing goals in
the Goals field. The install or package goal should run first. Before this Maven task, you
must also add a Prepare Analysis Configuration task from one of the extensions to the
build pipeline.
Uses XML Jacoco reports for SonarQube analysis. Learn more about test reports .
release), pom (Use version declared in your pom.xml). Default value: latest .
Specifies the SonarQube Maven plugin version to use. You can use the latest version or
rely on the version in your pom.xml .
Runs the Checkstyle tool with the default Sun checks. If no Checkstyle configuration is
specified in the pom.xml file, default Sun checks are used. Results are uploaded as build
artifacts.
pmdRunAnalysis - Run PMD
Uses the PMD static analysis tool to look for bugs in the code. Results are uploaded as
build artifacts.
Uses the FindBugs static analysis tool to look for bugs in the code. Results are uploaded
as build artifacts.
Enable this option to run the SpotBugs code analysis plugin. More information about
the SpotBugs Maven plugin .
("spotbugs" - Creates a report on found bugs), check ("check" - Pipeline fails if bugs
were detected). Default value: spotbugs .
Specifies the goal of the plugin. Learn more about SpotBugs goals .
Fails when bugs are found if Check Goal is specified. Learn more about SpotBug
parameter details .
Task control options
All tasks have control options in addition to their task inputs. For more information, see
Control options and common task properties.
Output variables
None.
Remarks
Configuration of the SonarQube analysis was moved to the SonarQube or
SonarCloud extensions in the task Prepare Analysis Configuration.
) Important
) Important
If the JDK version you want to use is already installed on your agent, set
javaHomeOption to path and set the jdkDirectory to the path of the JDK version.
FAQ
Requirements
ノ Expand table
Requirement Description
Demands Self-hosted agents must have capabilities that match the following demands
to run jobs that use this task: maven
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Command Any
restrictions
See also
Maven authenticate
Publish Maven artifacts with Azure Pipelines
Java Tool Installer
Build Java apps
Feedback
Was this page helpful? Yes No
Use this task to build, test, and deploy with Apache Maven.
Syntax
# Maven v3
# Build, test, and deploy with Apache Maven.
- task: Maven@3
inputs:
mavenPOMFile: 'pom.xml' # string. Required. Maven POM file. Default:
pom.xml.
#goals: 'package' # string. Goal(s). Default: package.
#options: # string. Options.
# JUnit Test Results
#publishJUnitResults: true # boolean. Publish to Azure Pipelines.
Default: true.
testResultsFiles: '**/surefire-reports/TEST-*.xml' # string. Required
when publishJUnitResults = true. Test results files. Default: **/surefire-
reports/TEST-*.xml.
#testRunTitle: # string. Optional. Use when publishJUnitResults = true.
Test run title.
#allowBrokenSymlinks: true # boolean. Alias: allowBrokenSymbolicLinks.
Optional. Use when publishJUnitResults = true. Allow broken symbolic links.
Default: true.
# Code Coverage
#codeCoverageToolOption: 'None' # 'None' | 'Cobertura' | 'JaCoCo'.
Alias: codeCoverageTool. Code coverage tool. Default: None.
#codeCoverageClassFilter: # string. Alias: classFilter. Optional. Use
when codeCoverageTool != None. Class inclusion/exclusion filters.
#codeCoverageClassFilesDirectories: # string. Alias:
classFilesDirectories. Optional. Use when codeCoverageTool = JaCoCo. Class
files directories.
#codeCoverageSourceDirectories: # string. Alias: srcDirectories.
Optional. Use when codeCoverageTool = JaCoCo. Source files directories.
#codeCoverageFailIfEmpty: false # boolean. Alias: failIfCoverageEmpty.
Optional. Use when codeCoverageTool != None. Fail when code coverage results
are missing. Default: false.
#codeCoverageRestoreOriginalPomXml: false # boolean. Alias:
restoreOriginalPomXml. Optional. Use when codeCoverageTool != None. Restore
original pom.xml after task execution. Default: false.
# Advanced
javaHomeOption: 'JDKVersion' # 'JDKVersion' | 'Path'. Alias:
javaHomeSelection. Required. Set JAVA_HOME by. Default: JDKVersion.
#jdkVersionOption: 'default' # 'default' | '1.17' | '1.11' | '1.10' |
'1.9' | '1.8' | '1.7' | '1.6'. Alias: jdkVersion. Optional. Use when
javaHomeSelection = JDKVersion. JDK version. Default: default.
#jdkDirectory: # string. Alias: jdkUserInputPath. Required when
javaHomeSelection = Path. JDK path.
#jdkArchitectureOption: 'x64' # 'x86' | 'x64'. Alias: jdkArchitecture.
Optional. Use when jdkVersion != default. JDK architecture. Default: x64.
mavenVersionOption: 'Default' # 'Default' | 'Path'. Alias:
mavenVersionSelection. Required. Maven version. Default: Default.
#mavenDirectory: # string. Alias: mavenPath. Required when
mavenVersionSelection = Path. Maven path.
#mavenSetM2Home: false # boolean. Optional. Use when
mavenVersionSelection = Path. Set M2_HOME variable. Default: false.
#mavenOptions: '-Xmx1024m' # string. Alias: mavenOpts. Set MAVEN_OPTS
to. Default: -Xmx1024m.
#mavenAuthenticateFeed: false # boolean. Alias: mavenFeedAuthenticate.
Authenticate with Artifacts feeds. Default: false.
#effectivePomSkip: false # boolean. Alias: skipEffectivePom. Skip
generating effective POM while authenticating with Artifacts feeds. Default:
false.
# Code Analysis
#sonarQubeRunAnalysis: false # boolean. Alias: sqAnalysisEnabled. Run
SonarQube or SonarCloud analysis. Default: false.
#isJacocoCoverageReportXML: false # boolean. Optional. Use when
sqAnalysisEnabled = true && codeCoverageTool = JaCoCo. Use XML Jacoco
reports for SonarQube analysis. Default: false.
#sqMavenPluginVersionChoice: 'latest' # 'latest' | 'pom'. Required when
sqAnalysisEnabled = true. SonarQube scanner for Maven version. Default:
latest.
#checkStyleRunAnalysis: false # boolean. Alias:
checkstyleAnalysisEnabled. Run Checkstyle. Default: false.
#pmdRunAnalysis: false # boolean. Alias: pmdAnalysisEnabled. Run PMD.
Default: false.
#findBugsRunAnalysis: false # boolean. Alias: findbugsAnalysisEnabled.
Run FindBugs. Default: false.
#spotBugsRunAnalysis: false # boolean. Alias: spotBugsAnalysisEnabled.
Run SpotBugs analysis. Default: false.
#spotBugsVersion: '4.5.3.0' # string. Alias: spotBugsMavenPluginVersion.
Optional. Use when spotBugsAnalysisEnabled = true. Version number. Default:
4.5.3.0.
#spotBugsGoal: 'spotbugs' # 'spotbugs' | 'check'. Optional. Use when
spotBugsAnalysisEnabled = true. The goal for the spotbugs plugin. Default:
spotbugs.
#failWhenBugsFound: true # boolean. Alias: spotBugsFailWhenBugsFound |
sbFailWhenBugsFound. Optional. Use when spotBugsAnalysisEnabled = true &&
spotBugsGoal = check. Fail when bugs are found with spotbugs:check. Default:
true.
Inputs
mavenPOMFile - Maven POM file
string . Required. Default value: pom.xml .
Specifies the relative path from the repository root to the Maven POM file. See
Introduction to the POM for more information.
goals - Goal(s)
string . Default value: package .
(Optional) Set to package to compile your code and package it into a .war file. If you
leave this argument blank, the build will fail. See Introduction to the Maven build
lifecycle for more information.
options - Options
string .
Specifies the option to publish the JUnit test results produced by the Maven build to
Azure Pipelines. Each test results file matching Test Results Files will be published as
a test run in Azure Pipelines.
If set to false , fails the build when the task finds a broken symbolic link while
publishing tests result.
Input alias: codeCoverageTool . string . Allowed values: None , Cobertura , JaCoCo . Default
value: None .
Specifies the code coverage tool. Enabling code coverage inserts the clean goal into the
Maven goals list when Maven runs.
Fails the build if code coverage did not produce any results to publish.
Code coverage modifies pom.xml to produce results. Use this option if you need to keep
the original pom.xml .
Sets JAVA_HOME either by selecting a JDK version that will be discovered during builds or
by manually entering a JDK path. If you already have Java installed on the agent
machine, you can specify it by setting up javaHomeOption as path and jdkDirectory as a
path to the JDK installed directory.
Attempts to discover the path to the selected JDK version and sets JAVA_HOME
accordingly.
Note: If running on an agent that is not hosted by Microsoft, and the requested Java
version is not the one indicated by the JAVA_HOME variable set on the agent machine, the
task will rely on the variable JAVA_HOME_{version}_{arch} (for example: JAVA_HOME_8_X64 )
to locate the necessary JDK. Ensure this variable is set on self-hosted agents for any
version and architecture of the JDK that may be requested by this parameter and/or by
jdkArchitecture .
jdkDirectory - JDK path
Specifies either the default Maven version or the version in the specified custom path.
Supplies the custom path to the Maven installation (for example: /usr/share/maven ).
feeds
Input alias: skipEffectivePom . boolean . Default value: false .
This option has changed from using version 1 of the Maven task to using the
SonarQube and SonarCloud marketplace extensions.
Enable this option to run SonarQube or SonarCloud analysis after executing goals in
the Goals field. The install or package goal should run first. Before this Maven task, you
must also add a Prepare Analysis Configuration task from one of the extensions to the
build pipeline.
Uses XML Jacoco reports for SonarQube analysis. Learn more about test reports .
release), pom (Use version declared in your pom.xml). Default value: latest .
Specifies the SonarQube Maven plugin version to use. You can use the latest version or
rely on the version in your pom.xml .
Runs the Checkstyle tool with the default Sun checks. If no Checkstyle configuration is
specified in the pom.xml file, default Sun checks are used. Results are uploaded as build
artifacts.
pmdRunAnalysis - Run PMD
Uses the PMD static analysis tool to look for bugs in the code. Results are uploaded as
build artifacts.
Uses the FindBugs static analysis tool to look for bugs in the code. Results are uploaded
as build artifacts.
Enable this option to run the SpotBugs code analysis plugin. More information about
the SpotBugs Maven plugin .
("spotbugs" - Creates a report on found bugs), check ("check" - Pipeline fails if bugs
were detected). Default value: spotbugs .
Specifies the goal of the plugin. Learn more about SpotBugs goals .
Fails when bugs are found if Check Goal is specified. Learn more about SpotBug
parameter details .
Task control options
All tasks have control options in addition to their task inputs. For more information, see
Control options and common task properties.
Output variables
None.
Remarks
Configuration of the SonarQube analysis was moved to the SonarQube or
SonarCloud extensions in the task Prepare Analysis Configuration.
) Important
) Important
If the JDK version you want to use is already installed on your agent, set
javaHomeOption to path and set the jdkDirectory to the path of the JDK version.
FAQ
Requirements
ノ Expand table
Requirement Description
Demands Self-hosted agents must have capabilities that match the following demands
to run jobs that use this task: maven
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Command Any
restrictions
See also
Maven authenticate
Publish Maven artifacts with Azure Pipelines
Java Tool Installer
Build Java apps
Feedback
Was this page helpful? Yes No
Use this task to build, test, and deploy with Apache Maven.
Syntax
# Maven v2
# Build, test, and deploy with Apache Maven.
- task: Maven@2
inputs:
mavenPOMFile: 'pom.xml' # string. Required. Maven POM file. Default:
pom.xml.
#goals: 'package' # string. Goal(s). Default: package.
#options: # string. Options.
# JUnit Test Results
#publishJUnitResults: true # boolean. Publish to Azure Pipelines.
Default: true.
testResultsFiles: '**/TEST-*.xml' # string. Required when
publishJUnitResults = true. Test results files. Default: **/TEST-*.xml.
#testRunTitle: # string. Optional. Use when publishJUnitResults = true.
Test run title.
#allowBrokenSymlinks: true # boolean. Alias: allowBrokenSymbolicLinks.
Optional. Use when publishJUnitResults = true. Allow broken symbolic links.
Default: true.
# Code Coverage
#codeCoverageToolOption: 'None' # 'None' | 'Cobertura' | 'JaCoCo'.
Alias: codeCoverageTool. Code coverage tool. Default: None.
#codeCoverageClassFilter: # string. Alias: classFilter. Optional. Use
when codeCoverageTool != None. Class inclusion/exclusion filters.
#codeCoverageClassFilesDirectories: # string. Alias:
classFilesDirectories. Optional. Use when codeCoverageTool = JaCoCo. Class
files directories.
#codeCoverageSourceDirectories: # string. Alias: srcDirectories.
Optional. Use when codeCoverageTool = JaCoCo. Source files directories.
#codeCoverageFailIfEmpty: false # boolean. Alias: failIfCoverageEmpty.
Optional. Use when codeCoverageTool != None. Fail when code coverage results
are missing. Default: false.
#codeCoverageRestoreOriginalPomXml: false # boolean. Alias:
restoreOriginalPomXml. Optional. Use when codeCoverageTool != None. Restore
original pom.xml after task execution. Default: false.
# Advanced
javaHomeOption: 'JDKVersion' # 'JDKVersion' | 'Path'. Alias:
javaHomeSelection. Required. Set JAVA_HOME by. Default: JDKVersion.
#jdkVersionOption: 'default' # 'default' | '1.17' | '1.11' | '1.10' |
'1.9' | '1.8' | '1.7' | '1.6'. Alias: jdkVersion. Optional. Use when
javaHomeSelection = JDKVersion. JDK version. Default: default.
#jdkDirectory: # string. Alias: jdkUserInputPath. Required when
javaHomeSelection = Path. JDK path.
#jdkArchitectureOption: 'x64' # 'x86' | 'x64'. Alias: jdkArchitecture.
Optional. Use when jdkVersion != default. JDK architecture. Default: x64.
mavenVersionOption: 'Default' # 'Default' | 'Path'. Alias:
mavenVersionSelection. Required. Maven version. Default: Default.
#mavenDirectory: # string. Alias: mavenPath. Required when
mavenVersionSelection = Path. Maven path.
#mavenSetM2Home: false # boolean. Optional. Use when
mavenVersionSelection = Path. Set M2_HOME variable. Default: false.
#mavenOptions: '-Xmx1024m' # string. Alias: mavenOpts. Set MAVEN_OPTS
to. Default: -Xmx1024m.
#mavenAuthenticateFeed: true # boolean. Alias: mavenFeedAuthenticate.
Authenticate with Artifacts feeds. Default: true.
# Code Analysis
#sonarQubeRunAnalysis: false # boolean. Alias: sqAnalysisEnabled. Run
SonarQube or SonarCloud analysis. Default: false.
#isJacocoCoverageReportXML: false # boolean. Optional. Use when
sqAnalysisEnabled = true && codeCoverageTool = JaCoCo. Use XML Jacoco
reports for SonarQube analysis. Default: false.
#sqMavenPluginVersionChoice: 'latest' # 'latest' | 'pom'. Required when
sqAnalysisEnabled = true. SonarQube scanner for Maven version. Default:
latest.
#checkStyleRunAnalysis: false # boolean. Alias:
checkstyleAnalysisEnabled. Run Checkstyle. Default: false.
#pmdRunAnalysis: false # boolean. Alias: pmdAnalysisEnabled. Run PMD.
Default: false.
#findBugsRunAnalysis: false # boolean. Alias: findbugsAnalysisEnabled.
Run FindBugs. Default: false.
Inputs
mavenPOMFile - Maven POM file
string . Required. Default value: pom.xml .
Specifies the relative path from the repository root to the Maven POM file.
goals - Goal(s)
options - Options
string .
Specifies the path and pattern of test results files to publish. Wildcards can be used.
More information about file matching patterns.
For example, **/TEST-*.xml for all XML files whose name starts with TEST- .
If no root path is specified, files are matched beneath the default working directory, the
value of which is available in the variable $(System.DefaultWorkingDirectory) . For
example, a value of **/TEST-*.xml will actually result in matching files from
$(System.DefaultWorkingDirectory)/**/TEST-*.xml .
When set to false , fails the build when the task finds a broken symbolic link while
publishing tests result.
Input alias: codeCoverageTool . string . Allowed values: None , Cobertura , JaCoCo . Default
value: None .
Fails the build if code coverage did not produce any results to publish.
Code coverage modifies pom.xml to produce results. Use this option if you need to keep
the original pom.xml .
Sets JAVA_HOME either by selecting a JDK version that will be discovered during builds or
by manually entering a JDK path.
jdkVersionOption - JDK version
Attempts to discover the path to the selected JDK version and sets JAVA_HOME
accordingly.
Uses either the default Maven version or the version in the specified custom path.
Specifies the custom path to the Maven installation (for example: /usr/share/maven ).
Automatically authenticates with Azure Artifacts feeds. If Artifacts feeds are not in use,
deselect this option for faster builds.
This option has changed from using version 1 of the Maven task to using the
SonarQube and SonarCloud marketplace extensions.
Enable this option to run SonarQube or SonarCloud analysis after executing goals in
the Goals field. The install or package goal should run first. Before this Maven task, you
must also add a Prepare Analysis Configuration task from one of the extensions to the
build pipeline.
Uses XML Jacoco reports for SonarQube analysis. Learn more about test reports .
string . Required when sqAnalysisEnabled = true . Allowed values: latest (Use latest
release), pom (Use version declared in your pom.xml). Default value: latest .
Specifies the SonarQube Maven plugin version to use. You can use the latest version or
rely on the version in your pom.xml .
Uses the PMD static analysis tool to look for bugs in the code. Results are uploaded as
build artifacts.
Uses the FindBugs static analysis tool to look for bugs in the code. Results are uploaded
as build artifacts.
Output variables
None.
Remarks
Configuration of the SonarQube analysis was moved to the SonarQube or
SonarCloud extensions in the task Prepare Analysis Configuration.
Requirements
ノ Expand table
Requirement Description
Demands Self-hosted agents must have capabilities that match the following demands
to run jobs that use this task: maven
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Command Any
restrictions
See also
Maven authenticate
Publish Maven artifacts with Azure Pipelines
Java Tool Installer
Build Java apps
Feedback
Was this page helpful? Yes No
Syntax
# Maven v1
# Build with Apache Maven.
- task: Maven@1
inputs:
mavenPOMFile: 'pom.xml' # string. Required. Maven POM file. Default:
pom.xml.
#goals: 'package' # string. Goal(s). Default: package.
#options: # string. Options.
# JUnit Test Results
#publishJUnitResults: true # boolean. Publish to TFS/Team Services.
Default: true.
testResultsFiles: '**/TEST-*.xml' # string. Required when
publishJUnitResults = true. Test Results Files. Default: **/TEST-*.xml.
#testRunTitle: # string. Optional. Use when publishJUnitResults = true.
Test Run Title.
# Code Coverage
#codeCoverageToolOption: 'None' # 'None' | 'Cobertura' | 'JaCoCo'.
Alias: codeCoverageTool. Code Coverage Tool. Default: None.
#codeCoverageClassFilter: # string. Alias: classFilter. Optional. Use
when codeCoverageTool != None. Class Inclusion/Exclusion Filters.
#codeCoverageClassFilesDirectories: # string. Alias:
classFilesDirectories. Optional. Use when codeCoverageTool = JaCoCo. Class
Files Directories.
#codeCoverageSourceDirectories: # string. Alias: srcDirectories.
Optional. Use when codeCoverageTool = JaCoCo. Source Files Directories.
#codeCoverageFailIfEmpty: false # boolean. Alias: failIfCoverageEmpty.
Optional. Use when codeCoverageTool != None. Fail When Code Coverage Results
Are Missing. Default: false.
# Advanced
javaHomeOption: 'JDKVersion' # 'JDKVersion' | 'Path'. Alias:
javaHomeSelection. Required. Set JAVA_HOME by. Default: JDKVersion.
#jdkVersionOption: 'default' # 'default' | '1.9' | '1.8' | '1.7' |
'1.6'. Alias: jdkVersion. Optional. Use when javaHomeSelection = JDKVersion.
JDK Version. Default: default.
#jdkDirectory: # string. Alias: jdkUserInputPath. Required when
javaHomeSelection = Path. JDK Path.
#jdkArchitectureOption: 'x64' # 'x86' | 'x64'. Alias: jdkArchitecture.
Optional. Use when jdkVersion != default. JDK Architecture. Default: x64.
mavenVersionOption: 'Default' # 'Default' | 'Path'. Alias:
mavenVersionSelection. Required. Maven Version. Default: Default.
#mavenDirectory: # string. Alias: mavenPath. Required when
mavenVersionSelection = Path. Maven Path.
#mavenSetM2Home: false # boolean. Optional. Use when
mavenVersionSelection = Path. Set M2_HOME variable. Default: false.
#mavenOptions: '-Xmx1024m' # string. Alias: mavenOpts. Set MAVEN_OPTS
to. Default: -Xmx1024m.
#mavenAuthenticateFeed: true # boolean. Alias: mavenFeedAuthenticate.
Authenticate built-in Maven feeds. Default: true.
# Code Analysis
#sonarQubeRunAnalysis: false # boolean. Alias: sqAnalysisEnabled. Run
SonarQube Analysis. Default: false.
#sonarQubeServiceEndpoint: # string. Alias: sqConnectedServiceName.
Required when sqAnalysisEnabled = true. SonarQube Endpoint.
#sonarQubeProjectName: # string. Alias: sqProjectName. Optional. Use
when sqAnalysisEnabled = true. SonarQube Project Name.
#sonarQubeProjectKey: # string. Alias: sqProjectKey. Optional. Use when
sqAnalysisEnabled = true. SonarQube Project Key.
#sonarQubeProjectVersion: # string. Alias: sqProjectVersion. Optional.
Use when sqAnalysisEnabled = true. SonarQube Project Version.
#sonarQubeSpecifyDB: false # boolean. Alias: sqDbDetailsRequired.
Optional. Use when sqAnalysisEnabled = true. The SonarQube server version is
lower than 5.2. Default: false.
#sonarQubeDBUrl: # string. Alias: sqDbUrl. Optional. Use when
sqDbDetailsRequired = true. Db Connection String.
#sonarQubeDBUsername: # string. Alias: sqDbUsername. Optional. Use when
sqDbDetailsRequired = true. Db Username.
#sonarQubeDBPassword: # string. Alias: sqDbPassword. Optional. Use when
sqDbDetailsRequired = true. Db User Password.
#sonarQubeIncludeFullReport: true # boolean. Alias:
sqAnalysisIncludeFullReport. Optional. Use when sqAnalysisEnabled = true.
Include full analysis report in the build summary (SQ 5.3+). Default: true.
#sonarQubeFailWhenQualityGateFails: # boolean. Alias:
sqAnalysisBreakBuildIfQualityGateFailed. Optional. Use when
sqAnalysisEnabled = true. Fail the build on quality gate failure (SQ 5.3+).
#checkStyleRunAnalysis: false # boolean. Alias:
checkstyleAnalysisEnabled. Run Checkstyle. Default: false.
#pmdRunAnalysis: false # boolean. Alias: pmdAnalysisEnabled. Run PMD.
Default: false.
#findBugsRunAnalysis: false # boolean. Alias: findbugsAnalysisEnabled.
Run FindBugs. Default: false.
Inputs
mavenPOMFile - Maven POM file
string . Required. Default value: pom.xml .
Specifies the relative path from the repository root to the Maven POM file.
goals - Goal(s)
Specifies the option to publish the JUnit test results produced by the Maven build to
TFS/Team Services. Each test results file matching Test Results Files will be published
as a test run in TFS/Team Services.
Specifies the path and pattern of the test results files to publish. For example, **/TEST-
*.xml for all XML files with a name that starts with TEST- . If no root path is specified,
files are matched beneath the default working directory, the value of which is available
in the variable $(System.DefaultWorkingDirectory) . For example, a value of **/TEST-
*.xml will actually result in matching files from
$(System.DefaultWorkingDirectory)/**/TEST-*.xml .
Input alias: codeCoverageTool . string . Allowed values: None , Cobertura , JaCoCo . Default
value: None .
Fails the build if code coverage did not produce any results to publish.
Sets JAVA_HOME either by selecting a JDK version that will be discovered during builds or
by manually entering a JDK path.
Attempts to discover the path to the selected JDK version, and sets JAVA_HOME
accordingly.
jdkDirectory - JDK Path
Uses either the default Maven version or the version in the specified custom path.
Supplies the custom path to the Maven installation (for example: /usr/share/maven ).
Runs a SonarQube analysis after executing the current goals. install or package
goals should be executed first.
If using a SonarQube server 5.1 or lower, you must specify the database connection
details.
sonarQubeDBUrl - Db Connection String
sonarQubeDBUsername - Db Username
5.3+)
Input alias: sqAnalysisIncludeFullReport . boolean . Optional. Use when
sqAnalysisEnabled = true . Default value: true .
This option will delay the build until the SonarQube analysis is completed.
This option is only available when using a SonarQube server 5.3 or above. Introduces
delays, as the build must wait for SonarQube to complete the analysis. More information
about SonarQube quality gates .
Uses the PMD static analysis tool to look for bugs in the code. Results are uploaded as
build artifacts.
Uses the FindBugs static analysis tool to look for bugs in the code. Results are uploaded
as build artifacts.
Output variables
None.
Requirements
ノ Expand table
Requirement Description
Demands Self-hosted agents must have capabilities that match the following demands
to run jobs that use this task: maven
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Command Any
restrictions
Requirement Description
See also
Maven authenticate
Publish Maven artifacts with Azure Pipelines
Java Tool Installer
Build Java apps
Feedback
Was this page helpful? Yes No
Use this task to provide credentials for Azure Artifacts feeds and external Maven
repositories.
Syntax
YAML
# Maven Authenticate v0
# Provides credentials for Azure Artifacts feeds and external maven
repositories.
- task: MavenAuthenticate@0
inputs:
#artifactsFeeds: # string. Feeds.
#mavenServiceConnections: # string. Credentials for repositories outside
this organization/collection.
Inputs
artifactsFeeds - Feeds
string .
organization/collection
string .
Output variables
None.
Remarks
Specifies the credentials for Azure Artifacts feeds and external Maven repositories in the
current user's settings.xml file.
XML
<server>
<id>feedName</id> <!-- Set this to the id of the <repository> element
inside your pom.xml file. -->
<username>AzureDevOps</username>
<password>${env.SYSTEM_ACCESSTOKEN}</password>
</server>
The access token variable can be set in your pipelines using these instructions.
Examples
Authenticate Maven feeds inside your organization
Authenticate Maven feeds outside your organization
Task definition
YAML
- task: MavenAuthenticate@0
displayName: 'Maven Authenticate'
inputs:
artifactsFeeds: MyFeedInOrg1,MyFeedInOrg2
The MavenAuthenticate task updates the settings.xml file present in the agent user's
.m2 directory located at {user.home}/.m2/settings.xml to add two entries inside the
<servers> element.
settings.xml
XML
<servers>
<server>
<id>MyFeedInOrg1</id>
<username>AzureDevOps</username>
<password>****</password>
</server>
<server>
<id>MyFeedInOrg2</id>
<username>AzureDevOps</username>
<password>****</password>
</server>
</servers>
To correctly authenticate the task, set the repositories in your project's pom.xml to the
same <id> as the name specified in the task for Maven.
pom.xml
XML
<repository>
<id>MyFeedInOrg1</id>
<url>https://pkgs.dev.azure.com/OrganizationName/ProjectName/_packaging/MyPr
ojectScopedFeed1/Maven/v1</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
XML
<repository>
<id>MyFeedInOrg1</id>
<url>https://pkgs.dev.azure.com/OrganizationName/_packaging/MyOrgScopedFeed1
/Maven/v1</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
The Artifacts feed URL may or may not contain the project. A URL for a project-scoped
feed must contain the project, and a URL for an organization-scoped feed must not
contain the project. Learn more about project-scoped feeds.
Task definition
YAML
- task: MavenAuthenticate@0
displayName: 'Maven Authenticate'
inputs:
MavenServiceConnections: central,MavenOrg
The MavenAuthenticate task updates the settings.xml file present in the agent users'
.m2 directory located at {user.home}/.m2/settings.xml to add two entries inside the
<servers> element.
settings.xml
XML
<servers>
<server>
<id>central</id>
<username>centralUsername</username>
<password>****</password>
</server>
<server>
<id>MavenOrg</id>
<username>mavenOrgUsername</username>
<password>****</password>
</server>
</servers>
To correctly authenticate the task, set the repositories in your project's pom.xml to the
same <id> as the name specified in the task for Maven.
pom.xml
XML
<repository>
<id>central</id>
<url>https://repo1.maven.org/maven2/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
Requirements
ノ Expand table
Requirement Description
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Feedback
Was this page helpful? Yes No
Use this task to test mobile app packages with Visual Studio Mobile Center.
Syntax
# Mobile Center Test v0
# Test mobile app packages with Visual Studio Mobile Center.
- task: VSMobileCenterTest@0
inputs:
app: # string. Required. Binary Application File Path.
artifactsDir: '$(Build.ArtifactStagingDirectory)/MobileCenterTest' #
string. Required. Artifacts Directory. Default:
$(Build.ArtifactStagingDirectory)/MobileCenterTest.
# Prepare Tests
#enablePrepare: true # boolean. Prepare Tests. Default: true.
framework: 'appium' # 'appium' | 'espresso' | 'calabash' | 'uitest' |
'xcuitest'. Required when enablePrepare = true. Test Framework. Default:
appium.
#appiumBuildDir: # string. Required when enablePrepare = true &&
framework = appium. Build Directory.
#espressoBuildDir: # string. Optional. Use when enablePrepare = true &&
framework = espresso. Build Directory.
#espressoTestApkPath: # string. Optional. Use when enablePrepare = true
&& framework = espresso. Test APK Path.
#calabashProjectDir: # string. Required when enablePrepare = true &&
framework = calabash. Project Directory.
#calabashConfigFile: # string. Optional. Use when enablePrepare = true
&& framework = calabash. Cucumber Config File.
#calabashProfile: # string. Optional. Use when enablePrepare = true &&
framework = calabash. Profile to run.
#calabashSkipConfigCheck: false # boolean. Optional. Use when
enablePrepare = true && framework = calabash. Skip Configuration Check.
Default: false.
#uitestBuildDir: # string. Required when enablePrepare = true &&
framework = uitest. Build Directory.
#uitestStoreFile: # string. Optional. Use when enablePrepare = true &&
framework = uitest. Store File.
#uitestStorePass: # string. Optional. Use when enablePrepare = true &&
framework = uitest. Store Password.
#uitestKeyAlias: # string. Optional. Use when enablePrepare = true &&
framework = uitest. Key Alias.
#uitestKeyPass: # string. Optional. Use when enablePrepare = true &&
framework = uitest. Key Password.
#uitestToolsDir: # string. Optional. Use when enablePrepare = true &&
framework = uitest. Test Tools Directory.
#signInfo: # string. Optional. Use when framework = calabash ||
framework = uitest. Signing Information.
#xcuitestBuildDir: # string. Optional. Use when enablePrepare = true &&
framework = xcuitest. Build Directory.
#xcuitestTestIpaPath: # string. Optional. Use when enablePrepare = true
&& framework = xcuitest. Test IPA Path.
#prepareOpts: # string. Optional. Use when enablePrepare = true.
Additional Options.
# Run Tests
#enableRun: true # boolean. Run Tests. Default: true.
credsType: 'serviceEndpoint' # 'serviceEndpoint' | 'inputs'. Required
when enableRun = true. Authentication Method. Default: serviceEndpoint.
#serverEndpoint: # string. Required when enableRun = true && credsType =
serviceEndpoint. Mobile Center Connection.
#username: # string. Required when enableRun = true && credsType =
inputs. Mobile Center Username.
#password: # string. Required when enableRun = true && credsType =
inputs. Mobile Center Password.
appSlug: # string. Required when enableRun = true. App Slug.
devices: # string. Required when enableRun = true. Devices.
#series: 'master' # string. Optional. Use when enableRun = true. Test
Series. Default: master.
#dsymDir: # string. Optional. Use when enableRun = true. dSYM Directory.
locale: 'en_US' # 'da_DK' | 'nl_NL' | 'en_GB' | 'en_US' | 'fr_FR' |
'de_DE' | 'ja_JP' | 'ru_RU' | 'es_MX' | 'es_ES' | 'user'. Required when
enableRun = true. System Language. Default: en_US.
#userDefinedLocale: # string. Optional. Use when enableRun = true &&
locale = user. Other Locale.
#loginOpts: # string. Optional. Use when enableRun = true && credsType =
inputs. Addtional Options for Login.
#runOpts: # string. Optional. Use when enableRun = true. Additional
Options for Run.
#async: false # boolean. Optional. Use when enableRun = true. Do not
wait for test result. Default: false.
# Advanced
#cliLocationOverride: # string. mobile-center CLI Location.
#debug: false # boolean. Enable Debug Output. Default: false.
Inputs
app - Binary Application File Path
string . Required.
Specifies the relative path from the repo root to the .APK or .IPA file you want to test.
Specifies the path to the APK file with Espresso tests. If a value is not set, build-dir is
used to find the APK file. Wildcards are allowed.
Specifies the profile to run. This value must exist in the Cucumber configuration file.
boolean . Optional. Use when enablePrepare = true && framework = calabash . Default
value: false .
Specifies the password for the store file. Use a new variable with its lock enabled on the
Variables tab to encrypt this value.
Specifies the alias that identifies the public/private key pair used in the store file.
Specifies the path to the directory with Xamarin UI test tools that contains test-
cloud.exe .
Specifies the path to the *.ipa file with the XCUITest tests.
Specifies the service endpoint for your Visual Studio Mobile Center connection. To
create one, click the Manage link and create a new service endpoint.
Visit Azure Mobile Center to set your password. This string can accept a variable
defined in build/release definitions as $(passwordVariable) . You may mark the variable
type as secret to secure it.
devices - Devices
string . Required when enableRun = true .
Identifies what devices this test will run against. Copy and paste this string when you
define a new test run from Mobile Center Test beacon.
Specifies the series name for organizing test runs (e.g. master , production , beta ).
dsymDir - dSYM Directory
Specifies the path to the dSYM directory, which contains iOS symbol files.
nl_NL (Dutch (Netherlands)), en_GB (English (United Kingdom)), en_US (English (United
States)), fr_FR (French (France)), de_DE (German (Germany)), ja_JP (Japanese (Japan)),
ru_RU (Russian (Russia)), es_MX (Spanish (Mexico)), es_ES (Spanish (Spain)), user
If your language isn't displayed, specify Other and enter its locale, such as en_US .
Specifies any two-letter ISO-639 language code, along with any two-letter ISO 3166
country code, in the format [language]_[country] , such as en_US .
When set to true , executes commands asynchronously and exits when tests are
uploaded without waiting for the test results.
cliLocationOverride - mobile-center CLI Location
string .
Output variables
None.
Requirements
ノ Expand table
Requirement Description
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Syntax
# MSBuild v1
# Build with MSBuild.
- task: MSBuild@1
inputs:
solution: '**/*.sln' # string. Required. Project. Default: **/*.sln.
#msbuildLocationMethod: 'version' # 'version' | 'location'. MSBuild.
Default: version.
#msbuildVersion: 'latest' # 'latest' | '17.0' | '16.0' | '15.0' | '14.0'
| '12.0' | '4.0'. Optional. Use when msbuildLocationMethod = version.
MSBuild Version. Default: latest.
#msbuildArchitecture: 'x86' # 'x86' | 'x64'. Optional. Use when
msbuildLocationMethod = version. MSBuild Architecture. Default: x86.
#msbuildLocation: # string. Optional. Use when msbuildLocationMethod =
location. Path to MSBuild.
#platform: # string. Platform.
#configuration: # string. Configuration.
#msbuildArguments: # string. MSBuild Arguments.
#clean: false # boolean. Clean. Default: false.
# Advanced
#maximumCpuCount: false # boolean. Build in Parallel. Default: false.
#restoreNugetPackages: false # boolean. Restore NuGet Packages. Default:
false.
#logProjectEvents: false # boolean. Record Project Details. Default:
false.
#createLogFile: false # boolean. Create Log File. Default: false.
#logFileVerbosity: 'normal' # 'quiet' | 'minimal' | 'normal' |
'detailed' | 'diagnostic'. Optional. Use when createLogFile = true. Log File
Verbosity. Default: normal.
Inputs
solution - Project
string . Required. Default value: **/*.sln .
If you want to build multiple projects, specify search criteria. You can use a single-folder
wildcard (*) and recursive wildcards (**). For example, **.*proj searches for all MSBuild
project ( .*proj ) files in all subdirectories.
Make sure the projects you specify are downloaded by this build pipeline. On the
Repository tab:
If you use TFVC, make sure that the project is a child of one of the mappings on
the Repository tab.
If you use Git, make sure that the project or project is in your Git repo, in a branch
that you're building.
Tip
If you are building a solution, we recommend you use the Visual Studio build task
instead of the MSBuild task.
msbuildLocationMethod - MSBuild
string . Allowed values: version , location (Specify Location). Default value: version .
17.0 (MSBuild 17.0), 16.0 (MSBuild 16.0), 15.0 (MSBuild 15.0), 14.0 (MSBuild 14.0),
12.0 (MSBuild 12.0), 4.0 (MSBuild 4.0). Default value: latest .
If the preferred version cannot be found, the latest version found is used instead. On an
macOS agent, xbuild (Mono) is used if version is lower than 15.0 .
platform - Platform
string .
Tip
you can modify the platform when you queue the build and enable building
multiple configurations.
configuration - Configuration
string .
Tip
you can modify the platform when you queue the build and enable building
multiple configurations.
string .
Specifies additional arguments passed to MSBuild (on Windows) and xbuild (on macOS).
clean - Clean
boolean . Default value: false .
Set to False if you want to make this an incremental build. This setting might reduce
your build time, especially if your codebase is large. This option has no practical effect
unless you also set the Clean repository to False . Set to True if you want to rebuild all
the code in the code projects. This is equivalent to the MSBuild /target:clean
argument. For more information, see repo options
This option is deprecated. To restore NuGet packages, add a NuGet task before the
build.
string . Optional. Use when createLogFile = true . Allowed values: quiet , minimal ,
Output variables
None.
Remarks
Should I use the Visual Studio Build task or the MSBuild
task?
If you are building a solution, in most cases you should use the Visual Studio Build task.
This task automatically:
Sets the /p:VisualStudioVersion property for you. This forces MSBuild to use a
particular set of targets that increase the likelihood of a successful build.
Specifies the MSBuild version argument.
In some cases, you might need to use the MSBuild task. For example, you should use it if
you are building code projects apart from a solution.
For a .NET app, you could specify BuildConfiguration with debug and release
values, and you could specify BuildPlatform with any CPU value.
For a C++ app, you could specify BuildConfiguration with debug and release
values, and you could specify BuildPlatform with any x86 and x64 values.
3. On the Build tab, select this step and specify the Platform and Configuration
arguments. For example:
Platform: $(BuildPlatform)
Configuration: $(BuildConfiguration)
Can I build TFSBuild.proj files?
You cannot build TFSBuild.proj files. These kinds of files are generated by TFS 2005
and TFS 2008 . These files contain tasks, and targets are supported only using XAML
builds.
Troubleshooting
This section provides troubleshooting tips for common issues that a user might
encounter when using the MSBuild task.
Build failed with the following error: An internal failure occurred while running
MSBuild
Possible causes
Troubleshooting suggestions
Possible causes
Troubleshooting suggestions
One of the available options to diagnose the issue is to take a look at the generated
logs. You can view your pipeline logs by selecting the appropriate task and job in your
pipeline run summary.
To get the logs of your pipeline execution Get logs to diagnose problems
You can also setup and download a customized verbose log to assist with your
troubleshooting:
In addition to the pipeline diagnostic logs, you can also check these other types of logs
that contain more information to help you debug and solve the problem:
If you are using a hosted build agent, you might want to try to reproduce the error
locally. This will help you to narrow down whether the failure is the result of the build
agent or the build task.
Run the same MSBuild command on your local machine using the same arguments.
Check out MSBuild command for reference.
Tip
If you can reproduce the problem on your local machine, then your next step is to
investigate the MSBuild issue.
To setup your own self-hosted agent and run the build jobs:
Some of the MSBuild errors are caused by a change in Visual Studio so you can search
on Visual Studio Developer Community to see if this issue has been reported. We also
welcome your questions, suggestions, and feedback.
Requirements
ノ Expand table
Requirement Description
Demands Self-hosted agents must have capabilities that match the following demands
to run jobs that use this task: msbuild
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Command Any
restrictions
See also
Visual Studio Build task
Feedback
Was this page helpful? Yes No
Use this task to run your scripts and make changes to your MySQL Database. There are
two ways to deploy: using a script file or writing the script in our inline editor.
7 Note
This is an early preview version. Since this task is server based, it appears on
Deployment group jobs.
Syntax
YAML
Inputs
TaskNameSelector - Deploy MySql Using
string . Allowed values: SqlTaskFile (MySQL Script File), InlineSqlTask (Inline MySQL
Specifies the full path of the script file on the automation agent or on a UNC path that is
accessible to the automation agent, such as BudgetIT\DeployBuilds\script.sql . This
string can also use predefined system variables, such as $(agent.releaseDirectory) and
a file containing SQL statements.
SqlInline - Inline MySQL Script
string . Required when TaskNameSelector = InlineSqlTask .
Specifies the server name of Database for MySQL , such as localhost . This string is the
same value that is used for Hostname in Parameters in MySQL Workbench.
string .
Specifies the name of the database. The script will create a database name if one does
not already exist.
string . Required.
This string is the same value that is used for Username in Parameters in MySQL
Workbench.
SqlPassword - Password
string . Required.
Specifies the password for MySQL Database. The password can be a variable defined in
the pipeline, such as $(password) , and may be marked as secret to secure it.
Specifies the additional options that are supported by MySQL simple SQL shell. These
options will be applied when executing the given file on the Database for MySQL.
Example: You can change to the default tab separated output format, HTML format, or
XML format. If you have problems due to insufficient memory for large result sets, use
the --quick option.
Task control options
All tasks have control options in addition to their task inputs. For more information, see
Control options and common task properties.
Output variables
None.
Remarks
Use this task to run your scripts and make changes to your MySQL Database. There are
two ways to deploy, either using a script file or writing the script in our inline editor.
7 Note
Prerequisites
MySQL Client in agent box
Examples
This example creates a sample db in MySQL.
YAML
steps:
- task: MysqlDeploymentOnMachineGroup@1
displayName: 'Deploy Using : InlineSqlTask'
inputs:
TaskNameSelector: InlineSqlTask
SqlInline: |
CREATE DATABASE IF NOT EXISTS alm;
use alm;
ServerName: localhost
SqlUsername: root
SqlPassword: P2ssw0rd
Requirements
ノ Expand table
Requirement Description
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Feedback
Was this page helpful? Yes No
Syntax
YAML
Inputs
nodeVersion - Version of runner to install
Output variables
None.
Remarks
When adopting agent releases that exclude the Node 6 task runner you may have an
occasional need to run tasks that have not been updated to use a newer Node runner.
For this scenario we provide a way to still use tasks dependent on Node End-of-Life
runners. For more information, see Node runner guidance blog post .
The following task example shows how to install the Node 6 runner just-in-time, so an
older task can successfully run.
YAML
steps:
- task: NodeTaskRunnerInstaller@0
inputs:
runnerVersion: 6
Requirements
ノ Expand table
Requirement Description
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Feedback
Was this page helpful? Yes No
Azure Pipepine Task for setting up Notation CLI, sign and verify with Notation.
Syntax
# Notation v0
# Azure Pipepine Task for setting up Notation CLI, sign and verify with
Notation.
- task: Notation@0
inputs:
command: 'install' # 'install' | 'sign' | 'verify'. Required. Command to
run. Default: install.
# Command Configuration
#isCustomVersion: false # boolean. Optional. Use when command = install.
Custom Version. Default: false.
#version: '1.1.0' # string. Required when command = install &&
isCustomVersion = false. Version. Default: 1.1.0.
#url: # string. Required when command = install && isCustomVersion =
true. Download URL.
#checksum: # string. Required when command = install && isCustomVersion
= true. Checksum.
#artifactRefs: # string. Optional. Use when command = verify || command
= sign. Artifact references.
#trustPolicy: # string. Required when command = verify. Trust Policy
File Path.
#trustStore: # string. Required when command = verify. Trust Store
Folder Path.
# Advanced Configuration
#signatureFormat: 'cose' # 'cose' | 'jws'. Optional. Use when command =
sign && command = sign || command = verify. Signature Format. Default: cose.
#allowReferrersAPI: false # boolean. Optional. Use when command = sign
|| command = verify. [Experimental] Allow Referrers API. Default: false.
# Plugin Configuration
#plugin: 'azureKeyVault' # 'azureKeyVault'. Required when command =
sign. Plugin. Default: azureKeyVault.
#akvPluginVersion: '1.1.0' # string. Required when plugin =
azureKeyVault && command = sign. Plugin Version. Default: 1.1.0.
#azurekvServiceConection: # string. Optional. Use when plugin =
azureKeyVault && command = sign. Azure Key Vault service connection.
#keyid: # string. Required when plugin = azureKeyVault && command =
sign. Key ID.
#caCertBundle: # string. Optional. Use when plugin = azureKeyVault &&
command = sign. Certificate Bundle File Path.
#selfSigned: false # boolean. Optional. Use when plugin = azureKeyVault
&& command = sign. Self-signed Certificate. Default: false.
Inputs
command - Command to run
string . Required. Allowed values: install , sign , verify . Default value: install .
install - The install command detects the current operating system and
architecture to download the corresponding Notation CLI from GitHub releases. It
also verifies the checksum of the downloaded file against the golden file in the
./data folder and adds Notation to the PATH.
sign - The sign command downloads the selected Notation plugin, validates its
checksum, and then calls on the Notation CLI to sign.
verify - The verify command transfers the trust store and trust policy from the
user's code repository to the Notation configuration folder, as required by
Notation CLI. It then invokes the Notation CLI to perform verification.
Specify true to provide a custom version of Notation for the task by specifying a
download URL to the custom version in the url property.
version - Version
string . Required when command = install && isCustomVersion = false . Default value:
1.1.0 .
checksum - Checksum
Container artifact references for signing. If not specified, the task uses the artifact
reference from the previous Docker push task. Example: <registry name>/<repository
name>@<digest> . Multiple artifact references must be comma separated.
string . Optional. Use when command = sign && command = sign || command = verify .
boolean . Optional. Use when command = sign || command = verify . Default value: false .
Use the Referrers API to sign signatures, if not supported (returns 404), fallback to the
Referrers tag schema.
plugin - Plugin
string . Required when command = sign . Allowed values: azureKeyVault (Azure Key Vault
1.1.0 .
The version of the Azure Key Vault plugin to be installed. See the notation-azure-kv
releases page for the available versions.
Select the Azure subscription for the key vault if prefer to use service connection for
authentication.
keyid - Key ID
The Key ID is the key or certificate identifier for Azure Key Vault.
The certificate bundle file with root and all intermediate certificates, starting from the
root certificate, following the order in the certificate chain.
false .
The path to the trust policy file relative to the repository. Example: ./path/to/trust-
policy.json .
The path to the directory containing the trust store relative to the repository. Example:
./path/to/truststore/ .
Output variables
None.
Remarks
The Notation task calls upon the Notation CLI to execute signing and verification
operations. Notation CLI is a tool used to sign and verify Docker container artifacts or
images. When signing an artifact, Notation signs the artifact's unique manifest
descriptor and attaches the signature to the same repository. When verifying an artifact,
Notation retrieves the signature from the repository and validates it against the
certificate in the trust store.
Prerequisites
This task requires public network access for downloading Notation CLI and
Notation Azure Key Vault plugin from Github releases.
Supported Agent OS: Linux x64/ARM64, Windows x64, macOS x64/ARM64
Requirements
ノ Expand table
Requirement Description
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Feedback
Was this page helpful? Yes No
Use this task to install and publish npm packages or to run an npm command. Supports
npmjs.com and authenticated registries like Azure Artifacts.
7 Note
The npm Authenticate task is the recommended way to authenticate with Azure
Artifacts. This task no longer takes new features and only critical bugs are
addressed.
Syntax
# npm v1
# Install and publish npm packages, or run an npm command. Supports
npmjs.com and authenticated registries like Azure Artifacts.
- task: Npm@1
inputs:
command: 'install' # 'ci' | 'install' | 'publish' | 'custom'. Required.
Command. Default: install.
#workingDir: # string. Working folder that contains package.json.
#customCommand: # string. Required when command = custom. Command and
arguments.
# Advanced
#verbose: # boolean. Optional. Use when command = install || command =
ci || command = publish. Verbose logging.
#publishPackageMetadata: true # boolean. Optional. Use when command =
publish && publishRegistry = useFeed && command = install || command = ci ||
command = publish. Publish pipeline metadata. Default: true.
# Custom registries and authentication
#customRegistry: 'useNpmrc' # 'useNpmrc' | 'useFeed'. Optional. Use when
command = install || command = ci || command = custom. Registries to use.
Default: useNpmrc.
#customFeed: # string. Required when customRegistry = useFeed && command
= install || command = ci || command = custom. Use packages from this Azure
Artifacts/TFS registry.
#customEndpoint: # string. Optional. Use when customRegistry = useNpmrc
&& command = install || command = ci || command = custom. Credentials for
registries outside this organization/collection.
# Destination registry and authentication
#publishRegistry: 'useExternalRegistry' # 'useExternalRegistry' |
'useFeed'. Optional. Use when command = publish. Registry location. Default:
useExternalRegistry.
#publishFeed: # string. Required when publishRegistry = useFeed &&
command = publish. Target registry.
#publishEndpoint: # string. Required when publishRegistry =
useExternalRegistry && command = publish. External Registry.
Inputs
command - Command
string . Required. Allowed values: ci , install , publish , custom . Default value: install .
Specifies the command and arguments, which are passed to npm for execution.
If your arguments contain double quotes ( " ), escape them with a slash ( \ ), and
surround the escaped string with double quotes ( " ).
Specifies the path to the folder containing the target package.json and .npmrc files.
Select the folder, not the file. Example: /packages/mypackage .
Specifies the registries to use. Commit a .npmrc file to your source code repository and
set its path as the value, or specify a registry from Azure Artifacts as the value.
customFeed - Use packages from this Azure Artifacts/TFS registry
string . Required when customRegistry = useFeed && command = install || command =
ci || command = custom .
Includes the selected feed in the generated .npmrc . For project-scoped feeds, use
ProjectName/FeedName or ProjectID/FeedID . For organization-scoped feeds, the value
Credentials to use for external registries located in the project's .npmrc . Leave this blank
for registries in this account/collection; the task uses the build's credentials
automatically.
Specifies a registry hosted in the account. You must have Package Management installed
and licensed to select a registry here.
boolean . Optional. Use when command = publish && publishRegistry = useFeed &&
Associates the build/release pipeline's metadata (the run # and source code
information) with the package.
Output variables
None.
Remarks
7 Note
The Project Collection Build Service and your project's Build Service identity must
be set to Contributor to publish your packages to a feed using Azure Pipelines. See
Add new users/groups for more details.
Examples
Build your Node.js app with gulp
Requirements
ノ Expand table
Requirement Description
Demands Self-hosted agents must have capabilities that match the following demands
Requirement Description
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Command Any
restrictions
Feedback
Was this page helpful? Yes No
Use this task to install and publish npm packages or to run an npm command. Supports
npmjs.com and authenticated registries like Azure Artifacts.
7 Note
The npm Authenticate task is the recommended way to authenticate with Azure
Artifacts. This task no longer takes new features and only critical bugs are
addressed.
Syntax
YAML
# npm v0
# Run an npm command. Use NpmAuthenticate@0 task for latest capabilities.
- task: Npm@0
inputs:
#cwd: # string. working folder.
command: 'install' # string. Required. npm command. Default: install.
#arguments: # string. arguments.
Inputs
cwd - working folder
string .
Specifies the working directory where the npm command is run. Defaults to the root of
the repo.
Specifies the command and arguments, which are passed to npm for execution.
If your arguments contain double quotes ( " ), escape them with a slash ( \ ), and
surround the escaped string with double quotes ( " ).
arguments - arguments
string .
Output variables
None.
Remarks
7 Note
The Project Collection Build Service and your project's Build Service identity must
be set to Contributor to publish your packages to a feed using Azure Pipelines. See
Add new users/groups for more details.
Requirements
ノ Expand table
Requirement Description
Demands Self-hosted agents must have capabilities that match the following demands
Requirement Description
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Command Any
restrictions
Feedback
Was this page helpful? Yes No
Use this task to provide npm credentials to an .npmrc file in your repository for the
scope of the build. This enables npm , as well as npm task runners like gulp and Grunt, to
authenticate with private registries.
Syntax
YAML
Inputs
workingFile - .npmrc file to authenticate
string . Required.
The path to the .npmrc file that specifies the registries you want to work with. Select the
file, not the folder, such as /packages/mypackage.npmrc .
string .
The comma-separated list of npm service connection names for registries outside this
organization or collection. The specified .npmrc file must contain registry entries
corresponding to the service connections. If you only need registries in this organization
or collection, leave this blank. The build's credentials are used automatically.
Task control options
All tasks have control options in addition to their task inputs. For more information, see
Control options and common task properties.
Output variables
None.
Remarks
Use this task to provide npm credentials to an .npmrc file in your repository for the
scope of the build. This enables npm , as well as npm task runners like gulp and Grunt, to
authenticate with private registries.
YAML
- task: npmAuthenticate@0
inputs:
workingFile: $(agent.tempdirectory)/.npmrc
- script: echo ##vso[task.setvariable
variable=NPM_CONFIG_USERCONFIG]$(agent.tempdirectory)/.npmrc
- script: npm ci
workingDirectory: project1
- script: npm ci
workingDirectory: project2
Add the proxy settings to the npm configuration , either manually, by using npm
config set , or by setting environment variables prefixed with NPM_CONFIG_ .
Caution:
npm task runners may not be compatible with all methods of proxy
Specify the proxy with a command line flag when calling npm .
YAML
If your proxy requires authentication, you may need to add an additional build step to
construct an authenticated proxy URI.
YAML
Examples
Restore npm packages for your project from a registry within your organization
Restore and publish npm packages outside your organization
npmrc
npm
.npmrc
registry=https://pkgs.dev.azure.com/{organization}/_packaging/{feed}/npm/reg
istry/
always-auth=true
npm
YAML
- task: npmAuthenticate@0
inputs:
workingFile: .npmrc
- script: npm ci
# ...
- script: npm publish
.npmrc
registry=https://pkgs.dev.azure.com/{organization}/{project}/_packaging/{fee
d}/npm/registry/
@{scope}:registry=https://pkgs.dev.azure.com/{otherorganization}/_packaging/
{feed}/npm/registry/
@{otherscope}:registry=https://{thirdPartyRepository}/npm/registry/
always-auth=true
The registry URL pointing to an Azure Artifacts feed may or may not contain the project.
An URL for a project scoped feed must contain the project, and the URL for an
organization scoped feed must not contain the project. Learn more about project
scoped feeds.
npm
YAML
- task: npmAuthenticate@0
inputs:
workingFile: .npmrc
customEndpoint: OtherOrganizationNpmConnection,
ThirdPartyRepositoryNpmConnection
- script: npm ci
# ...
- script: npm publish -registry
https://pkgs.dev.azure.com/{otherorganization}/_packaging/{feed}/npm/registr
y/
of npm service connections that have been configured and authorized for use in your
pipeline, and have URLs that match those in the specified .npmrc file.
Requirements
ノ Expand table
Requirement Description
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Feedback
Was this page helpful? Yes No
Use this task to restore, pack, or push NuGet packages, or run a NuGet command. This
task supports NuGet.org and authenticated feeds like Azure Artifacts and MyGet. This
task also uses NuGet.exe and works with .NET Framework apps. For .NET Core and .NET
Standard apps, use the .NET Core task.
Syntax
YAML
# NuGet v2
# Restore, pack, or push NuGet packages, or run a NuGet command. Supports
NuGet.org and authenticated feeds like Azure Artifacts and MyGet. Uses
NuGet.exe and works with .NET Framework apps. For .NET Core and .NET
Standard apps, use the .NET Core task.
- task: NuGetCommand@2
inputs:
command: 'restore' # 'restore' | 'pack' | 'push' | 'custom'. Required.
Command. Default: restore.
restoreSolution: '**/*.sln' # string. Alias: solution. Required when
command = restore. Path to solution, packages.config, or project.json.
Default: **/*.sln.
#packagesToPush:
'$(Build.ArtifactStagingDirectory)/**/*.nupkg;!$(Build.ArtifactStagingDirect
ory)/**/*.symbols.nupkg' # string. Alias: searchPatternPush. Required when
command = push. Path to NuGet package(s) to publish. Default:
$(Build.ArtifactStagingDirectory)/**/*.nupkg;!$(Build.ArtifactStagingDirecto
ry)/**/*.symbols.nupkg.
#nuGetFeedType: 'internal' # 'internal' | 'external'. Required when
command = push. Target feed location. Default: internal.
#publishVstsFeed: # string. Alias: feedPublish. Required when command =
push && nuGetFeedType = internal. Target feed.
#allowPackageConflicts: false # boolean. Optional. Use when command =
push && nuGetFeedType = internal. Allow duplicates to be skipped. Default:
false.
#publishFeedCredentials: # string. Alias: externalEndpoint. Required
when command = push && nuGetFeedType = external. NuGet server.
#packagesToPack: '**/*.csproj' # string. Alias: searchPatternPack.
Required when command = pack. Path to csproj or nuspec file(s) to pack.
Default: **/*.csproj.
#configuration: '$(BuildConfiguration)' # string. Alias:
configurationToPack. Optional. Use when command = pack. Configuration to
package. Default: $(BuildConfiguration).
#packDestination: '$(Build.ArtifactStagingDirectory)' # string. Alias:
outputDir. Optional. Use when command = pack. Package folder. Default:
$(Build.ArtifactStagingDirectory).
#arguments: # string. Required when command = custom. Command and
arguments.
# Feeds and authentication
feedsToUse: 'select' # 'select' | 'config'. Alias: selectOrConfig.
Required when command = restore. Feeds to use. Default: select.
#vstsFeed: # string. Alias: feedRestore. Optional. Use when
selectOrConfig = select && command = restore. Use packages from this Azure
Artifacts/TFS feed.
#includeNuGetOrg: true # boolean. Optional. Use when selectOrConfig =
select && command = restore. Use packages from NuGet.org. Default: true.
#nugetConfigPath: # string. Optional. Use when selectOrConfig = config
&& command = restore. Path to NuGet.config.
#externalFeedCredentials: # string. Alias: externalEndpoints. Optional.
Use when selectOrConfig = config && command = restore. Credentials for feeds
outside this organization/collection.
# Advanced
#noCache: false # boolean. Optional. Use when command = restore. Disable
local cache. Default: false.
#disableParallelProcessing: false # boolean. Optional. Use when command
= restore. Disable parallel processing. Default: false.
#restoreDirectory: # string. Alias: packagesDirectory. Optional. Use
when command = restore. Destination directory.
#verbosityRestore: 'Detailed' # 'Quiet' | 'Normal' | 'Detailed'.
Optional. Use when command = restore. Verbosity. Default: Detailed.
# Advanced
#publishPackageMetadata: true # boolean. Optional. Use when command =
push && nuGetFeedType = internal && command = push. Publish pipeline
metadata. Default: true.
#verbosityPush: 'Detailed' # 'Quiet' | 'Normal' | 'Detailed'. Optional.
Use when command = push. Verbosity. Default: Detailed.
# Pack options
#versioningScheme: 'off' # 'off' | 'byPrereleaseNumber' | 'byEnvVar' |
'byBuildNumber'. Required when command = pack. Automatic package versioning.
Default: off.
#includeReferencedProjects: false # boolean. Optional. Use when
versioningScheme = off && command = pack. Include referenced projects.
Default: false.
#versionEnvVar: # string. Required when versioningScheme = byEnvVar &&
command = pack. Environment variable.
#majorVersion: '1' # string. Alias: requestedMajorVersion. Required when
versioningScheme = byPrereleaseNumber && command = pack. Major. Default: 1.
#minorVersion: '0' # string. Alias: requestedMinorVersion. Required when
versioningScheme = byPrereleaseNumber && command = pack. Minor. Default: 0.
#patchVersion: '0' # string. Alias: requestedPatchVersion. Required when
versioningScheme = byPrereleaseNumber && command = pack. Patch. Default: 0.
#packTimezone: 'utc' # 'utc' | 'local'. Optional. Use when
versioningScheme = byPrereleaseNumber && command = pack. Time zone. Default:
utc.
#includeSymbols: false # boolean. Optional. Use when command = pack.
Create symbols package. Default: false.
#toolPackage: false # boolean. Optional. Use when command = pack. Tool
Package. Default: false.
# Advanced
#buildProperties: # string. Optional. Use when command = pack.
Additional build properties.
#basePath: # string. Optional. Use when command = pack. Base path.
#verbosityPack: 'Detailed' # 'Quiet' | 'Normal' | 'Detailed'. Optional.
Use when command = pack. Verbosity. Default: Detailed.
Inputs
command - Command
string . Required. Allowed values: restore , pack , push , custom . Default value: restore .
Specifies the NuGet command to run. Use the custom value to add arguments or to use
a different command.
Input alias: solution . string . Required when command = restore . Default value:
**/*.sln .
Specifies the path to the solution, packages.config , or project.json file that references
the packages to be restored.
Input alias: selectOrConfig . string . Required when command = restore . Allowed values:
select (Feed(s) I select here), config (Feeds in my NuGet.config). Default value: select .
Specifies a feed from Azure Artifacts and/or NuGet.org for the task to use with the
select value. Alternatively, you can commit a NuGet.config file to your source code
repository and set its path as the value using the config value.
Input alias: feedRestore . string . Optional. Use when selectOrConfig = select &&
command = restore .
Specifies the selected feed in the generated NuGet.config . You must have Package
Management installed and licensed to specify a feed here.
boolean . Optional. Use when selectOrConfig = select && command = restore . Default
value: true .
Specifies the path to the NuGet.config in your repository that determines the feeds from
which to restore packages.
Input alias: externalEndpoints . string . Optional. Use when selectOrConfig = config &&
command = restore .
Specifies the credentials to use for external registries located in the selected
NuGet.config . This is the name of your NuGet service connection. For feeds in this
organization or collection, leave this blank; the build's credentials are used
automatically.
Prevents NuGet from using packages from local machine caches when set to true .
Prevents NuGet from installing multiple packages in parallel processes when set to
true .
Specifies the folder in which packages are installed. If no folder is specified, packages
are restored into a packages/ folder alongside the selected solution, packages.config ,
or project.json .
verbosityRestore - Verbosity
string . Optional. Use when command = restore . Allowed values: Quiet , Normal ,
Input alias: searchPatternPush . string . Required when command = push . Default value:
$(Build.ArtifactStagingDirectory)/**/*.nupkg;!$(Build.ArtifactStagingDirectory)/**/
*.symbols.nupkg .
Specifies the pattern to match or path to nupkg files to be uploaded. Multiple patterns
can be separated by a semicolon.
Input alias: feedPublish . string . Required when command = push && nuGetFeedType =
internal .
Specifies a feed hosted in this account. You must have Azure Artifacts installed and
licensed to select a feed here.
Changes the version number of the subset of changed packages within a set of
continually published packages.
boolean . Optional. Use when command = push && nuGetFeedType = internal . Default
value: false .
Reports task success even if some of your packages are rejected with 409 Conflict errors.
This option is currently only available on Azure Pipelines and Windows agents. If
NuGet.exe encounters a conflict, the task will fail. This option will not work and
Input alias: externalEndpoint . string . Required when command = push && nuGetFeedType
= external .
Specifies the NuGet service connection that contains the external NuGet server’s
credentials.
verbosityPush - Verbosity
string . Optional. Use when command = push . Allowed values: Quiet , Normal , Detailed .
Input alias: searchPatternPack . string . Required when command = pack . Default value:
**/*.csproj .
Specifies the pattern that the task uses to search for csproj directories to pack.
You can separate multiple patterns with a semicolon, and you can make a pattern
negative by prefixing it with ! . Example: **\*.csproj;!**\*.Tests.csproj .
Input alias: configurationToPack . string . Optional. Use when command = pack . Default
value: $(BuildConfiguration) .
Input alias: outputDir . string . Optional. Use when command = pack . Default value:
$(Build.ArtifactStagingDirectory) .
Specifies the folder where the task creates packages. If the value is empty, the task
creates packages at the source root.
versioningScheme - Automatic package versioning
string . Required when command = pack . Allowed values: off , byPrereleaseNumber (Use
the date and time), byEnvVar (Use an environment variable), byBuildNumber (Use the
build number). Default value: off .
Applies automatic package versioning depending on the specified value. This string
cannot be used with includeReferencedProjects . The allowed values are:
byPrereleaseNumber - Use the date and time: The task will generate a SemVer -
compliant version formatted as X.Y.Z-ci-datetime , where you specify the values of
X, Y, and Z.
byEnvVar - Use an environment variable: The task will use an environment variable
that you specify and contains the version number you want to use.
byBuildNumber - Use the build number: The task will use the build number to
7 Note
boolean . Optional. Use when versioningScheme = off && command = pack . Default value:
false .
minorVersion - Minor
patchVersion - Patch
Allowed values: utc , local (Agent local time). Default value: utc .
Specifies the desired time zone used to produce the version of the package. Selecting
utc is recommended if you're using hosted build agents, as their date and time might
differ.
Specifies that the package contains sources and symbols. When used with a .nuspec
file, this creates a regular NuGet package file and the corresponding symbols package.
Determines if the output files of the project should be in the tool folder.
buildProperties - Additional build properties
string . Optional. Use when command = pack .
quotation marks.
Specifies the base path of the files defined in the nuspec file.
verbosityPack - Verbosity
string . Optional. Use when command = pack . Allowed values: Quiet , Normal , Detailed .
Specifies the command and arguments that will be passed to NuGet.exe for execution. If
NuGet 3.5 or later is used, authenticated commands like list , restore , and publish
against any feed in this organization or collection that the Project Collection Build
Service has access to will be automatically authenticated.
Output variables
None.
Remarks
) Important
The NuGet Authenticate task is the new recommended way to authenticate with
Azure Artifacts and other NuGet repositories. This task no longer takes new
features, and only critical bugs are addressed.
Use this task to install and update NuGet package dependencies, or package and
publish NuGet packages. Uses NuGet.exe and works with .NET Framework apps. For
.NET Core and .NET Standard apps, use the .NET Core task.
If your code depends on NuGet packages, make sure to add this step before your Visual
Studio Build task. Also make sure to clear the deprecated Restore NuGet Packages
checkbox in that task.
If you are working with .NET Core or .NET Standard, use the .NET Core task, which has
full support for all package scenarios and is currently supported by dotnet.
Tip
This version of the NuGet task uses NuGet 4.1.0 by default. To select a different
version of NuGet, use the Tool Installer.
Versioning schemes
For byPrereleaseNumber, the version will be set to the values you choose for the major
version, the minor version, and the patch, plus the date and time, in the format
yyyymmdd-hhmmss .
For byEnvVar, the version will be set to the value of the environment variable that has
the name specified by the versionEnvVar parameter, e.g. MyVersion (no $, just the
environment variable name). Make sure the environment variable is set to a proper
SemVer, such as 1.2.3 or 1.2.3-beta1 .
For byBuildNumber, the version will be set using the pipeline run's build number. This is
the value specified for the pipeline's name property, which gets saved to the
BUILD_BUILDNUMBER environment variable). Ensure that the build number being used
contains a proper SemVer, such as 1.0.$(Rev:r) . When using byBuildNumber, the task
will extract the dotted version, 1.2.3.4 , from the build number string, and use only that
portion. The rest of the string will be dropped. If you want to use the build number as is,
you can use byEnvVar as described above, and set versionEnvVar to BUILD_BUILDNUMBER .
Migrate from NuGetInstaller@0 or NuGetRestore@1
NuGetInstaller@0 and NuGetRestore@1 are deprecated, and you should replace them in
your pipeline with NuGetCommand@2 .
If you were using NuGetInstaller@0 with restoreMode: restore , configure the following
inputs when using NuGetCommand@2 .
ノ Expand table
command restore
If you were using NuGetInstaller@0 with restoreMode: install , configure the following
inputs when using NuGetCommand@2 .
ノ Expand table
NuGetCommand@2 Value
task input
command custom
arguments What the full install command would look like in the NuGet CLI. For
example, if you want to run the equivalent of nuget install ninject -
OutputDirectory c:\proj in your pipeline, then the arguments parameter
would be install ninject -OutputDirectory c:\proj . If you were using
the NuGetInstaller@0 nuGetRestoreArgs parameter these also now go in
arguments .
If you were using NuGetRestore@1 , configure the following inputs when using
NuGetCommand@2 .
ノ Expand table
command restore
the path to the NuGet.config file, and use packages from nuget.org.
Examples
Restore
Restore all your solutions with packages from a selected feed.
YAML
YAML
YAML
Package
Create a NuGet package in the destination folder.
YAML
# Package a project
- task: NuGetCommand@2
inputs:
command: 'pack'
packagesToPack: '**/*.csproj'
packDestination: '$(Build.ArtifactStagingDirectory)'
Push
7 Note
YAML
# Push a project
- task: NuGetCommand@2
inputs:
command: 'push'
packagesToPush: '$(Build.ArtifactStagingDirectory)/**/*.nupkg'
feedsToUse: 'config'
nugetConfigPath: '$(Build.WorkingDirectory)/NuGet.config'
# Push a project
- task: NuGetCommand@2
inputs:
command: 'push'
nuGetFeedType: 'internal'
publishVstsFeed: 'my-organization-scoped-feed'
YAML
# Push a project
- task: NuGetCommand@2
inputs:
command: 'push'
nuGetFeedType: 'internal'
publishVstsFeed: 'my-project/my-project-scoped-feed'
YAML
# Push a project
- task: NuGetCommand@2
inputs:
command: 'push'
feedsToUse: 'config'
includeNugetOrg: 'true'
Custom
Run any other NuGet command besides the default ones: pack, push, and restore.
YAML
Requirements
ノ Expand table
Requirement Description
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Feedback
Was this page helpful? Yes No
Configure NuGet tools to authenticate with Azure Artifacts and other NuGet
repositories. Requires NuGet >= 4.8.5385, dotnet >= 6, or MSBuild >= 15.8.166.59604.
Syntax
YAML
# NuGet authenticate v1
# Configure NuGet tools to authenticate with Azure Artifacts and other NuGet
repositories. Requires NuGet >= 4.8.5385, dotnet >= 6, or MSBuild >=
15.8.166.59604.
- task: NuGetAuthenticate@1
inputs:
#nuGetServiceConnections: # string. Service connection credentials for
feeds outside this organization.
#forceReinstallCredentialProvider: false # boolean. Reinstall the
credential provider even if already installed. Default: false.
Inputs
nuGetServiceConnections - Service connection credentials for feeds outside this
organization
string .
Optional. The comma-separated list of NuGet service connection names for feeds
outside this organization or collection. For feeds in this organization or collection, leave
this blank; the build's credentials are used automatically.
installed
boolean . Default value: false .
Optional. Reinstalls the credential provider to the user profile directory, even if it's
already installed. If the credential provider is already installed in the user profile, the task
determines if it is overwritten with the task-provided credential provider. This may
upgrade (or potentially downgrade) the credential provider.
Task control options
All tasks have control options in addition to their task inputs. For more information, see
Control options and common task properties.
Output variables
None.
Remarks
) Important
This task is only compatible with NuGet >= 4.8.0.5385, dotnet >= 6, or MSBuild >=
15.8.166.59604.
Upgrading to the latest stable version is recommended if you encounter any issues.
There are also known issues with the Azure Artifacts Credential Provider (installed by this
task), including artifacts-credprovider/#77 and artifacts-credprovider/#108 . If you
experience these issues, ensure you have the latest credential provider by setting the
input forceReinstallCredentialProvider to true in the NuGet Authenticate task. This
setting will also ensure your credential provider is automatically updated as issues are
resolved.
If neither of the above resolves the issue, enable Plugin Diagnostic Logging and
report the issue to NuGet and the Azure Artifacts Credential Provider .
The NuGetCommand and DotNetCoreCLI tasks require using the task to restore or push
packages, as authentication to Azure Artifacts is only configured within the lifetime of
the task. This can prevent you from restoring or pushing packages within your own
script. It may also prevent you from passing specific command line arguments to the
tool.
The NuGetAuthenticate task is the recommended way to use authenticated feeds within
a pipeline.
Instead:
myNuGetApiKey
Set the environment variable http_proxy and optionally no_proxy to your proxy
settings. See NuGet CLI environment variables for details. These variables are
commonly used variables which other non-NuGet tools (e.g. curl) may also use.
Caution:
The http_proxy and no_proxy variables are case-sensitive on Linux and Mac
operating systems and must be lowercase. Attempting to use an Azure
Pipelines variable to set the environment variable will not work, as it will be
converted to uppercase. Instead, set the environment variables on the self-
hosted agent's machine and restart the agent.
Add the proxy settings to the user-level nuget.config file, either manually or using
nuget config -set as described in the nuget.config reference documentation.
Caution:
The proxy settings (such as http_proxy ) must be added to the user-level
config. They will be ignored if specified in a different nuget.config file.
provider. These variables remain set for the lifetime of the job. When restoring or
pushing packages, a NuGet tool executes the credential provider, which uses the above
variables to determine if it should return credentials back to the tool.
Will this work for pipeline runs that are triggered from an
external fork?
No. Pipeline runs that are triggered from an external fork don't have access to the
proper secrets for internal feed authentication. Thus, it will appear like the authenticate
task is successful, but subsequent tasks that require authentication (such as Nuget push)
will fail with an error along the lines of: ##[error]The nuget command failed with exit
code(1) and error(Response status code does not indicate success: 500 (Internal
Server Error - VS800075: The project with id
642C-469A-8F58-C89F2D81FEA7)). After the Pull Request is merged into the origin, then a
YAML
- task: UseDotNet@2
displayName: Use .NET 6 SDK
inputs:
packageType: sdk
version: 6.x
Examples
nuget.config
XML
<configuration>
<packageSources>
<!--
Any Azure Artifacts feeds within your organization will automatically
be authenticated. Both dev.azure.com and visualstudio.com domains are
supported.
Project scoped feed URL includes the project, organization scoped feed
URL does not.
-->
<add key="MyProjectFeed1"
value="https://pkgs.dev.azure.com/{organization}/{project}/_packaging/{feed}
/nuget/v3/index.json" />
<add key="MyProjectFeed2"
value="https://{organization}.pkgs.visualstudio.com/{project}/_packaging/{fe
ed}/nuget/v3/index.json" />
<add key="MyOtherProjectFeed1"
value="https://pkgs.dev.azure.com/{organization}/{project}/_packaging/{feed@
view}/nuget/v3/index.json" />
<add key="MyOrganizationFeed1"
value="https://pkgs.dev.azure.com/{organization}/_packaging/{feed}/nuget/v3/
index.json" />
</packageSources>
</configuration>
nuget.exe
YAML
- task: NuGetAuthenticate@1
inputs:
nuGetServiceConnections: OtherOrganizationFeedConnection,
ThirdPartyRepositoryConnection
- task: NuGetToolInstaller@1 # Optional if nuget.exe >= 4.8.5385 is already
on the path
inputs:
versionSpec: '*'
checkLatest: true
- script: nuget restore
# ...
- script: nuget push -ApiKey AzureArtifacts -Source "MyProjectFeed1"
MyProject.*.nupkg
dotnet
YAML
- task: NuGetAuthenticate@1
inputs:
nuGetServiceConnections: OtherOrganizationFeedConnection,
ThirdPartyRepositoryConnection
- task: UseDotNet@2 # Optional if the .NET Core SDK is already installed
- script: dotnet restore
# ...
- script: dotnet nuget push --api-key AzureArtifacts --source
https://pkgs.dev.azure.com/{organization}/_packaging/{feed1}/nuget/v3/index.
json MyProject.*.nupkg
In the above examples, OtherOrganizationFeedConnection and
ThirdPartyRepositoryConnection are the names of NuGet service connections that have
been configured and authorized for use in your pipeline, and have URLs that match
those in your nuget.config or command line argument.
The package source URL pointing to an Azure Artifacts feed may or may not contain the
project. An URL for a project scoped feed must contain the project, and a URL for an
organization scoped feed must not contain the project. Learn more about project
scoped feeds.
nuget.config
XML
<configuration>
<packageSources>
<!-- Any Azure Artifacts feeds within your organization will
automatically be authenticated -->
<add key="MyProjectFeed1"
value="https://pkgs.dev.azure.com/{organization}/{project}/_packaging/{feed}
/nuget/v3/index.json" />
<add key="MyOrganizationFeed"
value="https://pkgs.dev.azure.com/{organization}/_packaging/{feed}/nuget/v3/
index.json" />
<!-- Any package source listed here whose URL matches the URL of a
service connection in nuGetServiceConnections will also be authenticated.
The key name here does not need to match the name of the service
connection. -->
<add key="OtherOrganizationFeed"
value="https://pkgs.dev.azure.com/{otherorganization}/_packaging/{feed}/nuge
t/v3/index.json" />
<add key="ThirdPartyRepository"
value="https://{thirdPartyRepository}/index.json" />
</packageSources>
</configuration>
nuget.exe
YAML
- task: NuGetAuthenticate@1
inputs:
nuGetServiceConnections: OtherOrganizationFeedConnection,
ThirdPartyRepositoryConnection
- task: NuGetToolInstaller@1 # Optional if nuget.exe >= 4.8.5385 is already
on the path
inputs:
versionSpec: '*'
checkLatest: true
- script: nuget restore
# ...
- script: nuget push -ApiKey AzureArtifacts -Source "MyProjectFeed1"
MyProject.*.nupkg
dotnet
YAML
- task: NuGetAuthenticate@1
inputs:
nuGetServiceConnections: OtherOrganizationFeedConnection,
ThirdPartyRepositoryConnection
- task: UseDotNet@2 # Optional if the .NET Core SDK is already installed
- script: dotnet restore
# ...
- script: dotnet nuget push --api-key AzureArtifacts --source
"MyProjectFeed1" MyProject.*.nupkg
of NuGet service connections that have been configured and authorized for use in your
pipeline, and have URLs that match those in your nuget.config or command line
argument.
The package source URL pointing to an Azure Artifacts feed may or may not contain the
project. An URL for a project scoped feed must contain the project, and a URL for an
organization scoped feed must not contain the project. Learn more about project
scoped feeds.
Requirements
ノ Expand table
Requirement Description
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Feedback
Was this page helpful? Yes No
This version of the task is deprecated. Use NuGetAuthenticate@1 instead. Use this task
to configure NuGet tools to authenticate with Azure Artifacts and other NuGet
repositories. Requires NuGet >= 4.8.5385, dotnet >= 2.1.400, or MSBuild >=
15.8.166.59604.
Syntax
# NuGet authenticate v0
# This version of the task is deprecated, use NuGetAuthenticateV1 instead.
Configure NuGet tools to authenticate with Azure Artifacts and other NuGet
repositories. Requires NuGet >= 4.8.5385, dotnet >= 2.1.400, or MSBuild >=
15.8.166.59604.
- task: NuGetAuthenticate@0
inputs:
#nuGetServiceConnections: # string. Service connection credentials for
feeds outside this organization.
#forceReinstallCredentialProvider: false # boolean. Reinstall the
credential provider even if already installed. Default: false.
Inputs
nuGetServiceConnections - Service connection credentials for feeds outside this
organization
string .
Optional. The comma-separated list of NuGet service connection names for feeds
outside this organization or collection. For feeds in this organization or collection, leave
this blank; the build's credentials are used automatically.
installed
boolean . Default value: false .
Optional. Reinstalls the credential provider to the user profile directory, even if it's
already installed. If the credential provider is already installed in the user profile, the task
determines if it is overwritten with the task-provided credential provider. This may
upgrade (or potentially downgrade) the credential provider.
Output variables
None.
Remarks
Use this task to configure NuGet tools to authenticate with Azure Artifacts and other
NuGet repositories. Requires NuGet >= 4.8.5385, dotnet >= 2.1.400, or MSBuild >=
15.8.166.59604.
Requirements
ノ Expand table
Requirement Description
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Feedback
Was this page helpful? Yes No
NuGet@0 is deprecated. Use the NuGetCommand 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
organization/collection, and uses NuGet 4 by default.
Syntax
# NuGet command v0
# 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 organization/collection, and uses NuGet 4 by default.
- task: NuGet@0
inputs:
command: # string. Required. Command.
#arguments: # string. Arguments.
Inputs
command - Command
string . Required.
Specifies the NuGet command to run. Set the value as Custom to add arguments or to
use a different command. The allowed values are restore , pack , custom , and push .
arguments - Arguments
string .
Specifies the command and arguments that will be passed to NuGet.exe for execution. If
NuGet 3.5 or later is used, authenticated commands like list , restore , and publish
against any feed in this organization or collection that the Project Collection Build
Service has access to will be automatically authenticated.
Output variables
None.
Requirements
ノ Expand table
Requirement Description
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Feedback
Was this page helpful? Yes No
) Important
This task is deprecated. Builds that use it will break on 11-27-2023. Please switch to
using NuGetCommand@2's restore option as soon as possible. For more
information, see Migrate from NuGetInstaller@0 or NuGetRestore@1.
Syntax
# NuGet Installer v0
# Installs or restores missing NuGet packages. Use NuGetAuthenticate@0 task
for latest capabilities.
- task: NuGetInstaller@0
inputs:
solution: '**/*.sln' # string. Required. Path to solution or
packages.config. Default: **/*.sln.
#nugetConfigPath: # string. Path to NuGet.config.
restoreMode: 'restore' # 'restore' | 'install'. Required. Installation
type. Default: restore.
#noCache: false # boolean. Disable local cache. Default: false.
#nuGetRestoreArgs: # string. NuGet arguments.
# Advanced
#verbosity: '-' # '-' | 'Quiet' | 'Normal' | 'Detailed'. Verbosity.
Default: -.
nuGetVersion: '3.3.0' # '3.3.0' | '3.5.0.1829' | '4.0.0.2283' |
'custom'. Required. NuGet Version. Default: 3.3.0.
#nuGetPath: # string. Path to NuGet.exe.
Inputs
solution - Path to solution or packages.config
Restore will restore the packages a solution depends upon, and is generally what you
want.
Install will install packages from a packages.config file. Use this option if you want to
install a standalone tool package.
verbosity - Verbosity
string . Required. Allowed values: 3.3.0 , 3.5.0.1829 (3.5.0), 4.0.0.2283 (4.0.0), custom .
string .
Output variables
None.
Requirements
ノ Expand table
Requirement Description
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Feedback
Was this page helpful? Yes No
NuGetPackager@0 is 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
organization/collection, and uses NuGet 4 by default.
Syntax
# NuGet packager v0
# 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 organization/collection, and uses NuGet 4 by default.
- task: NuGetPackager@0
inputs:
searchPattern: '**\*.csproj' # string. Required. Path to csproj or
nuspec file(s) to pack. Default: **\*.csproj.
#outputdir: # string. Package Folder.
# Pack options
#includeReferencedProjects: false # boolean. Include referenced
projects. Default: false.
versionByBuild: 'false' # 'false' | 'byPrereleaseNumber' | 'byEnvVar' |
'true'. Required. Automatic package versioning. Default: false.
#versionEnvVar: # string. Required when versionByBuild = byEnvVar.
Environment variable.
#requestedMajorVersion: '1' # string. Required when versionByBuild =
byPrereleaseNumber. Major. Default: 1.
#requestedMinorVersion: '0' # string. Required when versionByBuild =
byPrereleaseNumber. Minor. Default: 0.
#requestedPatchVersion: '0' # string. Required when versionByBuild =
byPrereleaseNumber. Patch. Default: 0.
# Advanced
#configurationToPack: '$(BuildConfiguration)' # string. Configuration to
Package. Default: $(BuildConfiguration).
#buildProperties: # string. Additional build properties.
#nuGetAdditionalArgs: # string. NuGet Arguments.
#nuGetPath: # string. Path to NuGet.exe.
Inputs
searchPattern - Path to csproj or nuspec file(s) to pack
string . Required. Default value: **\*.csproj .
The pattern that the task uses to search for csproj or nuspec files to pack.
You can separate multiple patterns with a semicolon, and you can make a pattern
negative by prefixing it with -: . Example: **\*.csproj;-:**\*.Tests.csproj .
string .
The folder where the task creates packages. If this string is empty, packages will be
created in the folder where the csproj or nuspec file is located.
string . Required. Allowed values: false (Off), byPrereleaseNumber (Use the date and
time), byEnvVar (Use an environment variable), true (Use the build number). Default
value: false .
Applies automatic package versioning depending on the specified value. This string
cannot be used with includeReferencedProjects . The allowed values are:
byPrereleaseNumber - Use the date and time: The task will generate a SemVer -
compliant version formatted as X.Y.Z-ci-datetime , where you specify the values of
X, Y, and Z.
byEnvVar - Use an environment variable: The task will use an environment variable
that you specify and contains the version number you want to use.
true - Use the build number: The task will use the build number to version the
package.
7 Note
requestedMajorVersion - Major
requestedMinorVersion - Minor
string . Required when versionByBuild = byPrereleaseNumber . Default value: 0 .
requestedPatchVersion - Patch
The additional arguments passed to NuGet.exe pack . Learn more about using the pack
command for NuGet CLI to create NuGet packages.
Output variables
None.
Requirements
ノ Expand table
Requirement Description
Demands Self-hosted agents must have capabilities that match the following demands
to run jobs that use this task: Cmd
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Command Any
restrictions
NuGetPublisher@0 is 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
organization/collection, and uses NuGet 4 by default.
Syntax
# NuGet publisher v0
# 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 organization/collection, and uses NuGet 4 by default.
- task: NuGetPublisher@0
inputs:
searchPattern:
'**/*.nupkg;-:**/packages/**/*.nupkg;-:**/*.symbols.nupkg' # string.
Required. Path/Pattern to nupkg. Default:
**/*.nupkg;-:**/packages/**/*.nupkg;-:**/*.symbols.nupkg.
nuGetFeedType: 'external' # 'external' | 'internal'. Required. Feed
type. Default: external.
connectedServiceName: # string. Required when nuGetFeedType = external.
NuGet Service Connection.
#feedName: # string. Required when nuGetFeedType = internal. Internal
Feed URL.
# Advanced
#nuGetAdditionalArgs: # string. NuGet Arguments.
#verbosity: '-' # '-' | 'Quiet' | 'Normal' | 'Detailed'. Verbosity.
Default: -.
nuGetVersion: '3.3.0' # '3.3.0' | '3.5.0.1829' | '4.0.0.2283' |
'custom'. Required. NuGet Version. Default: 3.3.0.
#nuGetPath: # string. Path to NuGet.exe.
#continueOnEmptyNupkgMatch: false # boolean. Continue if no packages
match the "Path/Pattern to nupkg". Default: false.
Inputs
searchPattern - Path/Pattern to nupkg
**/*.nupkg;-:**/packages/**/*.nupkg;-:**/*.symbols.nupkg .
The pattern that the task uses to match or path to nupkg files to be uploaded. Multiple
patterns can be separated by a semicolon.
string . Required. Allowed values: external (External NuGet Feed), internal (Internal
Specifies the NuGet server generic service connection. Set the key Password/Token Key
field to your NuGet API key.
string .
The additional arguments passed to NuGet.exe push . Learn more about the push
command in the NuGet CLI.
verbosity - Verbosity
nupkg"
boolean . Default value: false .
Continues the task instead of failing the task if no packages match the searchPattern
string.
Output variables
None.
Requirements
ノ Expand table
Requirement Description
Demands Self-hosted agents must have capabilities that match the following demands
to run jobs that use this task: Cmd
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Command Any
restrictions
Feedback
Was this page helpful? Yes No
Use this task to restore NuGet packages in preparation for a Visual Studio Build step.
) Important
This task is deprecated. Builds that use it will break on 11-27-2023. Please switch to
using NuGetCommand@2's restore option as soon as possible. For more
information, see Migrate from NuGetInstaller@0 or NuGetRestore@1.
Syntax
# NuGet Restore v1
# Restores NuGet packages in preparation for a Visual Studio Build step.
- task: NuGetRestore@1
inputs:
solution: '**/*.sln' # string. Required. Path to solution,
packages.config, or project.json. Default: **/*.sln.
selectOrConfig: 'select' # 'select' | 'config'. Required. Feeds to use.
Default: select.
#feed: # string. Optional. Use when selectOrConfig = select. Use
packages from this Azure Artifacts feed.
#includeNuGetOrg: true # boolean. Optional. Use when selectOrConfig =
select. Use packages from NuGet.org. Default: true.
#nugetConfigPath: # string. Optional. Use when selectOrConfig = config.
Path to NuGet.config.
# Advanced
#noCache: false # boolean. Disable local cache. Default: false.
#packagesDirectory: # string. Destination directory.
#verbosity: 'Detailed' # '-' | 'Quiet' | 'Normal' | 'Detailed'.
Verbosity. Default: Detailed.
Inputs
solution - Path to solution, packages.config, or project.json
The path to the solution, packages.config , or project.json file that references the
packages to be restored.
selectOrConfig - Feeds to use
string . Required. Allowed values: select (Feed(s) I select here), config (Feeds in my
Specifies the feed(s) to use. Specify one feed from VSTS and/or NuGet.org using the
select value. Specify multiple feeds by committing a nuget.config file to your source
code repository and setting its path with the config value.
Specifies the path to the NuGet.config in your repository that specifies the feeds from
which to restore packages.
Prevents NuGet from using packages from local machine caches. Equivalent to the -
NoCache NuGet.exe command line argument.
string .
Specifies the folder in which packages are installed. If no folder is specified, packages
are restored into a packages/ folder alongside the selected solution, packages.config ,
or project.json . Equivalent to the -PackagesDirectory NuGet.exe command line
argument.
verbosity - Verbosity
Output variables
None.
Requirements
ノ Expand table
Requirement Description
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Feedback
Was this page helpful? Yes No
Acquires a specific version of NuGet from the internet or the tools cache and adds it to
the PATH. Use this task to change the version of NuGet used in the NuGet tasks.
Syntax
# NuGet tool installer v1
# Acquires a specific version of NuGet from the internet or the tools cache
and adds it to the PATH. Use this task to change the version of NuGet used
in the NuGet tasks.
- task: NuGetToolInstaller@1
inputs:
# Advanced
#versionSpec: # string. Version of NuGet.exe to install.
#checkLatest: false # boolean. Always check for new versions. Default:
false.
Inputs
versionSpec - Version of NuGet.exe to install
string .
A version or version range that specifies the NuGet version to make available on the
path. Use x as a wildcard. See the list of available NuGet versions .
If you want to match a pre-release version, the specification must contain a major,
minor, patch, and pre-release version from the list above. If a version isn't specified, then
one will be chosen automatically.
When this boolean is set to true , the task always checks for and downloads the latest
available version of NuGet.exe that satisfies the version spec. This option will also always
incur download time, even if the selected version of NuGet is already cached.
Enabling this option could cause unexpected build breaks when a new version of NuGet
is released.
Tip
If you're using the Microsoft-hosted agents, you should leave this set to false.
Microsoft updates the Microsoft-hosted agents on a regular basis, but they're often
slightly behind the latest version. Enabling this parameter could result in your build
spending a lot of time updating to a newer minor version.
Output variables
None.
Remarks
Use this task to find, download, and cache a specified version of NuGet and add it to
the PATH. For information on the tools cache, see the azure-pipelines-tool-lib repo.
Requirements
ノ Expand table
Requirement Description
Demands None
Capabilities Running this task satisfies the following demands for any subsequent tasks
in the same job: NuGet
Command Any
Requirement Description
restrictions
See also
For an explanation of tool installers and examples, see Tool installers.
Feedback
Was this page helpful? Yes No
Use this task to find, download, and cache a specified version of NuGet and add it to
the PATH. For information on the tools cache, see the azure-pipelines-tool-lib repo.
Syntax
YAML
Inputs
versionSpec - Version of NuGet.exe to install
string .
A version or version range that specifies the NuGet version to make available on the
path. Use x as a wildcard. See the list of available NuGet versions .
If you want to match a pre-release version, the specification must contain a major,
minor, patch, and pre-release version from the list above. If a version isn't specified, then
one will be chosen automatically.
When this boolean is set to true , the task always checks for and downloads the latest
available version of NuGet.exe that satisfies the version spec. This option will also always
incur download time, even if the selected version of NuGet is already cached.
Enabling this option could cause unexpected build breaks when a new version of NuGet
is released.
Tip
If you're using the Microsoft-hosted agents, you should leave this set to false.
Microsoft updates the Microsoft-hosted agents on a regular basis, but they're often
slightly behind the latest version. Enabling this parameter could result in your build
spending a lot of time updating to a newer minor version.
Output variables
None.
Remarks
There is a newer version of this task available at NuGetToolInstaller@1.
Requirements
ノ Expand table
Requirement Description
Demands None
Capabilities Running this task satisfies the following demands for any subsequent tasks
in the same job: NuGet
Requirement Description
Command Any
restrictions
Feedback
Was this page helpful? Yes No
Use this task to deploy, configure, or update a Kubernetes cluster in Azure Container
Service by running helm commands.
Syntax
YAML
Inputs
connectionType - Connection Type
string . Required when command != logout && command != package && command != save .
Allowed values: Azure Resource Manager , Kubernetes Service Connection , None . Default
value: Azure Resource Manager .
For more information, see Service connection in the following Remarks section.
The name of the Azure Service Connection. Specify an Azure subscription that has your
container registry.
azureResourceGroup - Resource group
string . Required when connectionType = Azure Resource Manager && command != logout
The name of the resource group within the subscription. Specify an Azure Resource
Group.
string . Required when connectionType = Azure Resource Manager && command != logout
&& command != package && command != save .
boolean . Optional. Use when connectionType = Azure Resource Manager && command !=
logout && command != package && command != save . Default value: false .
!= save .
namespace - Namespace
string . Optional. Use when command != logout && command != package && command !=
save .
The namespace on which you run the kubectl commands. If not specified, the task uses
the default namespace. Specify the Kubernetes namespace to use. You can specify the
Tiller namespace in the advanced section of the task or by passing the --tiller-
namespace option as an argument.
command - Command
string . Required. Allowed values: create , delete , expose , get , init , install , login ,
Specifies how you want to enter chart information. You can either provide the name of
the chart or folder/file path to the chart.
The name of the chart reference to install. This can be a url or a chart name. For
example, if the chart name is stable/mysql , the task runs helm install stable/mysql .
The path to the chart to install. This can be a path to a packaged chart or a path to an
unpacked chart directory. For example, if you specify ./redis , the task runs helm
install ./redis . If you're consuming a chart that's published as an artifact, then the
Input alias: version . string . Optional. Use when command == package || command ==
install || command == upgrade .
Specifies the exact chart version to install. If you don't specify the chart version, the task
installs the latest version. Set the version on the chart to this semver version.
The release name. If you don't specify the release name, the task autogenerates one for
you. The releaseName input is only valid for install and upgrade commands.
Specifies values on the command line. This input can specify multiple or separate values
with commas: key1=val1,key2=val2 .
You can also specify multiple values by delimiting them with a new line, as follows:
key1=val1
key2=val2
If you have a value that contains new lines, use the valueFile option. Otherwise, the
task treats the new line as a delimiter. The task constructs the Helm command by using
these set values. For example, you can set the value using a command like the following:
helm install --set key1=val1 ./redis .
Specifies values in a YAML file or a URL. For example, specifying myvalues.yaml results in
helm install --values=myvals.yaml .
destination - Destination
string . Optional. Use when command == package . Default value:
$(Build.ArtifactStagingDirectory) .
Specifies values in a YAML file or a URL.
Specifies the canary Tiller image. Use the latest pre-release version of Tiller.
false .
If true , this input updates a Helm dependency update before installing the chart.
Updates dependencies from requirements.yaml to the charts/ directory before
packaging.
save - Save
boolean . Optional. Use when command == package . Default value: true .
Saves the packaged chart to the local chart repository when set to true.
If a release by this name doesn't already exist, this input runs an install.
force - Force
boolean . Optional. Use when command == upgrade . Default value: false .
waitForExecution - Wait
arguments - Arguments
caCert - CA certificate
string . Required when enableTls == true && command != login && command != logout
The CA cert used to issue a certificate for the Tiller and Helm client.
certificate - Certificate
string . Required when enableTls == true && command != login && command != logout
If this input is true , this task fails if any errors are written to the error pipeline, or if any
data is written to the Standard Error stream. Otherwise, the task relies on the exit code
to determine failure.
If this input is true , the task collects and publishes deployment metadata.
The file path to the chart directory in the Azure Container Registry.
Output variables
This task defines the following output variables, which you can consume in downstream
steps, jobs, and stages.
helmExitCode
The exit code emitted from the execution of specified Helm command.
helmOutput
Remarks
Use HelmDeploy@0 to deploy, configure, or update a Kubernetes cluster in Azure
Container Service by running Helm commands. Helm is a tool that streamlines
deploying and managing Kubernetes apps using a packaging format called charts.
You can define, version, share, install, and upgrade even the most complex Kubernetes
app by using Helm.
Helm helps you combine multiple Kubernetes manifests (yaml) such as service,
deployments, configmaps, and more into a single unit called Helm Charts. You
don't need to either invent or use a tokenization or a templating tool.
Helm Charts help you manage application dependencies and deploy as well as
rollback as a unit. They are also easy to create, version, publish, and share with
other partner teams.
The Helm Tool installer task can be used to install the correct version of Helm onto
the agents.
The Helm package and deploy task can be used to package the app and deploy it
to a Kubernetes cluster. You can use the task to install or update Tiller to a
Kubernetes namespace, to securely connect to Tiller over TLS for deploying charts,
or to run any Helm command such as lint.
The Helm task supports connecting to an Azure Kubernetes Service by using an
Azure service connection. You can connect to any Kubernetes cluster by using
kubeconfig or a service account.
Helm deployments can be supplemented by using the Kubectl task; for example,
create/update, imagepullsecret, and others.
Service connection
HelmDeploy@0 works with two service connection types: Azure Resource Manager and
Kubernetes Service Connection. See Examples for examples on configuring these two
connection types.
7 Note
KubeConfig
Service Account
Azure Subscription
Access to a (private) AKS cluster can be performed from a self-hosted or scale set
agent with line of sight to the cluster.
A token is created for every task that uses an Azure Resource Manager service
connection. This ensures you are connecting to Kubernetes with a short-lived
token, which is the Kubernetes recommendation .
AKS can be accessed even when local accounts are disabled.
I receive the following error message: Could not find any secret
associated with the service account. What is happening?
You are using the Kubernetes service connection with Azure Subscription option. We are
updating this method to create long-lived tokens. This is expected to be available mid-
May. However, it is recommended to start using the Azure service connection type and
not o use long-lived tokens as per Kubernetes guidance .
I'm using AKS and don't want to change anything, can I continue
to use tasks with the Kubernetes service connection?
We are updating this method to create long-lived tokens. This is expected to be
available mid-May. However, please be aware that this approach is against Kubernetes
guidance .
Our Kubernetes tasks work with any Kubernetes cluster, regardless where they are
running. The Kubernetes service connection will continue to exist.
There is no need to change anything. If you are using the Kubernetes service connection
and selected Azure Subscription during creation, you should be aware of the Kubernetes
guidance on using long-lived tokens .
In case you can’t access your AKS during environment creation time, you can use an
empty environment and set the connectionType input to an Azure Resource Manager
service connection.
Command values
The command input accepts one of the following helm commands :
create/delete/expose/get/init/install/login/logout/ls/package/rollback/upgrade.
Examples are provided in the Examples section.
Each command input maps to a set of task inputs. The commands that map to a task
input are designated in the YAML syntax block and in the task inputs table
Troubleshooting
There are some breaking changes between Helm 2 and Helm 3. One of them includes
removal of tiller, and hence helm init command is no longer supported. Remove
command: init when you use Helm 3.0+ versions.
Examples
YAML
variables:
azureSubscriptionEndpoint: Contoso
azureContainerRegistry: contoso.azurecr.io
azureResourceGroup: Contoso
kubernetesCluster: Contoso
- task: HelmDeploy@0
displayName: Helm deploy
inputs:
connectionType: Azure Resource Manager
azureSubscriptionEndpoint: $(azureSubscriptionEndpoint)
azureResourceGroup: $(azureResourceGroup)
kubernetesCluster: $(kubernetesCluster)
YAML
- task: HelmDeploy@0
displayName: Helm deploy
inputs:
connectionType: Kubernetes Service Connection
kubernetesServiceEndpoint: Contoso
Commands
The command input accepts one of the following helm commands :
create/delete/expose/get/init/install/login/logout/ls/package/rollback/upgrade.
YAML
- task: HelmDeploy@0
displayName: Helm list
inputs:
azureSubscriptionEndpoint: $(azureSubscriptionEndpoint)
azureResourceGroup: $(azureResourceGroup)
kubernetesCluster: $(kubernetesCluster)
command: ls
arguments: --all
init command
This YAML example demonstrates the init command:
YAML
- task: HelmDeploy@0
displayName: Helm init
inputs:
azureSubscriptionEndpoint: $(azureSubscriptionEndpoint)
azureResourceGroup: $(azureResourceGroup)
kubernetesCluster: $(kubernetesCluster)
command: init
upgradetiller: true
waitForExecution: true
arguments: --client-only
install command
This YAML example demonstrates the install command:
YAML
- task: HelmDeploy@0
displayName: Helm install
inputs:
azureSubscriptionEndpoint: $(azureSubscriptionEndpoint)
azureResourceGroup: $(azureResourceGroup)
kubernetesCluster: $(kubernetesCluster)
command: install
chartType: FilePath
chartPath: Application/charts/sampleapp
package command
This YAML example demonstrates the package command:
YAML
- task: HelmDeploy@0
displayName: Helm package
inputs:
command: package
chartPath: Application/charts/sampleapp
destination: $(Build.ArtifactStagingDirectory)
upgrade command
This YAML example demonstrates the upgrade command:
YAML
- task: HelmDeploy@0
displayName: Helm upgrade
inputs:
azureSubscriptionEndpoint: $(azureSubscriptionEndpoint)
azureResourceGroup: $(azureResourceGroup)
kubernetesCluster: $(kubernetesCluster)
command: upgrade
chartType: filepath
chartPath: $(Build.ArtifactStagingDirectory)/sampleapp-v0.2.0.tgz
releaseName: azuredevopsdemo
install: true
waitForExecution: false
save command
This YAML example demonstrates the save command:
YAML
- task: HelmDeploy@0
displayName: Helm save
inputs:
command: save
chartNameForACR: mycontainerregistry.azurecr.io/helm/hello-world:v1
chartPathForACR: Application/charts/sampleapp
azureSubscriptionEndpointForACR: $(azureSubscriptionEndpointForACR)
azureResourceGroupForACR: $(azureResourceGroupForACR)
azureContainerRegistry: $(azureContainerRegistry)
Generate a private-public key pair to sign the helm chart using GPG
1. Download GPG .
gpg --full-generate-key
3. You'll be prompted for the passphrase. Give the value and click ok.
4. After creating the key, you can see the list of keys which contains both private and
public using the following command.
gpg --list-secret-keys
To see the list of public keys
gpg --list-keys
5. Store the private and public keys in 2 different files with the extension gpg as
shown below.
You'll see the privatekeys.gpg file exported to the path which was mentioned
above.
You'll see the publickey.gpg file exported to the path which was mentioned above.
In Azure DevOps, save the privatekey.gpg file in the library secure files section.
Example
YAML
pool:
name: Hosted Ubuntu 1604
variables:
# The below variable should be secure
HelmKeyPassphrase: contoso@123
keyName: contoso [email protected]
azureSubscriptionEndpoint: contoso
azureResourceGroup: contoso
kubernetesCluster: contoso
steps:
- task: DownloadSecureFile@1
displayName: Download Secure file
inputs:
secureFile: privatekey.gpg
name: privateKeyRing
- task: HelmInstaller@0
displayName: Install Helm 2.12.0
inputs:
helmVersion: 2.12.0
- task: HelmDeploy@0
displayName: helm init
inputs:
azureSubscriptionEndpoint: $(azureSubscriptionEndpoint)
azureResourceGroup: $(azureResourceGroup)
kubernetesCluster: $(kubernetesCluster)
command: init
arguments: --client-only
- task: HelmDeploy@0
displayName: helm package
inputs:
command: package
chartPath: Application/charts/sampleapp
arguments: --sign --key "$(keyName)" --keyring
$(privateKeyRing.secureFilePath)
env:
HelmKeyPassphrase: $(HelmKeyPassphrase)
Requirements
ノ Expand table
Requirement Description
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Feedback
Was this page helpful? Yes No
7 Note
By default, PowerShell v2 uses PowerShell Core for Linux agents and Windows
PowerShell for Windows agents. To use the latest version of PowerShell on
Windows agents, set the pwsh parameter to true . PowerShell Core will then be
used instead.
Syntax
YAML
# PowerShell v2
# Run a PowerShell script on Linux, macOS, or Windows.
- task: PowerShell@2
inputs:
#targetType: 'filePath' # 'filePath' | 'inline'. Type. Default:
filePath.
filePath: # string. Required when targetType = filePath. Script Path.
#arguments: # string. Optional. Use when targetType = filePath.
Arguments.
#script: # string. Required when targetType = inline. Script.
# Preference Variables
#errorActionPreference: 'stop' # 'default' | 'stop' | 'continue' |
'silentlyContinue'. ErrorActionPreference. Default: stop.
#warningPreference: 'default' # 'default' | 'stop' | 'continue' |
'silentlyContinue'. WarningPreference. Default: default.
#informationPreference: 'default' # 'default' | 'stop' | 'continue' |
'silentlyContinue'. InformationPreference. Default: default.
#verbosePreference: 'default' # 'default' | 'stop' | 'continue' |
'silentlyContinue'. VerbosePreference. Default: default.
#debugPreference: 'default' # 'default' | 'stop' | 'continue' |
'silentlyContinue'. DebugPreference. Default: default.
#progressPreference: 'silentlyContinue' # 'default' | 'stop' |
'continue' | 'silentlyContinue'. ProgressPreference. Default:
silentlyContinue.
# Advanced
#failOnStderr: false # boolean. Fail on Standard Error. Default: false.
#showWarnings: false # boolean. Show warnings as Azure DevOps warnings.
Default: false.
#ignoreLASTEXITCODE: false # boolean. Ignore $LASTEXITCODE. Default:
false.
#pwsh: false # boolean. Use PowerShell Core. Default: false.
#workingDirectory: # string. Working Directory.
#runScriptInSeparateScope: false # boolean. Run script in the separate
scope. Default: false.
Inputs
targetType - Type
string . Allowed values: filePath (File Path), inline . Default value: filePath .
Specifies the type of script for the task to run: an inline script or a path to a .ps1 file.
Specifies the path of the script to execute. Must be a fully qualified path or relative to
$(System.DefaultWorkingDirectory) .
arguments - Arguments
Specifies the arguments passed to the PowerShell script. Arguments can be ordinal
parameters or named parameters. For example, -Name someName -Path -Value "Some
long string value" .
script - Script
string . Required when targetType = inline . Default value: # Write your PowerShell
Specifies the contents of the script. The maximum supported inline script length is
20000 characters. Use a script from a file if you want to use a longer script.
errorActionPreference - ErrorActionPreference
default .
When not set to Default , prepends the line $WarningPreference = 'VALUE' at the top of
your script.
informationPreference - InformationPreference
When not set to Default , prepends the line $InformationPreference = 'VALUE' at the
top of your script.
verbosePreference - VerbosePreference
string . Allowed values: default , stop , continue , silentlyContinue . Default value:
default .
When not set to Default , prepends the line $VerbosePreference = 'VALUE' at the top of
your script.
debugPreference - DebugPreference
default .
When not set to Default , prepends the line $DebugPreference = 'VALUE' at the top of
your script.
progressPreference - ProgressPreference
string . Allowed values: default , stop , continue , silentlyContinue . Default value:
silentlyContinue .
When not set to Default , prepends the line $ProgressPreference = 'VALUE' at the top
of your script.
If the value is set to true , and your script writes warnings, then the warnings will appear
as warnings in Pipeline logs.
This will cause the last exit code from an external command to be propagated as the exit
code of powershell . Otherwise, the line is not appended to the end of your script.
If this is true, then tasks running on Windows agents will use pwsh.exe from your path
instead of powershell.exe .
string .
Specifies the working directory where the script is run. If a value is not specified, the
working directory is $(Build.SourcesDirectory) .
This input allows executing PowerShell scripts using & operator instead of the default . .
If this input is set to true , the script will be executed in a separate scope, and globally
scoped PowerShell variables won't be updated.
Task control options
All tasks have control options in addition to their task inputs. For more information, see
Control options and common task properties.
Output variables
None.
Remarks
Each PowerShell session lasts only for the duration of the job in which it runs. Tasks that
depend on what has been bootstrapped must be in the same job as the bootstrap.
Task shortcuts
PowerShell@2 has two shortcuts in YAML: steps.powershell and steps.pwsh.
powershell runs using either Windows PowerShell (on Windows) or pwsh (Linux
and macOS).
pwsh runs PowerShell Core, the cross-platform edition of PowerShell built on .NET
Core.
yml
steps:
- powershell: # Run a script in Windows PowerShell on Windows, and pwsh on
Linux and macOS.
- pwsh: # Run a script in PowerShell Core on Windows, macOS, and Linux.
To learn more about defining release variables in a script, see Define and modify your
release variables in a script.
Passing pipeline secrets in script, but secret is not masked
in pipeline logs
Be aware that PowerShell cuts off error messages, so if you use pipeline secrets in a
script, the secrets could be trimmed and exposed. For example, in the inline script
below:
PowerShell
PowerShell
To avoid this issue, you can handle these exceptions on a script level, or avoid cases
when pipeline secrets could appear in source code lines within error messages.
Examples
Invoke a script from a file
Write a warning
Write an error
Call PowerShell script with multiple arguments
PowerShell
yml
steps:
- task: PowerShell@2
inputs:
targetType: 'filePath'
filePath: 'test.ps1'
Write a warning
yml
- task: PowerShell@2
inputs:
targetType: 'inline'
script: Write-Host "##vso[task.LogIssue type=warning;]This is the
warning"
# Writes a warning to build summary and to log in yellow text
Write an error
yml
- task: PowerShell@2
inputs:
targetType: 'inline'
script: Write-Host "##vso[task.LogIssue type=error;]This is the error"
# Writes an error to build summary and to log in red text
If you want this error to fail the build, add exit 1 to the script.
yml
- task: PowerShell@2
inputs:
targetType: 'inline'
script: |
Write-Host "##vso[task.LogIssue type=error;]This is the error"
exit 1
# Writes an error to build summary and to log in red text
Call PowerShell script with multiple arguments
Create PowerShell script test2.ps1 :
PowerShell
YAML
- task: PowerShell@2
inputs:
targetType: 'filePath'
filePath: $(System.DefaultWorkingDirectory)\test2.ps1
arguments: > # Use this to avoid newline characters in multiline string
-input1 "Hello"
-input2 "World"
displayName: 'Print Hello World'
Requirements
ノ Expand table
Requirement Description
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
See also
Use a PowerShell script to customize your pipeline - ApplyVersionToAssemblies.ps1
Learn more about PowerShell scripts
Scripting with Windows PowerShell
Microsoft Script Center (the Scripting Guys)
PowerShell.org
Feedback
Was this page helpful? Yes No
Syntax
YAML
# PowerShell v1
# Run a PowerShell script.
- task: PowerShell@1
inputs:
scriptType: 'filePath' # 'inlineScript' | 'filePath'. Required. Type.
Default: filePath.
scriptName: # string. Required when scriptType = filePath. Script Path.
#arguments: # string. Arguments.
#inlineScript: # string. Required when scriptType = inlineScript. Inline
Script.
# Advanced
#workingFolder: # string. Working folder.
#failOnStandardError: true # boolean. Fail on Standard Error. Default:
true.
Inputs
scriptType - Type
string . Required. Allowed values: inlineScript (Inline Script), filePath (File Path).
Specifies the type of script for the task to run: an inline script or a path to a .ps1 file.
Specifies the type of script for the task to run: an inline script or a path to a .ps1 file.
arguments - Arguments
string .
Specifies the arguments passed to the PowerShell script. Arguments can be ordinal
parameters or named parameters. For example, -Name someName -Path -Value "Some
long string value" .
Specifies the working directory where the script is run. If a value is not specified, the
working directory is $(Build.SourcesDirectory) .
powershell scripts inline here. \n# You can also pass predefined and custom
variables to this scripts using arguments\n\n Write-Host "Hello World" .
Specifies the contents of the script. The maximum supported inline script length is 500
characters. Use a script from a file if you want to use a longer script.
If the value of this boolean is true , the task fails if any errors are written to the error
pipeline or if any data is written to the Standard Error stream. Otherwise, the task relies
on the exit code to determine failure.
Output variables
None.
Remarks
PowerShell@1 runs only on Windows agents. To run PowerShell on other agent types,
use PowerShell@2.
Each PowerShell session lasts only for the duration of the job in which it runs. Tasks that
depend on what has been bootstrapped must be in the same job as the bootstrap.
To learn more about defining release variables in a script, see Define and modify your
release variables in a script.
PowerShell
PowerShell
To avoid this issue, you can handle these exceptions on a script level, or avoid cases
when pipeline secrets could appear in source code lines within error messages.
Requirements
ノ Expand table
Requirement Description
Demands Self-hosted agents must have capabilities that match the following demands
to run jobs that use this task: DotNetFramework
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Command Any
restrictions
See also
Use a PowerShell script to customize your pipeline - ApplyVersionToAssemblies.ps1
Learn more about PowerShell scripts
Scripting with Windows PowerShell
Microsoft Script Center (the Scripting Guys)
PowerShell.org
Feedback
Was this page helpful? Yes No
Use this task to execute PowerShell scripts on remote machines using PSSession and
Invoke-Command for remoting.
Syntax
# PowerShell on target machines v3
# Execute PowerShell scripts on remote machines using PSSession and Invoke-
Command for remoting.
- task: PowerShellOnTargetMachines@3
inputs:
Machines: # string. Required. Machines.
#UserName: # string. Username.
#UserPassword: # string. Password.
# Script options
#ScriptType: 'Inline' # 'FilePath' | 'Inline'. Script Type. Default:
Inline.
#ScriptPath: # string. Required when ScriptType = FilePath. Script File
Path.
InlineScript: # string. Required when ScriptType = Inline. Script.
#ScriptArguments: # string. Optional. Use when ScriptType = FilePath.
Script Arguments.
#InitializationScript: # string. Optional. Use when ScriptType =
FilePath. Initialization script.
#SessionVariables: # string. Optional. Use when ScriptType = FilePath.
Session Variables.
# PSSession options
#CommunicationProtocol: 'Https' # 'Http' | 'Https'. Protocol. Default:
Https.
#AuthenticationMechanism: 'Default' # 'Default' | 'Credssp'.
Authentication. Default: Default.
#NewPsSessionOptionArguments: '-SkipCACheck -IdleTimeout 7200000 -
OperationTimeout 0 -OutputBufferingMode Block' # string. Session Option
parameters. Default: -SkipCACheck -IdleTimeout 7200000 -OperationTimeout 0 -
OutputBufferingMode Block.
# Error handling options
#ErrorActionPreference: 'stop' # 'stop' | 'continue' |
'silentlyContinue'. ErrorActionPreference. Default: stop.
#failOnStderr: false # boolean. Fail on Standard Error. Default: false.
#ignoreLASTEXITCODE: false # boolean. Ignore $LASTEXITCODE. Default:
false.
# Advanced
#WorkingDirectory: # string. Working Directory.
#RunPowershellInParallel: true # boolean. Run PowerShell in Parallel.
Default: true.
Inputs
Machines - Machines
string . Required.
If you do not specify a port, the default WinRM port is used. This depends on the
protocol you have configured. For WinRM 2.0, the default HTTP port is 5985 and the
default HTTPS port is 5986 .
UserName - Username
string .
UserPassword - Password
string .
Specifies the password for the target machines. Variables defined in build/release
definitions as $(passwordVariable) are accepted. You may mark the variable type as
secret to secure it.
ScriptType - Script Type
string . Allowed values: FilePath (File Path), Inline . Default value: Inline .
Specifies the location of the PowerShell script on the target machines or on a UNC path,
like C:\BudgetIT\Web\Deploy\Website.ps1 , which should be accessible from the target
machine.
InlineScript - Script
string . Required when ScriptType = Inline . Default value: # Write your powershell
Specifies the arguments for the PowerShell script. Can be ordinal or named parameters,
like -testParam test. For example: -applicationPath $(applicationPath) , -username
$(vmusername) , -password $(vmpassword) .
Specifies the location of the data script for the DSC on the target machines or on a UNC
path, like C:\BudgetIT\Web\Deploy\WebsiteConfiguration.ps1 . It's recommended to use
arguments instead of an initialization script.
Specifies the protocol to use for the WinRM service connection with the machine(s). The
default value is HTTPS .
AuthenticationMechanism - Authentication
string . Allowed values: Default , Credssp . Default value: Default .
Specifies the authentication mechanism used for creating the PSSession. For CredSSP
authentication, the username and password fields are mandatory.
OutputBufferingMode Block .
ErrorActionPreference - ErrorActionPreference
string . Allowed values: stop , continue , silentlyContinue . Default value: stop .
If set to true , fails if any errors are written to the error pipeline or if any data is written
to the Standard Error stream. Otherwise, the task relies on the exit code to determine
failure.
string .
If set to true , runs the PowerShell scripts in parallel on the target machines.
Output variables
None.
Remarks
Use this task to execute PowerShell scripts on remote machine(s).
This task can run both PowerShell scripts and PowerShell-DSC scripts:
For PowerShell scripts, the computers must have PowerShell 2.0 or higher installed.
For PowerShell-DSC scripts, the computers must have the latest version of the
Windows Management Framework installed. This is installed by default on
Windows 8.1, Windows Server 2012 R2, and subsequent versions.
Prerequisites
This task uses Windows Remote Management (WinRM) to access on-premises physical
computers or virtual computers that are domain-joined or workgroup-joined.
Azure Virtual Machines require WinRM to use the HTTPS protocol. You can use a self-
signed Test Certificate. In this case, the automation agent will not validate the
authenticity of the certificate as being issued by a trusted certification authority.
Azure Classic Virtual Machines. When you create a classic virtual machine from
the Azure portal, the virtual machine is already set up for WinRM over HTTPS, with
the default port 5986 already opened in the firewall and a self-signed certificate
installed on the machine. These virtual machines can be accessed with no further
configuration required. Existing Classic virtual machines can be also selected by
using the Azure Resource Group Deployment task.
Azure Resource Group. If you have an Azure Resource Group already defined in
the Azure portal, you must configure it to use the WinRM HTTPS protocol. You
need to open port 5986 in the firewall, and install a self-signed certificate.
To dynamically deploy Azure Resource Groups that contain virtual machines, use the
Azure Resource Group Deployment task. This task has a checkbox named Enable
Deployment Prerequisites. Select this to automatically set up the WinRM HTTPS
protocol on the virtual machines, open port 5986 in the firewall, and install a test
certificate. The virtual machines are then ready for use in the deployment task.
Requirements
ノ Expand table
Requirement Description
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Feedback
Was this page helpful? Yes No
Syntax
# PowerShell on Target Machines v2
# Execute PowerShell scripts on remote machine(s).
- task: PowerShellOnTargetMachines@2
inputs:
EnvironmentName: # string. Required. Machines.
#AdminUserName: # string. Admin Login.
#AdminPassword: # string. Password.
#Protocol: # 'Http' | 'Https'. Protocol.
#TestCertificate: true # boolean. Optional. Use when Protocol = Https.
Test Certificate. Default: true.
# Deployment
ScriptPath: # string. Required. PowerShell Script.
#ScriptArguments: # string. Script Arguments.
#InitializationScriptPath: # string. Initialization Script.
#SessionVariables: # string. Session Variables.
# Advanced Options
#RunPowershellInParallel: true # boolean. Run PowerShell in Parallel.
Default: true.
#ResourceFilteringMethod: 'machineNames' # 'machineNames' | 'tags'.
Select Machines By. Default: machineNames.
#MachineNames: # string. Filter Criteria.
Inputs
EnvironmentName - Machines
string . Required.
You can also provide the output variable of other tasks, for example $(variableName) . If
you're using HTTPS, the name or IP of the machine should match the CN in the
certificate.
AdminUserName - Admin Login
string .
AdminPassword - Password
string .
Specifies the administrator password for the target machines. Variables defined in
build/release definitions as $(passwordVariable) are accepted. You may mark the
variable type as secret to secure it.
Protocol - Protocol
string . Allowed values: Http , Https .
Specifies the protocol to use for the WinRM service connection with the machine(s). The
default value is HTTPS .
Specifies the option to skip validating the authenticity of the machine's certificate by a
trusted certification authority. The parameter is required for the WinRM HTTPS protocol.
Specifies the location of the PowerShell script on the target machines or on a UNC path,
like C:\BudgetIT\Web\Deploy\Website.ps1 .
Specifies the arguments for the PowerShell script. Can be ordinal or named parameters,
like -testParam test.
InitializationScriptPath - Initialization Script
string .
Specifies the location of the data script for DSC on the target machines or on a UNC
path, like C:\BudgetIT\Web\Deploy\WebsiteConfiguration.ps1 .
Specifies the common session variables for both scripts. For example, $variable = value
or $var1 = "value, 123" .
If set to true , runs the PowerShell scripts in parallel on the target machines.
string .
This input is valid only for machine groups or output variables. It is not supported for a
flat list of machines yet.
will run in all machines with the specified tags. The default runs the task in all machines.
Remarks
What's new in Version 2.0:
Requirements
ノ Expand table
Requirement Description
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Feedback
Was this page helpful? Yes No
Syntax
YAML
Inputs
EnvironmentName - Machines
string . Required.
You can also provide the output variable of other tasks, for example $(variableName) . If
you're using HTTPS, the name or IP of the machine should match the CN in the
certificate.
string .
AdminPassword - Password
string .
Specifies the administrator password for the target machines. Variables defined in
build/release definitions as $(passwordVariable) are accepted. You may mark the
variable type as secret to secure it.
Protocol - Protocol
Specifies the protocol to use for the WinRM connection with the machine(s). The default
value is HTTPS .
string . Required.
Specifies the location of the PowerShell script on the target machines or on a UNC path,
like C:\BudgetIT\Web\Deploy\Website.ps1 .
string .
Specifies the arguments for the PowerShell script. Can be ordinal or named parameters,
like -testParam test.
InitializationScriptPath - Initialization Script
string .
Specifies the location of the data script for DSC on the target machines or on a UNC
path, like C:\BudgetIT\Web\Deploy\WebsiteConfiguration.ps1 .
string .
Specifies the common session variables for both scripts. For example, $variable = value
or $var1 = "value, 123" .
If set to true , runs the PowerShell scripts in parallel on the target machines.
machineNames .
This input is valid only for machine groups or output variables. It is not supported for a
flat list of machines yet.
will run in all machines with the specified tags. The default runs the task in all machines.
Output variables
None.
Requirements
ノ Expand table
Requirement Description
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Feedback
Was this page helpful? Yes No
Syntax
YAML
Inputs
SonarQube - SonarQube Server Endpoint
string . Required.
Specifies the SonarQube server endpoint for your project. To create one, click the
Manage link, create a new SonarQube Server Endpoint, and enter your server url and
token.
with Maven or Gradle), CLI (Use standalone scanner). Default value: MSBuild .
MSBuild
Maven/Gradle
Others
For other cases, you can use the standalone scanner (sonar-scanner), set all
configurations with this task, and then add the Run Code Analysis task.
configMode - Mode
string . Required when scannerMode = CLI . Allowed values: file (Store configuration
string . Optional. Use when scannerMode = CLI && configMode = file . Default value:
sonar-project.properties .
Specifies the configuration settings and project properties. Learn more about the
SonarQube Extension for Azure DevOps .
1.0 .
string . Required when scannerMode = CLI && configMode = manual . Default value: . .
Specifies the path to the root directory containing source files. This value is set to the
sonar.sources SonarQube property.
string . Default value: # Additional properties that will be passed to the scanner,
\n# Put one key=value per line, example:\n# sonar.exclusions=**/*.bin .
Output variables
None.
Remarks
Support non-MSBuild projects: This task can also configure analysis for non-
MSBuild projects.
Requirements
ノ Expand table
Requirement Description
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
See also
SonarQube Azure DevOps Integration
Feedback
Was this page helpful? Yes No
Syntax
YAML
Inputs
SonarQube - SonarQube Server Endpoint
string . Required.
Specifies the SonarQube server endpoint for your project. To create one, click the
Manage link, create a new SonarQube Server Endpoint, and enter your server url and
token.
with Maven or Gradle), CLI (Use standalone scanner). Default value: MSBuild .
MSBuild
Maven/Gradle
Others
For other cases, you can use the standalone scanner (sonar-scanner), set all
configurations with this task, and then add the Run Code Analysis task.
configMode - Mode
string . Required when scannerMode = CLI . Allowed values: file (Store configuration
string . Optional. Use when scannerMode = CLI && configMode = file . Default value:
sonar-project.properties .
Specifies the configuration settings and project properties. Learn more about the
SonarQube Extension for Azure DevOps .
1.0 .
string . Required when scannerMode = CLI && configMode = manual . Default value: . .
Specifies the path to the root directory containing source files. This value is set to the
sonar.sources SonarQube property.
string . Default value: # Additional properties that will be passed to the scanner,
\n# Put one key=value per line, example:\n# sonar.exclusions=**/*.bin .
Output variables
None.
Remarks
Support non-MSBuild projects: This task can also configure analysis for non-
MSBuild projects.
Requirements
ノ Expand table
Requirement Description
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
See also
SonarQube Azure DevOps Integration
Feedback
Was this page helpful? Yes No
Use this task in a build pipeline to publish build artifacts to Azure Pipelines, TFS, or a file
share.
Syntax
YAML
Inputs
PathtoPublish - Path to publish
string . Required. Default value: $(Build.ArtifactStagingDirectory) .
Specifies the folder or file path to publish. This can be a fully qualified path or a path
relative to the root of the repository. Wildcards are not supported. Variables are
supported. Example: $(Build.ArtifactStagingDirectory) . For more information, see
Artifacts in pipelines - overview.
ArtifactName - Artifact name
Specifies the name of the artifact to create in the publish location. The following special
characters are not allowed: + , % , { , }
Input alias: ArtifactType . string . Required. Allowed values: Container (Azure Pipelines),
FilePath (A file share). Default value: Container .
Maximum limit on the size of artifacts to be published in bytes. Put 0 if you don't want
to set any limit.
Specifies the path to the file share where you want to copy the files. The path must be a
fully qualified path or a valid path relative to the root directory of your repository.
Publishing artifacts from a Linux or macOS agent to a file share is not supported.
Example: \\my\share\$(Build.DefinitionName)\$(Build.BuildNumber) .
Specifies whether to copy files in parallel using multiple threads for greater potential
throughput. If this setting is not enabled, a single thread will be used.
string . Optional. Use when ArtifactType = FilePath && Parallel = true . Default value:
8.
Specifies the degree of parallelism (the number of threads) used to perform the copy.
The value must be at least 1 and not greater than 128. Choose a value based on CPU
capabilities of the build agent.
Adds all files from the publish path to a tar archive before uploading. This allows you to
preserve the UNIX file permissions. Use extractTars option of
theDownloadBuildArtifacts task to extract the downloaded items automatically. This
setting is ignored on Windows agents.
Output variables
None.
Remarks
7 Note
You cannot use Bin, App_Data and other folder names reserved by IIS as an Artifact
name because this content is not served in response to Web requests. Please see
ASP.NET Web Project Folder Structure for more details.
Examples
yml
steps:
- task: CopyFiles@2
inputs:
contents: '_buildOutput/**'
targetFolder: $(Build.ArtifactStagingDirectory)
- task: PublishBuildArtifacts@1
inputs:
pathToPublish: $(Build.ArtifactStagingDirectory)
artifactName: MyBuildOutputs
Requirements
ノ Expand table
Requirement Description
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
See also
File matching patterns reference
How do I use this task to publish artifacts
Learn how to use verbose logs for troubleshooting.
Feedback
Was this page helpful? Yes No
Syntax
YAML
Inputs
summaryFileLocation - Path to summary files
string . Required.
Specifies the path of the summary file containing code coverage statistics, such as line,
method, and class coverage. Multiple summary files are merged into a single report. The
value may contain minimatch patterns. For example:
$(System.DefaultWorkingDirectory)/MyApp/**/site/cobertura/coverage.xml . More
Specifying a path to source files is required when coverage XML reports don't contain
an absolute path to source files. For example, JaCoCo reports don't use absolute paths,
so when publishing JaCoCo coverage for Java apps, the pattern is similar to
$(System.DefaultWorkingDirectory)/MyApp/src/main/java/ . This input should point to an
Fails the task if code coverage did not produce any results to publish.
Output variables
None.
Remarks
7 Note
See New version of Publish Code Coverage Results task on the Azure DevOps
blog for information about the new features in V2 of the Publish Code Coverage
Results task, and migrating from V1 to V2.
Use this task in a build pipeline to publish code coverage results produced when
running tests to Azure Pipelines or TFS and after generating the coverage xml files in
order to obtain code coverage tab and coverage reporting details in the pipeline. The
task supports code coverage generated xml formats. This task generates a cjson file
which contains the code coverage details. It will also produce a code coverage HTML
report under the build artifacts.
Tasks such as Visual Studio Test, .NET Core, Ant, Maven, Gulp, and Grunt also provide the
option to publish code coverage data to the pipeline. If you are using these tasks, you
do not need a separate Publish Code Coverage Results task in the pipeline.
Prerequisite- To use the Publish Code Coverage Results v2 task in the pipeline, please
use the dotnet 7.0.x task as a pre-requisite in the pipeline. Use the dotnet core task
before the Publish Code Coverage v2 task.
Prerequisites
To configure the prerequisites using a YAML pipeline:
YAML
1. Configure the Publish Code Coverage Results version 2 task using the following
settings.
2. After the build completes and the Publish Code Coverage Results v2 task succeeds,
select the Code Coverage tab in the pipeline run summary to view the code
coverage results.
View results
In order to view the code coverage results in the pipeline, see Review code coverage
results.
Known issues
The publish code coverage results v2 task generates a cjson file and publishes the code
coverage report under the code coverage tab. It also produces a build artifacts which is
a set of HTML files that are linked from the main index.html file. If the code coverage tab
fails to show the code coverage report, check whether the input code coverage xml file
is in the correct format and has the valid details.
Requirements
ノ Expand table
Requirement Description
Runs on Agent
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Feedback
Was this page helpful? Yes No
Use this task to publish Cobertura or JaCoCo code coverage results from a build.
) Important
Syntax
# Publish code coverage results v1
# [DEPRECATION WARNING! Users are recommended to switch to version 2*.]
Publish Cobertura or JaCoCo code coverage results from a build.
- task: PublishCodeCoverageResults@1
inputs:
codeCoverageTool: 'JaCoCo' # 'Cobertura' | 'JaCoCo'. Required. Code
coverage tool. Default: JaCoCo.
summaryFileLocation: # string. Required. Summary file.
#pathToSources: # string. Path to Source files.
#reportDirectory: # string. Report directory.
#additionalCodeCoverageFiles: # string. Additional files.
#failIfCoverageEmpty: false # boolean. Fail when code coverage results
are missing. Default: false.
Inputs
codeCoverageTool - Code coverage tool
Specifying a path to source files is required when coverage XML reports don't contain
an absolute path to source files. For example, JaCoCo reports don't use absolute paths,
so when publishing JaCoCo coverage for Java apps, the pattern is similar to
$(System.DefaultWorkingDirectory)/MyApp/src/main/java/ . This input should point to an
Multiple sources can be added by delimiting each list item with the ; character, for
example pathToSources:
$(System.DefaultWorkingDirectory)/path/to/first/source;$(System.DefaultWorkingDirec
tory)/path/to/second/source .
string .
Specifies the path of the code coverage HTML report directory. The report directory is
published for later viewing as an artifact of the build. The value may contain minimatch
patterns. For example: $(System.DefaultWorkingDirectory)/MyApp/**/site/cobertura .
string .
Specifies the file path pattern and notes any additional code coverage files to be
published as artifacts of the build. The value may contain minimatch patterns. For
example: $(System.DefaultWorkingDirectory)/**/*.exec .
Output variables
None.
Remarks
) Important
7 Note
See New version of Publish Code Coverage Results task on the Azure DevOps
blog for information about the new features in V2 of the Publish Code Coverage
Results task, and migrating from V1 to V2.
Use this task in a build pipeline to publish code coverage results produced when
running tests to Azure Pipelines or TFS in order to obtain coverage reporting. The task
supports popular coverage result formats such as Cobertura and JaCoCo .
Tasks such as Visual Studio Test, .NET Core, Ant, Maven, Gulp, and Grunt also provide the
option to publish code coverage data to the pipeline. If you are using these tasks, you
do not need a separate Publish Code Coverage Results task in the pipeline.
To generate the HTML code coverage report you need dotnet framework 2.0.0 or later
on the agent. The dotnet folder must be in the environment path. If there are multiple
folders containing dotnet, the one with version 2.0.0 must be before any others in the
path list.
Code coverage results for JavaScript with Istanbul using
YAML
To publish code coverage results for JavaScript with Istanbul using YAML, see Customize
JavaScript in the Ecosystems section of these topics, which also includes examples for
other languages.
Docker
For apps using Docker, build and tests may run inside the container and generate code
coverage results within the container. In order to publish the results to the pipeline, the
resulting artifacts should be made available to the Publish Code Coverage Results task.
For reference, you can see a similar example for publishing test results under the Build,
test, and publish results with a Docker file section for Docker.
View results
In order to view the code coverage results in the pipeline, see Review code coverage
results.
Known issues
The publish code coverage results task generates and publishes the HTML report, which
is a set of HTML files that are linked from the main index.html file. If the code coverage
tab fails to show the code coverage report, check whether the size of the index.html file
is close to or larger than 7 MB. Complete the following steps to check the size of the file.
Then, if the file size is close to or larger than 7 MB, you can use the following
workaround to view the coverage report.
1. Select the build Summary tab, and then select the published link:
3. When the code coverage report is downloaded, extract the .zip file.
4. In the code coverage report, check the size of index.html to help determine
whether the file size is causing the issue described here.
Requirements
ノ Expand table
Requirement Description
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Requirement Description
Command Any
restrictions
Settable variables This task has permission to set the following variables: Setting variables is
disabled
See also
Publish Test Results
Feedback
Was this page helpful? Yes No
Use this task to publish (upload) a file or directory as a named artifact for the current
run.
Syntax
# Publish Pipeline Artifacts v1
# Publish (upload) a file or directory as a named artifact for the current
run.
- task: PublishPipelineArtifact@1
inputs:
targetPath: '$(Pipeline.Workspace)' # string. Alias: path. Required.
File or directory path. Default: $(Pipeline.Workspace).
#artifact: # string. Alias: artifactName. Artifact name.
publishLocation: 'pipeline' # 'pipeline' | 'filepath'. Alias:
artifactType. Required. Artifact publish location. Default: pipeline.
#fileSharePath: # string. Required when artifactType = filepath. File
share path.
#parallel: false # boolean. Optional. Use when artifactType = filepath.
Parallel copy. Default: false.
#parallelCount: '8' # string. Optional. Use when artifactType = filepath
&& parallel = true. Parallel count. Default: 8.
#properties: # string. Custom properties.
Inputs
targetPath - File or directory path
Specifies the path of the file or directory to publish. Can be absolute or relative to the
default working directory. Can include variables , but wildcards are not supported. See
Artifacts in Azure Pipelines for more information.
Specifies the name of the artifact to publish. It can be any name you choose, for
example drop . If not set, the default is a unique ID scoped to the job.
) Important
Input alias: artifactType . string . Required. Allowed values: pipeline (Azure Pipelines),
filepath (A file share). Default value: pipeline .
Specifies whether to store the artifact in Azure Pipelines or to copy it to a file share that
must be accessible from the pipeline agent.
Specifies the file share where the artifact files are copied. This can include variables, for
example \\my\\share\\$(Build.DefinitionName)\\$(Build.BuildNumber) . Publishing
artifacts from a Linux or macOS agent to a file share is not supported, for example
\\server\folderName .
Specifies whether to copy files in parallel using multiple threads for greater potential
throughput. If this setting is not enabled, one thread will be used.
string . Optional. Use when artifactType = filepath && parallel = true . Default value:
8.
Specifies the degree of parallelism, or the number of threads used, to perform the copy.
The value must be between 1 and 128.
Specifies the custom properties to associate with the artifact. Use a valid JSON string
with the prefix user- on all keys.
Task control options
All tasks have control options in addition to their task inputs. For more information, see
Control options and common task properties.
Output variables
None.
Remarks
Publishing is not supported in classic release pipelines.
7 Note
Publish Pipeline Artifacts is not supported in on-premises. Please use Publish Build
Artifacts if you're using Azure DevOps Server or TFS 2018. If you use it on Azure
DevOps Server, you'll receive an error message similar to Pipeline Artifact Task
is not supported in on-premises. Please use Build Artifact Task instead. .
The publish and download keywords are shortcuts for the PublishPipelineArtifact@1
and DownloadPipelineArtifact@2 tasks. See steps.publish and steps.download for more
details.
Tip
You can use the .artifactignore file to control which files will be published.
See Define variables, predefined variables, and Classic release and artifacts variables to
learn about the different types of variables.
A: Deployment jobs do not have the context of source branches and are hence not
appropriate for publishing artifacts. They have been primarily designed to consume
artifacts. A workaround would be to isolate that logic into a separate job (with
dependencies on your deployment jobs).
Requirements
ノ Expand table
Requirement Description
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
See also
Looking to get started with build artifacts? See Artifacts in Azure Pipelines.
Feedback
Was this page helpful? Yes No
Use this task to publish a local directory or file as a named artifact for the current
pipeline.
Syntax
# Publish Pipeline Artifacts v0
# Publish a local directory or file as a named artifact for the current
pipeline.
- task: PublishPipelineArtifact@0
inputs:
artifactName: 'drop' # string. Required. The name of this artifact.
Default: drop.
targetPath: # string. Required. Path to publish.
#properties: # string. Custom properties.
Inputs
artifactName - The name of this artifact
string . Required. Default value: drop .
string . Required.
Specifies the folder or file path to publish. This can be a fully qualified path or a path
relative to the root of the repository. Wildcards are not supported. Variables are
supported.
Output variables
None.
Requirements
ノ Expand table
Requirement Description
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Feedback
Was this page helpful? Yes No
Provide product feedback
PublishPipelineMetadata@0 - Publish
Pipeline Metadata v0 task
Article • 04/29/2024
Syntax
# Publish Pipeline Metadata v0
# Publish Pipeline Metadata to Evidence store.
- task: PublishPipelineMetadata@0
inputs: # none
Inputs
None.
Output variables
None.
Requirements
ノ Expand table
Requirement Description
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Requirement Description
Feedback
Was this page helpful? Yes No
Use this task to publish SonarQube's Quality Gate result on the Azure DevOps build
result. Use this after the analysis.
Syntax
YAML
Inputs
pollingTimeoutSec - Timeout (s)
string . Required. Default value: 300 .
This task polls SonarQube until the analysis is completed or until the timeout is reached.
It also adds a build property with the Quality Gate status of the current build(s) analyses.
Output variables
None.
Requirements
ノ Expand table
Requirement Description
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
See also
SonarQube Azure DevOps Integration
Feedback
Was this page helpful? Yes No
Use this task to publish SonarQube's Quality Gate result on the Azure DevOps build
result. Use this after the analysis.
Syntax
YAML
Inputs
pollingTimeoutSec - Timeout (s)
string . Required. Default value: 300 .
This task polls SonarQube until the analysis is completed or until the timeout is reached.
This task also adds a build property with the Quality Gate status of the current build(s)
analyses.
Output variables
None.
Requirements
ノ Expand table
Requirement Description
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
See also
SonarQube Azure DevOps Integration
Feedback
Was this page helpful? Yes No
Syntax
YAML
Inputs
testResultsFormat - Test result format
Input alias: testRunner . string . Required. Allowed values: JUnit , NUnit , VSTest , XUnit , CTest . Default value: JUnit .
Specifies the format of the results files you want to publish. The following formats are supported: CTest , JUnit , NUnit 2 , NUnit 3 ,
Visual Studio Test (TRX) and xUnit 2 .
You can use a single-folder wildcard ( * ) and recursive wildcards ( ** ). For example, **/TEST-*.xml searches for all the XML files whose
names start with TEST- in all subdirectories. If using VSTest as the test result format, the file type should be changed to .trx e.g.
**/TEST-*.trx
Optional. Specifies the folder to search for the test result files.
When this boolean's value is true , the task reports test results from all the files against a single test run. If the value is false , the task
creates a separate test run for each test result file.
7 Note
Use the merge test results setting to combine files from the same test framework to ensure results mapping and duration are
calculated correctly.
Optional. When this boolean's value is true , the task will fail if any of the tests in the results file are marked as failed. The default is false ,
which will simply publish the results from the results file.
When true , fails the task if there is failure in publishing test results.
string .
Optional. Specifies a name for the test run against which the results will be reported. Variable names declared in the build or release
pipeline can be used.
Optional. Specifies the build platform against which the test run should be reported. For example: x64 or x86 . If you defined a variable for
the platform in your build task, use it here.
Optional. Specifies the build configuration against which the test run should be reported. For example: Debug or Release . If you defined a
variable for the configuration in your build task, use it here.
Optional. When this boolean's value is true , the task uploads all the test result files as attachments to the test run.
Output variables
None.
Remarks
Prerequisites
Task defaults
Result formats mapping
Attachments support
This task publishes test results to Azure Pipelines or TFS when tests are executed to provide a comprehensive test reporting and analytics
experience. You can use the test runner of your choice that supports the results format you require. Supported results formats include
CTest , JUnit (including PHPUnit ), NUnit 2 , NUnit 3 , Visual Studio Test (TRX), and xUnit 2 .
Other built-in tasks, such as Visual Studio Test task and Dot NetCore CLI task automatically publish test results to the pipeline. Tasks such as
Ant, Maven, Gulp, Grunt, and Xcode provide publishing results as an option within the task, or build libraries such as Cobertura and
JaCoCo . If you are using any of these tasks, you do not need a separate Publish Test Results task in the pipeline.
The published test results are displayed in the Tests tab in the pipeline summary. The results help you to measure pipeline quality, review
traceability, troubleshoot failures, and drive failure ownership.
The following example shows the task is configured to publish test results.
You can also use this task in a build pipeline to publish code coverage results produced when running tests to Azure Pipelines or TFS in
order to obtain coverage reporting.
Prerequisites
If you're using a Windows self-hosted agent, your machine must have this prerequisite installed:
Task defaults
The default option uses JUnit format to publish test results. When using VSTest as the testRunner, the testResultsFiles option should be
changed to **/TEST-*.trx .
testResultsFormat is an alias for the testRunner input name. The results files can be produced by multiple runners, not just a specific
runner. For example, the jUnit results format is supported by many runners and not just jUnit.
To publish test results for Python using YAML, see Python in the Ecosystems section of these topics, which also includes examples for other
languages.
ノ Expand table
Date /TestRun/Times.Attributes["finish"].Value
completed
Owner /TestRun/TestDefinitions/UnitTest/Owners/Owner.Attributes["name"].Value
Error /TestRun/Results/UnitTestResult/Output/ErrorInfo/Message.InnerText Or
message /TestRun/Results/WebTestResultOutput/ErrorInfo/Message.InnerText Or
/TestRun/Results/TestResultAggregation/Output/ErrorInfo/Message.InnerText
Priority /TestRun/TestDefinitions/UnitTest.Attributes["priority"].Value
7 Note
Duration is used only when Date started and Date completed are not available.
The fully qualified name format for testName is Namespace.Testclass.Methodname with a character limit of 512. If the test is data
driven and has parameters, the character limit will include the parameters.
While publishing the test result, you may get this error: Failed to publish test results: Invalid Priority specified
This error occurs if any of the test methods has priority set above 255, fix the test method priority in the code and execute the tests
again. You can review the trx file generated to see all the tests having priority greater than 255.
Attachments support
The Publish Test Results task provides support for attachments for both test run and test results for the following formats. For public
projects, we support 2GB of total attachments.
ノ Expand table
Test /TestRun/ResultSummary/ResultFiles/ResultFile.Attributes["path"].Value
Result
Code /TestRun/TestSettings/Execution/AgentRule/DataCollectors/DataCollector/Configuration/CodeCoverage/Regular/CodeCoverageItem.Attribute
Coverage And
/TestRun/TestSettings/Execution/AgentRule/DataCollectors/DataCollector/Configuration/CodeCoverage/Regular/CodeCoverageItem.Attribute
7 Note
The option to upload the test results file as an attachment is a default option in the task, applicable to all formats.
Examples
Docker
For Docker based apps, there are many ways to build your application and run tests:
Build and test in a build pipeline: builds and tests execute in the pipeline and test results are published using the Publish Test Results
task.
Build and test with a multi-stage Dockerfile: builds and tests execute inside the container using a multi-stage Docker file, as such test
results are not published back to the pipeline.
Build, test, and publish results with a Dockerfile: builds and tests execute inside the container, and results are published back to the
pipeline. See the example below.
1. Create a Dockerfile.build file at the root of your project directory with the following:
Dockerfile
This file contains the instructions to build code and run tests. The tests are then copied to a file testresults.trx inside the container.
2. To make the final image as small as possible, containing only the runtime and deployment artifacts, replace the contents of the
existing Dockerfile with the following:
Dockerfile
YAML
1. If you have a Docker Hub account, and want to push the image to your Docker registry, replace the contents of the .vsts-
ci.docker.yml file with the following:
YAML
- task: PublishTestResults@2
inputs:
testRunner: VSTest
testResultsFiles: '**/*.trx'
failTaskOnFailedTests: true
- script: |
docker build -f Dockerfile -t $(dockerId)/dotnetcore-sample:$BUILD_BUILDID .
docker login -u $(dockerId) -p $pswd
docker push $(dockerId)/dotnetcore-sample:$BUILD_BUILDID
env:
pswd: $(dockerPassword)
Alternatively, if you configure an Azure Container Registry and want to push the image to that registry, replace the contents of
the .vsts-ci.yml file with the following:
YAML
# Build Docker image for this app to be published to Azure Container Registry
pool:
vmImage: 'ubuntu-latest'
variables:
buildConfiguration: 'Release'
steps:
- script: |
docker build -f Dockerfile.build -t $(dockerId)/dotnetcore-build:$BUILD_BUILDID .
docker run --name dotnetcoreapp --rm -d $(dockerId)/dotnetcore-build:$BUILD_BUILDID
docker cp dotnetcoreapp:app/dotnetcore-tests/TestResults $(System.DefaultWorkingDirectory)
docker cp dotnetcoreapp:app/dotnetcore-sample/out $(System.DefaultWorkingDirectory)
docker stop dotnetcoreapp
- task: PublishTestResults@2
inputs:
testRunner: VSTest
testResultsFiles: '**/*.trx'
failTaskOnFailedTests: true
- script: |
docker build -f Dockerfile -t $(dockerId).azurecr.io/dotnetcore-sample:$BUILD_BUILDID .
docker login -u $(dockerId) -p $pswd $(dockerid).azurecr.io
docker push $(dockerId).azurecr.io/dotnetcore-sample:$BUILD_BUILDID
env:
pswd: $(dockerPassword)
3. If you use Azure Container Registry, ensure you have pre-created the registry in the Azure portal. Copy the admin user name and
password shown in the Access keys section of the registry settings in Azure portal.
5. Queue a new build and watch it create and push a Docker image to your registry and the test results to Azure DevOps.
Requirements
ノ Expand table
Requirement Description
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Feedback
Was this page helpful? Yes No
Syntax
YAML
Inputs
testRunner - Test Result Format
string . Required. Allowed values: JUnit , NUnit , VSTest , XUnit . Default value: JUnit .
Specifies the format of the results files you want to publish. The following formats are
supported: CTest , JUnit , NUnit 2 , NUnit 3 , Visual Studio Test (TRX) and xUnit
2 .
subdirectories. If using VSTest as the test result format, the file type should be
changed to .trx e.g. **/TEST-*.trx
Multiple paths can be specified, separated by a new line.
Additionally accepts minimatch patterns.
When this boolean's value is true , the task reports test results from all the files against
a single test run. If the value is false , the task creates a separate test run for each test
result file.
7 Note
Use the merge test results setting to combine files from the same test framework to
ensure results mapping and duration are calculated correctly.
Optional. Specifies a name for the test run against which the results will be reported.
Variable names declared in the build or release pipeline can be used.
platform - Platform
string .
Optional. Specifies the build platform against which the test run should be reported. For
example: x64 or x86 . If you defined a variable for the platform in your build task, use it
here.
configuration - Configuration
string .
Optional. Specifies the build configuration against which the test run should be
reported. For example: Debug or Release . If you defined a variable for the configuration
in your build task, use it here.
Optional. When this boolean's value is true , the task uploads all the test result files as
attachments to the test run.
Output variables
None.
Remarks
PublishTestResults@2 is a newer version of this task that provides NUnit3 support and
support for Minimatch files patterns.
Requirements
ノ Expand table
Requirement Description
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
See also
PublishTestResults@2
Feedback
Was this page helpful? Yes No
Use this task to send a message to Azure Service Bus using a service connection (no
agent is required).
Syntax
YAML
Inputs
azureSubscription - Azure Service Bus service connection
string .
Specifies the session ID with which the message is published. For session-based queues,
the publishing fails if a value is not specified. For non session-based queues, a value
does not need to be specified.
Specifies the secret variable that contains the certificate content. This can also be a
certificate stored in an Azure key vault that is linked to a variable group used by the
release pipeline.
In Message Properties, specifies the key where the signature is. If left empty, the default
value is signature .
If set to true , this task will wait for the TaskCompleted event for the specified task
timeout.
Output variables
None.
Remarks
Use this task in an agentless job of a release pipeline to send a message to an Azure
Service Bus using a service connection (without using an agent).
7 Note
{planUri}/{projectId}/_apis/distributedtask/hubs/{hubName}/plans/{planId}/ev
ents?api-version=2.0-preview.1
**Request Body**
{ "name": "TaskCompleted", "taskId": "taskInstanceId", "jobId": "jobId",
"result": "succeeded" }
In addition, a C# helper library is available to enable live logging and managing the task
status for agentless tasks. Learn more about Async HTTP agentless tasks.
Requirements
ノ Expand table
Requirement Description
Runs on Server
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Feedback
Was this page helpful? Yes No
Use this task to send a message to Azure Service Bus using a service connection (no
agent required).
Syntax
YAML
Inputs
azureSubscription - Azure service bus connection
If set to true , this task will wait for the TaskCompleted event for the specified task
timeout.
Output variables
None.
Remarks
Use this task in an agentless job of a release pipeline to send a message to Azure
Service Bus using a service connection (without using an agent).
7 Note
{planUri}/{projectId}/_apis/distributedtask/hubs/{hubName}/plans/{planId}/ev
ents?api-version=2.0-preview.1
**Request Body**
{ "name": "TaskCompleted", "taskId": "taskInstanceId", "jobId": "jobId",
"result": "succeeded" }
See this simple cmdline application for specifics.
In addition, a C# helper library is available to enable live logging and managing the task
status for agentless tasks. Learn more about Async HTTP agentless tasks.
Requirements
ノ Expand table
Requirement Description
Runs on Server
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Feedback
Was this page helpful? Yes No
Use this task to create and upload an sdist or wheel to a PyPI-compatible index using
Twine.
Syntax
YAML
# PyPI publisher v0
# Create and upload an sdist or wheel to a PyPI-compatible index using
Twine.
- task: PyPIPublisher@0
inputs:
pypiConnection: # string. Alias: serviceEndpoint. Required. PyPI service
connection.
packageDirectory: # string. Alias: wd. Required. Python package
directory.
#alsoPublishWheel: false # boolean. Alias: wheel. Also publish a wheel.
Default: false.
Inputs
pypiConnection - PyPI service connection
Input alias: serviceEndpoint . string . Required.
Specifies the directory of the Python package that is created and published where
setup.py is present.
Output variables
None.
Remarks
) Important
The PyPI Publisher task has been deprecated. You can now publish PyPI packages
using Twine authentication and custom scripts.
Use this task to create and upload an sdist or wheel to a PyPI-compatible index using
Twine.
This task builds an sdist package by running python setup.py sdist with the Python
instance in PATH . In addition to the sdist, it can optionally build a universal wheel. It will
upload the package to a PyPI index using twine . The task will install the wheel and
twine packages with python -m pip install --user .
Requirements
ノ Expand table
Requirement Description
Demands None
Requirement Description
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Feedback
Was this page helpful? Yes No
Use this task to provide authentication for the pip client that installs Python
distributions.
Syntax
YAML
Inputs
artifactFeeds - My feeds (select below)
string .
string .
Output variables
None.
Remarks
Provides authentication for the pip client that is used to install Python distributions.
The http_proxy and no_proxy variables are case-sensitive on Linux and Mac
operating systems and must be lowercase. Attempting to use an Azure
Pipelines variable to set the environment variable will not work, as it will be
converted to uppercase. Instead, set the environment variables on the self-
hosted agent's machine and restart the agent.
Add the proxy settings to the pip config file file using proxy key.
Use the --proxy command-line option to specify proxy in the form
[user:passwd@]proxy.server:port .
Examples
variables with authentication credentials the task generates for the provided Artifacts
feeds. HelloTestPackage must be present in either myTestFeed1 or myTestFeed2 ;
otherwise, the install will fail.
For project-scoped feeds that are in a different project than where the pipeline is
running, you must manually give the project and the feed access to the pipeline's
project's build service.
YAML
- task: PipAuthenticate@1
displayName: 'Pip Authenticate'
inputs:
# Provide list of feed names which you want to authenticate.
# Project scoped feeds must include the project name in addition to the
feed name.
artifactFeeds: 'project1/myTestFeed1, myTestFeed2'
For project-scoped feeds that are in a different project than where the pipeline is
running, you must manually give the project and the feed access to the pipeline's
project's build service.
YAML
- task: PipAuthenticate@1
displayName: 'Pip Authenticate'
inputs:
# Provide list of feed names which you want to authenticate.
# Project scoped feeds must include the project name in addition to the
feed name.
artifactFeeds: 'project1/myTestFeed1, myTestFeed2'
# Setting this variable to "true" will force pip to get distributions
from official python registry first and fallback to feeds mentioned above if
distributions are not found there.
onlyAddExtraIndex: true
install will fail. If you want pypi to be consulted first, set onlyAddExtraIndex to true .
YAML
- task: PipAuthenticate@1
displayName: 'Pip Authenticate'
inputs:
# In this case, name of the service connection is "pypitest".
pythonDownloadServiceConnections: pypitest
Requirements
ノ Expand table
Requirement Description
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Feedback
Was this page helpful? Yes No
Use this task to provide authentication for the pip client that installs Python
distributions.
Syntax
YAML
Inputs
artifactFeeds - My feeds (select below)
Requirements
ノ Expand table
Requirement Description
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Feedback
Was this page helpful? Yes No
Syntax
# Python script v0
# Run a Python file or inline script.
- task: PythonScript@0
inputs:
scriptSource: 'filePath' # 'filePath' | 'inline'. Required. Script
source. Default: filePath.
scriptPath: # string. Required when scriptSource = filePath. Script
path.
#script: # string. Required when scriptSource = inline. Script.
#arguments: # string. Arguments.
# Advanced
#pythonInterpreter: # string. Python interpreter.
#workingDirectory: # string. Working directory.
#failOnStderr: false # boolean. Fail on standard error. Default: false.
Inputs
scriptSource - Script source
string . Required. Allowed values: filePath (File path), inline . Default value: filePath .
Specifies whether the script is a file in the source tree or is written inline in this task.
Specifies the path of the script to execute. Must be a fully qualified path or relative to
$(System.DefaultWorkingDirectory) .
script - Script
Specifies the arguments passed to the script execution available through sys.argv , as if
you passed them on the command line.
Specifies the absolute path to the Python interpreter to use. If not specified, the task will
use the interpreter in PATH.
Run the Use Python Version task to add a version of Python to PATH.
string .
Specifies the working directory where the script will run. If not specified, the value of
System.DefaultWorkingDirectory will be used. For builds, this variable defaults to the
root of the repository. For releases, it defaults to the root of the artifacts directory.
If set to true , this task will fail if any text is written to the stderr stream.
Output variables
None.
Remarks
By default, this task will invoke python from the system path. Run Use Python Version to
put the version you want in the system path.
Requirements
ノ Expand table
Requirement Description
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Feedback
Was this page helpful? Yes No
Use this task to authenticate uploads of Python distributions using twine. Add -r
FeedName/EndpointName --config-file $(PYPIRC_PATH) to your twine upload command.
For feeds present in this organization, use the feed name as the repository ( -r ).
Otherwise, use the endpoint name defined in the service connection.
Syntax
YAML
Inputs
artifactFeed - My feed name (select below)
string .
Specifies the Azure artifact's feed name to authenticate with twine. The authenticating
feed must be present within the organization. For project-scoped feeds, use the syntax
projectName/feedNameSelect .
string .
Output variables
None.
Remarks
Provides twine credentials to a PYPIRC_PATH environment variable for the scope of the
build. This enables you to publish Python packages to feeds with twine from your build.
YAML
- task: TwineAuthenticate@1
displayName: Twine Authenticate
inputs:
# In this case, name of the feed is 'myTestFeed' in the project
'myTestProject'. Project is needed because the feed is project scoped.
artifactFeed: myTestProject/myTestFeed
# Use command line script to 'twine upload', use -r to pass the repository
name and --config-file to pass the environment variable set by the
authenticate task.
- script: |
python -m twine upload -r myTestFeed --config-file $(PYPIRC_PATH)
dist/*.whl
The artifactFeed input will contain the project and the feed name if the feed is project
scoped. If the feed is organization scoped, only the feed name must be provided. Learn
more.
YAML
- task: TwineAuthenticate@1
displayName: Twine Authenticate
inputs:
# In this case, name of the service connection is "pypitest".
pythonUploadServiceConnection: pypitest
# Use command line script to 'twine upload', use -r to pass the repository
name and --config-file to pass the environment variable set by the
authenticate task.
- script: |
python -m twine upload -r "pypitest" --config-file $(PYPIRC_PATH)
dist/*.whl
Requirements
ノ Expand table
Requirement Description
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Feedback
Was this page helpful? Yes No
Provides twine credentials to a PYPIRC_PATH environment variable for the scope of the
build. This enables you to publish Python packages to feeds with twine from your build.
Syntax
# Python twine upload authenticate v0
# Authenticate for uploading Python distributions using twine. Add '-r
FeedName/EndpointName --config-file $(PYPIRC_PATH)' to your twine upload
command. For feeds present in this organization, use the feed name as the
repository (-r). Otherwise, use the endpoint name defined in the service
connection.
- task: TwineAuthenticate@0
inputs:
# Feeds and Authentication
#artifactFeeds: # string. Alias: feedList. My feeds (select below).
#externalFeeds: # string. Alias: externalSources. Feeds from external
organizations.
# Advanced
#publishPackageMetadata: true # boolean. Publish pipeline metadata.
Default: true.
Inputs
artifactFeeds - My feeds (select below)
Specifies the Azure artifact's feed name to authenticate with twine. The authenticating
feed must be present within the organization. For project-scoped feeds, use the syntax
projectName/feedNameSelect .
Associates this build/release pipeline's metadata (such as run # and source code
information) with the package when uploading to feeds.
Output variables
None.
Remarks
Provides twine credentials to a PYPIRC_PATH environment variable for the scope of the
build. This enables you to publish Python packages to feeds with twine from your build.
Requirement Description
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Feedback
Was this page helpful? Yes No
Syntax
# Query Azure Monitor alerts v1
# Observe the configured Azure Monitor rules for active alerts.
- task: AzureMonitor@1
inputs:
connectedServiceNameARM: # string. Required. Azure subscription.
ResourceGroupName: # string. Required. Resource group.
# Advanced
filterType: 'none' # 'resource' | 'alertrule' | 'none'. Required. Filter
type. Default: none.
#resource: # string. Required when filterType = resource. Resource.
#alertRule: # string. Required when filterType = alertrule. Alert rule.
#severity: 'Sev0,Sev1,Sev2,Sev3,Sev4' # 'Sev0' | 'Sev1' | 'Sev2' |
'Sev3' | 'Sev4'. Severity. Default: Sev0,Sev1,Sev2,Sev3,Sev4.
#timeRange: '1h' # '1h' | '1d' | '7d' | '30d'. Time range. Default: 1h.
#alertState: 'Acknowledged,New' # 'New' | 'Acknowledged' | 'Closed'.
Alert state. Default: Acknowledged,New.
#monitorCondition: 'Fired' # 'Fired ' | 'Resolved'. Monitor condition.
Default: Fired.
Inputs
connectedServiceNameARM - Azure subscription
string . Required.
string . Required.
resource - Resource
string . Required when filterType = resource .
Selects from the currently configured alert rules to query for the status.
severity - Severity
string . Allowed values: Sev0 , Sev1 , Sev2 , Sev3 , Sev4 . Default value:
Sev0,Sev1,Sev2,Sev3,Sev4 .
Filters by severity.
string . Allowed values: 1h (Past hour), 1d (Past 24 hours), 7d (Past 7 days), 30d (Past
30 days). Default value: 1h .
Output variables
None.
Remarks
To observe the configured Azure monitor rules for active alerts, use this task in an
agentless job of a release pipeline.
7 Note
The task succeeds if none of the alert rules are activated at the time of sampling.
For more information about using this task, see Approvals and gates overview.
Requirements
ノ Expand table
Requirement Description
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Feedback
Was this page helpful? Yes No
Observe the configured classic Azure Monitor rules for active alerts.
) Important
This task is deprecated and will be retired January 31, 2024. Use AzureMonitor@1.
Syntax
# Query Classic Azure Monitor alerts v0
# Observe the configured classic Azure Monitor rules for active alerts.
- task: AzureMonitor@0
inputs:
connectedServiceNameARM: # string. Required. Azure subscription.
ResourceGroupName: # string. Required. Resource group.
ResourceType: 'Microsoft.Insights/components' #
'Microsoft.Insights/components' | 'Microsoft.Web/sites' |
'Microsoft.Storage/storageAccounts' | 'Microsoft.Compute/virtualMachines'.
Required. Resource type. Default: Microsoft.Insights/components.
resourceName: # string. Required. Resource name.
alertRules: # string. Required. Alert rules.
Inputs
connectedServiceNameARM - Azure subscription
string . Required.
string . Required.
string . Required.
Output variables
None.
Requirements
ノ Expand table
Requirement Description
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Requirement Description
Feedback
Was this page helpful? Yes No
Use this task in an agentless job of a release pipeline to ensure the number of matching
items returned by a work item query is within the configured thresholds.
Syntax
YAML
Inputs
queryId - Query
string . Required.
Specifies a saved work item query within the current project to execute. Can be a built-in
or custom query.
Specifies the maximum number of matching work items from the query.
Specifies the minimum number of matching work items from the query.
Task control options
All tasks have control options in addition to their task inputs. For more information, see
Control options and common task properties.
Output variables
None.
Remarks
Use this task in an agentless job of a release pipeline to ensure the number of matching
items returned by a work item query is within the configured thresholds.
7 Note
For more information about using this task, see the Approvals and gates overview.
Requirements
ノ Expand table
Requirement Description
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Feedback
Was this page helpful? Yes No
Use this task under a deploy phase provider to create a resource dynamically.
Syntax
YAML
# Review App v0
# Use this task under deploy phase provider to create a resource
dynamically.
- task: ReviewApp@0
inputs:
resourceName: # string. Required. Resource name.
#baseEnvironmentName: # string. Environment name.
#reviewResourceName: # string. Review Resource Name.
Inputs
resourceName - Resource name
string . Required.
Specifies the name of an existing resource in the environment, which will be used for
resource-type information.
Remarks
Use this task under a deploy phase provider to create a resource dynamically.
Requirements
ノ Expand table
Requirement Description
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Feedback
Was this page helpful? Yes No
Use this task to run the scanner and upload the results to the SonarQube server.
Syntax
YAML
Inputs
jdkversion - JDK version source for analysis
Select the wanted Java version for the analysis : You can choose with either Self provided
JAVA_HOME which will pick up the value of this env variable, or you can choose the
built-in JAVA_HOME_XX_X64 value on hosted agent. Default value is
JAVA_HOME_11_X64, however if you choose either of the proposed value and they are
not available, JAVA_HOME value will be picked up instead.
Output variables
None.
Remarks
This task is to be used with the new version of the Prepare Analysis Configuration task.
Requirements
ノ Expand table
Requirement Description
Demands Self-hosted agents must have capabilities that match the following demands
to run jobs that use this task: java
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Command Any
restrictions
See also
SonarQube Azure DevOps Integration
Feedback
Was this page helpful? Yes No
Use this task to run the scanner and upload the results to the SonarQube server.
Syntax
YAML
Inputs
None.
Output variables
None.
Remarks
This task is to be used with the new version of the Prepare Analysis Configuration task.
Requirements
ノ Expand table
Requirement Description
Demands Self-hosted agents must have capabilities that match the following demands
to run jobs that use this task: java
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Command Any
restrictions
See also
SonarQube Azure DevOps Integration
Feedback
Was this page helpful? Yes No
Syntax
# Run functional tests v1
# 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 job 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.
- task: RunVisualStudioTestsusingTestAgent@1
inputs:
# Setup Options
testMachineGroup: # string. Required. Machines.
dropLocation: # string. Required. Test Drop Location.
# Execution Options
testSelection: 'testAssembly' # 'testAssembly' | 'testPlan'. Required.
Test Selection. Default: testAssembly.
#testPlan: # string. Required when testSelection = testPlan. Test Plan.
#testSuite: # string. Required when testSelection = testPlan. Test
Suite.
#testConfiguration: # string. Required when testSelection = testPlan.
Test Configuration.
sourcefilters: '**\*test*.dll' # string. Required when testSelection =
testAssembly. Test Assembly. Default: **\*test*.dll.
#testFilterCriteria: # string. Optional. Use when testSelection =
testAssembly. Test Filter criteria.
#runSettingsFile: # string. Run Settings File.
#overrideRunParams: # string. Override Test Run Parameters.
#codeCoverageEnabled: false # boolean. Code Coverage Enabled. Default:
false.
#customSlicingEnabled: false # boolean. Distribute tests by number of
machines. Default: false.
# Reporting Options
#testRunTitle: # string. Test Run Title.
#platform: # string. Platform.
#configuration: # string. Configuration.
#testConfigurations: # string. Test Configurations.
#autMachineGroup: # string. Application Under Test Machines.
Inputs
testMachineGroup - Machines
string . Required.
A comma separated list of machine FQDNs or IP addresses, which may include the port
number. The maximum is 32 machines or 32 agents. The list items can be:
string . Required.
Specifies the location on the test machine(s) where the test binaries have been copied
by a Windows Machine File Copy or an Azure File Copy task. System stage variables
from the test agent machines can be used to specify the drop location. Examples:
c:\tests and %systemdrive%\Tests .
Specifies how tests are run: using test assemblies or Test Plan.
Specifies the test binaries to run tests on. Wildcards can be used. For example,
**\*test*.dll; for all .dll files containing test in the file name.
The filter that specfies the tests to execute within the test assembly files. Works the
same way as the /TestCaseFilter option in vstest.console.exe . Example:
Owner=james&Priority=1 .
Specifies the file path to the runsettings or testsettings file to use with the tests.
string .
Specifies the override parameters that are defined in the TestRunParameters section of
the runsettings file or the Properties section of the testsettings file. Example:
AppURL=$(DeployURL);Port=8080 .
7 Note
The properties specified in the testsettings file can be accessed via TestContext
using Test Agent 2017 Update 4 or higher.
codeCoverageEnabled - Code Coverage Enabled
boolean . Default value: false .
When the value of this boolean is set to true , the tests are distributed based on the
number of machines provided instead of the number of test containers.
7 Note
string .
platform - Platform
string .
Specifies the platform against which the tests should be reported. If you have defined a
variable for platform in your build task, use the variable as the value.
configuration - Configuration
string .
Specifies the configuration against which the tests should be reported. If you have
defined a variable for configuration in your build task, use the variable as the value.
string .
Optional. Associates a test case filter against a test configuration ID. Syntax: <Filter1>:
<Id1>;DefaultTestConfiguration:<Id3> . Example: FullyQualifiedName~Chrome:12 .
autMachineGroup - Application Under Test Machines
string .
Output variables
None.
Requirements
ノ Expand table
Requirement Description
Runs on Agent
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Feedback
Was this page helpful? Yes No
Provide product feedback
ServiceFabricDeploy@1 - Service Fabric
application deployment v1 task
Article • 04/29/2024
Use this task to deploy a Service Fabric application to a cluster. This task deploys an
Azure Service Fabric application to a cluster according to the settings defined in the
publish profile.
7 Note
This task does not support Azure Resource Manager authentication with workflow
identity federation.
Syntax
YAML
Inputs
applicationPackagePath - Application Package
string . Required.
Specifies the path to the application package that is to be deployed. Variables and
wildcards can be used in the path.
string . Required.
Specifies the Azure Service Fabric service connection to be used to connect to the
cluster. The settings defined in this referenced service connection override those defined
in the publish profile. Choose Manage to register a new service connection.
To connect to the cluster, the service fabric task uses the machine cert store to store the
information about the certificate. If two releases run together on one machine using the
same certificate, they will start properly. However, if one of the tasks is complete, then
the certificate from the machine cert store will be cleaned up, which affects the second
release.
Optional. Specifies the path to the publish profile file that defines the settings to use.
Variables and wildcards can be used in the path. Learn more about how to create
publish profiles in Visual Studio.
string .
Optional. Specifies the path to the application parameters file. Variables and wildcards
can be used in the path. If specified, this overrides the value in the publish profile. Learn
more about how to create an application parameters file in Visual Studio.
Optional. Specifies the variables defined in the build or release pipeline are matched
against the Parameter Name entries in the application manifest file. Learn more about
how to create an application parameters file in Visual Studio. Example:
<Parameters>
<Parameter Name="SampleApp_PartitionCount" Value="1" />
<Parameter Name="SampleApp_InstanceCount" DefaultValue="-1" />
</Parameters>
If your application has a parameter defined as in the above example, and you want to
change the partition count to 2 , you can define a release pipeline or an environment
variable SampleApp_PartitionCount and its value as 2 .
7 Note
If the same variables are defined in the release pipeline and in the environment,
then the environment variables will supersede the release pipeline variables.
copyPackageTimeoutSec - CopyPackageTimeoutSec
string .
Optional. Specifies the timeout in seconds for copying application package to the image
store. If specified, this overrides the value in the publish profile.
registerPackageTimeoutSec - RegisterPackageTimeoutSec
string .
SameAppTypeAndVersion .
Overwrites behavior if an application exists in the cluster with the same name and
upgrades have not been configured.
Never will not remove the existing application. This is the default behavior.
Always will remove the existing application, even if its application type and version is
SameAppTypeAndVersion will remove the existing application only if its application type
Optional. Specifies whether an upgrade will be skipped if the same application type and
version already exists in the cluster; otherwise, the upgrade fails during validation. If
enabled, re-deployments are idempotent.
Optional. Specifies whether the package should be validated or not before deployment.
Learn more about package validation.
Optional. Upgrades by using a diff package that contains only the updated application
files, the updated application manifest, and the service manifest files.
A diff package is created by comparing the package specified in the application package
input against the package that is currently registered in the target cluster. If a service
version in the cluster's current package is the same as the new package, then this service
package will be removed from the new application package. Learn more about diff
packages.
Optional. Overrides all upgrade settings with either specified values or the default value
(if not specified). Learn more about upgrade settings.
Optional. Indicates whether all unused versions of the application type will be removed
after an upgrade.
FailureAction - FailureAction
UpgradeReplicaSetCheckTimeoutSec - UpgradeReplicaSetCheckTimeoutSec
true .
TimeoutSec - TimeoutSec
ForceRestart - ForceRestart
boolean . Optional. Use when overridePublishProfileSettings = true && isUpgrade =
HealthCheckRetryTimeoutSec - HealthCheckRetryTimeoutSec
HealthCheckWaitDurationSec - HealthCheckWaitDurationSec
HealthCheckStableDurationSec - HealthCheckStableDurationSec
string . Optional. Use when overridePublishProfileSettings = true && isUpgrade =
UpgradeDomainTimeoutSec - UpgradeDomainTimeoutSec
ConsiderWarningAsError - ConsiderWarningAsError
DefaultServiceTypeHealthPolicy - DefaultServiceTypeHealthPolicy
string . Optional. Use when overridePublishProfileSettings = true && isUpgrade =
MaxPercentUnhealthyDeployedApplications
string . Optional. Use when overridePublishProfileSettings = true && isUpgrade =
true && upgradeMode = Monitored .
UpgradeTimeoutSec - UpgradeTimeoutSec
string . Optional. Use when overridePublishProfileSettings = true && isUpgrade =
ServiceTypeHealthPolicyMap - ServiceTypeHealthPolicyMap
Specifies a Docker registry service connection. Required for commands that need to
authenticate with a registry.
7 Note
The task tries to encrypt the registry secret before transmitting it to the service
fabric cluster. However, the task needs the cluster's server certificate to be installed
on the agent machine. If the certificate is not present, the registry secret will not be
encrypted.
7 Note
The task will try to encrypt the registry secret before transmitting it to the service
fabric cluster. However, the task needs the cluster's server certificate to be installed
on the agent machine. If the certificate is not present, the registry secret will not be
encrypted.
UsernamePassword .
UsernamePassword .
Specifies the password for the Docker registry. If the password is not encrypted, you
should use a custom release pipeline secret variable to store it.
Output variables
None.
Remarks
Use this task to deploy a Service Fabric application to a cluster. This task deploys an
Azure Service Fabric application to a cluster according to the settings defined in the
publish profile.
Service Fabric
This task uses a Service Fabric installation to connect and deploy to a Service Fabric
cluster. Download and install Service Fabric on the build agent.
Requirements
ノ Expand table
Requirement Description
Demands Self-hosted agents must have capabilities that match the following demands
to run jobs that use this task: Cmd
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Command Any
restrictions
Feedback
Was this page helpful? Yes No
Use this task to deploy a Docker Compose application to a Service Fabric cluster. This
task deploys an Azure Service Fabric application to a cluster according to the settings
defined in the Compose file.
7 Note
This task does not support Azure Resource Manager authentication with workflow
identity federation.
Syntax
# Service Fabric Compose deploy v0
# Deploy a Docker Compose application to an Azure Service Fabric cluster.
- task: ServiceFabricComposeDeploy@0
inputs:
clusterConnection: # string. Alias: serviceConnectionName. Required.
Cluster Service Connection.
composeFilePath: '**/docker-compose.yml' # string. Required. Compose
File Path. Default: **/docker-compose.yml.
applicationName: 'fabric:/Application1' # string. Required. Application
Name. Default: fabric:/Application1.
# Registry Settings
registryCredentials: 'AzureResourceManagerEndpoint' #
'AzureResourceManagerEndpoint' | 'ContainerRegistryEndpoint' |
'UsernamePassword' | 'None'. Required. Registry Credentials Source. Default:
AzureResourceManagerEndpoint.
#dockerRegistryConnection: # string. Alias: dockerRegistryEndpointName.
Optional. Use when registryCredentials = ContainerRegistryEndpoint. Docker
Registry Service Connection.
azureSubscription: # string. Alias: azureSubscriptionEndpoint. Required
when registryCredentials = AzureResourceManagerEndpoint. Azure subscription.
#registryUserName: # string. Optional. Use when registryCredentials =
UsernamePassword. Registry User Name.
#registryPassword: # string. Optional. Use when registryCredentials =
UsernamePassword. Registry Password.
#passwordEncrypted: true # boolean. Optional. Use when
registryCredentials = UsernamePassword. Password Encrypted. Default: true.
# Advanced Settings
#upgrade: false # boolean. Upgrade. Default: false.
#deployTimeoutSec: # string. Deploy Timeout (s).
#removeTimeoutSec: # string. Remove Timeout (s).
#getStatusTimeoutSec: # string. Get Status Timeout (s).
Inputs
clusterConnection - Cluster Service Connection
Specifies an Azure Service Fabric service connection to be used to connect to the cluster.
Choose Manage to register a new service connection.
Specifies the path to the compose file that is to be deployed. Variables and wildcards
can be used in the path. Example:
$(System.DefaultWorkingDirectory)/**/drop/projectartifacts/**/docker-compose.yml .
7 Note
Specifies the Service Fabric application name of the deployed application. Use fabric:/
as a prefix. Application names within a Service Fabric cluster must be unique.
Specifies how credentials for the Docker container registry will be provided to the
deployment task. The allowed values are:
AzureResourceManagerEndpoint (Azure Resource Manager service connection): uses
azureSubscription to obtain a service principal ID and key for an Azure Container
Registry.
ContainerRegistryEndpoint (Container Registry service connection): uses
registryPassword to store the username and password for the Docker registry.
Thumbprint in the Cluster Connection is installed on the build agent, the certificate
will be used to encrypt the password. Otherwise, the password will not be
encrypted and will be sent in clear text.
None : No registry credentials are provided. This is used for accessing public
container registries.
Specifies the password for the Docker registry. If the password is not encrypted, it is
recommended that you use a custom release pipeline secret variable to store it.
true .
upgrade - Upgrade
string .
string .
Output variables
None.
Remarks
Use this task to deploy a Docker-compose application to a Service Fabric cluster. This
task deploys an Azure Service Fabric application to a cluster according to the settings
defined in the compose file.
7 Note
This task is currently in preview and requires a preview version of Service Fabric that
supports compose deploy. See Docker Compose deployment support in Azure
Service Fabric.
Service Fabric
This task uses a Service Fabric installation to connect and deploy to a Service Fabric
cluster.
Download and install Azure Service Fabric Core SDK on the build agent.
Requirements
ノ Expand table
Requirement Description
Demands Self-hosted agents must have capabilities that match the following demands
to run jobs that use this task: Cmd
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Command Any
Requirement Description
restrictions
Feedback
Was this page helpful? Yes No
Use this task to run a PowerShell script within the context of an Azure Service Fabric
cluster connection. Runs any PowerShell command or script in a PowerShell session that
has a Service Fabric cluster connection initialized.
Syntax
# Service Fabric PowerShell v1
# Run a PowerShell script in the context of an Azure Service Fabric cluster
connection.
- task: ServiceFabricPowerShell@1
inputs:
clusterConnection: # string. Alias: serviceConnectionName. Required.
Cluster Service Connection.
ScriptType: 'FilePath' # 'FilePath' | 'InlineScript'. Required. Script
Type. Default: FilePath.
#ScriptPath: # string. Optional. Use when ScriptType = FilePath. Script
Path.
#Inline: # string. Optional. Use when ScriptType = InlineScript. Inline
Script.
#ScriptArguments: # string. Script Arguments.
Inputs
clusterConnection - Cluster Service Connection
Specifies the Azure Service Fabric cluster which will have an established service
connection when the specified PowerShell script is executed.
string . Required. Allowed values: FilePath (Script File Path), InlineScript (Inline
Specifies the path to the PowerShell script to run. Can include wildcards and variables.
Example: $(system.defaultworkingdirectory)/**/drop/projectartifacts/**/docker-
compose.yml .
7 Note
string . Optional. Use when ScriptType = InlineScript . Default value: # You can write
your PowerShell scripts inline here. \n# You can also pass predefined and custom
variables to this script using arguments .
Specifies the PowerShell commands to run on the build agent. Learn more about
PowerShell tasks.
Output variables
None.
Remarks
Use this task to run a PowerShell script within the context of an Azure Service Fabric
cluster connection. Runs any PowerShell command or script in a PowerShell session that
has a Service Fabric cluster connection initialized.
Service Fabric
This task uses a Service Fabric installation to connect and deploy to a Service Fabric
cluster.
Azure Service Fabric Core SDK on the build agent.
Requirements
ノ Expand table
Requirement Description
Demands Self-hosted agents must have capabilities that match the following demands
to run jobs that use this task: Cmd
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Command Any
restrictions
Feedback
Was this page helpful? Yes No
Syntax
YAML
# Shell script v2
# Run a shell script using Bash.
- task: ShellScript@2
inputs:
scriptPath: # string. Required. Script Path.
#args: # string. Arguments.
# Advanced
#disableAutoCwd: false # boolean. Specify Working Directory. Default:
false.
#cwd: # string. Optional. Use when disableAutoCwd = true. Working
Directory.
#failOnStandardError: false # boolean. Fail on Standard Error. Default:
false.
Inputs
scriptPath - Script Path
string . Required.
Specifies the relative path from the repo root to the shell script file that you want to run.
args - Arguments
string .
Specifies the working directory where the task runs the script. If the value is left empty,
the task defaults to the folder where the script is located.
cwd - Working Directory
string . Optional. Use when disableAutoCwd = true .
Specifies the working directory where the script is run. If the value is left empty, the task
uses the root of the repo (build) or artifacts (release), which is
$(System.DefaultWorkingDirectory) .
If the value is true , the task will fail if errors are written to the StandardError stream.
Output variables
None.
Remarks
To learn more about defining release variables in a script, see Define and modify your
release variables in a script
Examples
Create test.sh at the root of your repo. We recommend creating this file from a Linux
environment (such as a real Linux machine or Windows Subsystem for Linux) so that line
endings are correct. Also, don't forget to chmod +x test.sh before you commit it.
sh
#!/bin/bash
echo "Hello World"
echo "AGENT_WORKFOLDER is $AGENT_WORKFOLDER"
echo "AGENT_WORKFOLDER contents:"
ls -1 $AGENT_WORKFOLDER
echo "AGENT_BUILDDIRECTORY is $AGENT_BUILDDIRECTORY"
echo "AGENT_BUILDDIRECTORY contents:"
ls -1 $AGENT_BUILDDIRECTORY
echo "SYSTEM_HOSTTYPE is $SYSTEM_HOSTTYPE"
echo "Over and out."
Add the following task to your pipeline to run the previous script.
yml
- task: ShellScript@2
inputs:
scriptPath: 'test.sh'
Requirements
ノ Expand table
Requirement Description
Demands Self-hosted agents must have capabilities that match the following demands
to run jobs that use this task: sh
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Command Any
restrictions
Feedback
Was this page helpful? Yes No
Use this task to deploy a SQL Server database using DACPAC or SQL scripts.
Syntax
# This task is supported on classic release pipelines only.
# Use the classic designer to add and configure this task in a classic
release pipeline.
# See the following Inputs section for details on the inputs that this task
supports.
Inputs
TaskType - Deploy SQL Using
string . Required. Allowed values: dacpac (Sql Dacpac), sqlQuery (Sql Query File),
sqlInline (Inline Sql). Default value: dacpac .
Specifies the way you want to deploy the database: using Dacpac or SQL Scripts.
Specifies the location of the DACPAC file on the target machines or on a UNC path, like
\\BudgetIT\Web\Deploy\FabrikamDB.dacpac . The UNC path should be accessible to the
used. For example, **/*.dacpac for the DACPAC file that's present in all sub folders.
Specifies the option to connect to the target SQL Server database. You can provide the
SQL Server database details, the SQL Server connection string, or the publish profile
XML file.
ServerName - Server Name
string . Required when TargetMethod = server || TaskType = sqlQuery || TaskType =
the machine.
sqlInline .
AuthScheme - Authentication
string . Required when TargetMethod = server || TaskType = sqlQuery || TaskType =
Specifies the authentication mode for connecting to the SQL Server. In Windows
authentication mode, the account used to configure the deployment agent is used to
connect to the SQL Server. In SQL Server authentication mode, the SQL login and
password must be provided in the parameters below.
Specifies the SQL login to connect to the SQL Server. This option is only available if SQL
Server authentication mode has been selected.
Specifies the password of the SQL login. This option is only available if SQL Server
authentication mode has been selected.
ConnectionString - Connection String
string . Required when TargetMethod = connectionString .
ID=AccountPlaceholder;Password=PasswordPlaceholder; .
Specifies additional SqlPackage.exe arguments that will be applied when deploying the
SQL Server database, like /p:IgnoreAnsiNulls=True or /p:IgnoreComments=True . These
arguments will override the settings in the publish profile XML file (if provided).
Specifies additional Invoke-Sqlcmd arguments that are applied when deploying the SQL
Server database.
Output variables
None.
Requirements
ノ Expand table
Requirement Description
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Feedback
Was this page helpful? Yes No
) Important
This task is deprecated and will be retired January 31, 2024. Use IIS Web App
Deployment Using WinRM - Viual Studio Marketplace .
Syntax
# SQL Server database deploy (Deprecated) v1
# Deploy a SQL Server database using DACPAC.
- task: SqlServerDacpacDeployment@1
inputs:
EnvironmentName: # string. Required. Machines.
#AdminUserName: # string. Admin Login.
#AdminPassword: # string. Password.
#Protocol: # 'Http' | 'Https'. Protocol.
#TestCertificate: true # boolean. Optional. Use when Protocol = Https.
Test Certificate. Default: true.
# Deployment
DacpacFile: # string. Required. DACPAC File.
# Target
TargetMethod: 'server' # 'server' | 'connectionString' |
'publishProfile'. Required. Specify SQL Using. Default: server.
ServerName: 'localhost' # string. Required when TargetMethod = server.
Server Name. Default: localhost.
DatabaseName: # string. Required when TargetMethod = server. Database
Name.
#SqlUsername: # string. Optional. Use when TargetMethod = server. SQL
Username.
#SqlPassword: # string. Optional. Use when TargetMethod = server. SQL
Password.
#ConnectionString: # string. Required when TargetMethod =
connectionString. Connection String.
#PublishProfile: # string. Publish Profile.
#AdditionalArguments: # string. Additional Arguments.
# Advanced
#DeployInParallel: true # boolean. Deploy in Parallel. Default: true.
#ResourceFilteringMethod: 'machineNames' # 'machineNames' | 'tags'.
Select Machines By. Default: machineNames.
#MachineFilter: # string. Deploy to Machines.
Inputs
EnvironmentName - Machines
string . Required.
string .
AdminPassword - Password
string .
Specifies the administrator password for the target machines. Variables defined in build
or release definitions are accepted as $(passwordVariable) . You can mark the variable
type as secret to secure it.
Protocol - Protocol
Specifies the protocol to use for the WinRM connection with the machine(s). The default
value is HTTPS .
Specifies the location of the DACPAC file on the target machines or on a UNC path, like
\\BudgetIT\Web\Deploy\FabrikamDB.dacpac . The UNC path should be accessible to the
Specifies the option to connect to the target SQL Server database. You can provide SQL
Server database details, a SQL Server connection string, or a publish profile XML file.
machine.
If the SQL Server login is specified, it is used to connect to the SQL Server. The default,
Integrated Authentication, uses the machine administrator's credentials.
If the SQL Server login user name is specified, provide the SQL Server password. The
default, Integrated Authentication, uses the machine administrator's credentials.
ConnectionString - Connection String
ID=AccountPlaceholder;Password=PasswordPlaceholder; .
Provides fine-grained control over SQL Server database creation or upgrades. Specifies
the path to the publish profile XML file on the target machine or on a UNC share that is
accessible by the machine administrator's credentials.
string .
When set to true , runs the database deployment task in parallel on the target
machines.
machineNames .
string .
This input is only valid for machine groups and is not supported for a flat list of
machines or output variables yet.
Specifies a list of machines, like dbserver.fabrikam.com, webserver.fabrikam.com,
192.168.12.34 , or tags, like Role:DB; OS:Win8.1 . If multiple tags are provided, the task
runs in all machines with the specified tags. For Azure Resource Groups, provide the
virtual machine's name, like ffweb or ffdb . The default runs the task in all machines.
Output variables
None.
Requirements
ノ Expand table
Requirement Description
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Feedback
Was this page helpful? Yes No
Use this task to run shell commands or a script on a remote machine using SSH. This
task enables you to connect to a remote machine using SSH and run commands or a
script.
Syntax
YAML
# SSH v0
# Run shell commands or a script on a remote machine using SSH.
- task: SSH@0
inputs:
sshEndpoint: # string. Required. SSH service connection.
runOptions: 'commands' # 'commands' | 'script' | 'inline'. Required.
Run. Default: commands.
commands: # string. Required when runOptions = commands. Commands.
#scriptPath: # string. Required when runOptions = script. Shell script
path.
#inline: # string. Required when runOptions = inline. Inline Script.
#interpreterCommand: '/bin/bash' # string. Optional. Use when runOptions
= inline. Interpreter command. Default: /bin/bash.
#args: # string. Optional. Use when runOptions = script. Arguments.
# Advanced
#failOnStdErr: true # boolean. Fail on STDERR. Default: true.
#interactiveSession: false # boolean. Enable interactive session.
Default: false.
readyTimeout: '20000' # string. Required. SSH handshake timeout.
Default: 20000.
#interactiveKeyboardAuthentication: false # boolean. Use interactive-
keyboard authentication. Default: false.
Inputs
sshEndpoint - SSH service connection
string . Required.
Specifies the name of an SSH service connection containing connection details for the
remote machine. The hostname or IP address of the remote machine, the port number,
and the user name are required to create an SSH service connection.
The private key and the passphrase must be specified for authentication.
A password can be used to authenticate to remote Linux machines, but this is not
supported for macOS or Windows systems.
runOptions - Run
string . Required. Allowed values: commands , script (Script File), inline (Inline Script).
commands - Commands
Specifies the shell commands to run on the remote machine. This parameter is available
only when Commands is selected for the Run option. Enter each command together
with its arguments on a new line of the multi-line textbox. To run multiple commands
together, enter them on the same line separated by semicolons. Example: cd
/home/user/myFolder;build .
7 Note
Each command runs in a separate process. If you want to run a series of commands
that are interdependent (for example, changing the current folder before executing
a command), use the Inline Script option instead.
Specifies the path to the shell script file to run on the remote machine. This parameter is
available only when Shell script is selected for the Run option.
args - Arguments
string . Optional. Use when runOptions = script .
Specifies the arguments to pass to the shell script. This parameter is available only when
Shell script is selected for the Run option.
If the value is true , the build fails when the remote commands or script write to STDERR .
Starts an interactive session. Password requests are filled by the user's password.
Interactive sessions can be useful for running commands, such as sudo .
Specifies how long (in milliseconds) the task waits for the SSH handshake to complete.
Output variables
None.
Remarks
Use this task to run shell commands or a script on a remote machine using SSH. This
task enables you to connect to a remote machine using SSH and run commands or a
script.
Prerequisites
The task supports use of an SSH key pair to connect to the remote machine(s).
The public key must be pre-installed or copied to the remote machine(s).
Supported algorithms
Encryption algorithms
aes256-cbc
aes192-cbc
aes128-cbc
blowfish-cbc
3des-cbc
arcfour256
arcfour128
cast128-cbc
arcfour
aes256-ctr
aes192-ctr
aes128-ctr
For OpenSSL v1.0.1 and higher, NodeJS v0.11.12 and higher (on agent):
aes128-gcm
[email protected]
aes256-gcm
[email protected]
Requirements
ノ Expand table
Requirement Description
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
See also
Install SSH Key task
Copy Files Over SSH
Blog post SSH build task
Feedback
Was this page helpful? Yes No
Syntax
YAML
# Universal packages v0
# Download or publish Universal Packages.
- task: UniversalPackages@0
inputs:
command: 'download' # 'download' | 'publish'. Required. Command.
Default: download.
downloadDirectory: '$(System.DefaultWorkingDirectory)' # string.
Required when command = download. Destination directory. Default:
$(System.DefaultWorkingDirectory).
#publishDirectory: '$(Build.ArtifactStagingDirectory)' # string.
Required when command = publish. Path to file(s) to publish. Default:
$(Build.ArtifactStagingDirectory).
# Feed & package details
feedsToUse: 'internal' # 'internal' | 'external'. Alias:
internalOrExternalDownload. Required when command = download. Feed location.
Default: internal.
#externalFeedCredentials: # string. Alias: externalEndpoint. Optional.
Use when internalOrExternalDownload = external && command = download.
organization/collection connection.
#vstsFeed: # string. Alias: feedListDownload. Required when
internalOrExternalDownload = internal && command = download. Feed.
#vstsFeedPackage: # string. Alias: packageListDownload. Required when
internalOrExternalDownload = internal && command = download. Package name.
#vstsPackageVersion: # string. Alias: versionListDownload. Required when
internalOrExternalDownload = internal && command = download. Version.
#feedDownloadExternal: # string. Required when
internalOrExternalDownload = external && command = download. Feed (or
Project/Feed if the feed was created in a project).
#packageDownloadExternal: # string. Required when
internalOrExternalDownload = external && command = download. Package name.
#versionDownloadExternal: # string. Required when
internalOrExternalDownload = external && command = download. Version.
# Feed & package details
#feedsToUsePublish: 'internal' # 'internal' | 'external'. Alias:
internalOrExternalPublish. Required when command = publish. Feed location.
Default: internal.
#publishFeedCredentials: # string. Alias: externalEndpoints. Required
when internalOrExternalPublish = external && command = publish.
organization/collection connection.
#vstsFeedPublish: # string. Alias: feedListPublish. Required when
internalOrExternalPublish = internal && command = publish. Destination Feed.
#vstsFeedPackagePublish: # string. Alias: packageListPublish. Required
when internalOrExternalPublish = internal && command = publish. Package
name.
#feedPublishExternal: # string. Required when internalOrExternalPublish
= external && command = publish. Feed (or Project/Feed if the feed was
created in a project).
#packagePublishExternal: # string. Required when
internalOrExternalPublish = external && command = publish. Package name.
#versionOption: 'patch' # 'major' | 'minor' | 'patch' | 'custom'. Alias:
versionPublishSelector. Required when command = publish. Version. Default:
patch.
#versionPublish: # string. Required when versionPublishSelector = custom
&& command = publish. Custom version.
#packagePublishDescription: # string. Optional. Use when command =
publish. Description.
# Advanced
#publishPackageMetadata: true # boolean. Optional. Use when command =
publish && internalOrExternalPublish = internal. Publish pipeline metadata.
Default: true.
#verbosity: 'None' # 'None' | 'Trace' | 'Debug' | 'Information' |
'Warning' | 'Error' | 'Critical'. Verbosity. Default: None.
# Output
#publishedPackageVar: # string. Optional. Use when command = publish.
Package Output Variable.
Inputs
command - Command
string . Required. Allowed values: download , publish . Default value: download .
Specifies the folder path where the task downloads the package's contents.
Specifies the credentials to use for external registries located in the selected
NuGet.config . For feeds in this organization or collection, leave this blank; the build's
vstsFeed - Feed
Includes the selected feed. You must have Azure Artifacts installed and licensed to select
a feed here. Specifies the FeedName for an organization-scoped feed and
projectName/FeedName or ProjectID/FeedID for a project-scoped feed.
vstsPackageVersion - Version
Specifies the package version or uses a variable containing the version to download.
This entry can also be a wildcard expression, such as * , to get the highest version.
Examples: 1.* gets the highest version with major version 1, and 1.2.* gets the highest
patch release with major version 1 and minor version 2.
versionDownloadExternal - Version
Specifies the package version or uses a variable containing the version to download.
This entry can also be a wildcard expression, such as * , to get the highest version.
Examples: 1.* gets the highest version with major version 1, and 1.2.* gets the highest
patch release with major version 1 and minor version 2. Wildcard patterns are not
supported with pre-release packages.
Associates this build/release pipeline's metadata (such as run # and source code
information) with the package.
If the feed was created in a project, the value should be Project/Feed , where Project is
the project's name or ID, and Feed is the feed's name. If the feed was not created in a
project, the value should be only the feed name.
versionOption - Version
Specifies a version increment strategy. The custom value to input your package version
manually. For new packages, the first version will be 1.0.0 if you specify major , 0.1.0 if
you specify minor , or 0.0.1 if you specify patch . See the Semantic Versioning spec for
more information.
packagePublishDescription - Description
Specifies the description of the package contents and/or the changes made in this
version of the package.
verbosity - Verbosity
string . Allowed values: None , Trace , Debug , Information , Warning , Error , Critical .
Specifies a name for the variable that will contain the published package name and
version.
Output variables
None.
Remarks
Use this task to download, or package and publish Universal Packages.
Examples
The simplest way to get started with the Universal Package task is to use the Pipelines
task editor to generate the YAML. You can then copy the generated code into your
project's azure-pipelines.yml file. In this example, the sample demonstrates how to
quickly generate the YAML using a pipeline that builds a GatsbyJS progressive web app
(PWA).
Universal Packages are a useful way to both encapsulate and version a web app.
Packaging a web app into a Universal Package enables quick rollbacks to a specific
version of your site and eliminates the need to build the site in the deployment pipeline.
This example pipeline demonstrates how to fetch a tool from a feed within your project.
The Universal Package task is used to download the tool, run a build, and again uses the
Universal Package task to publish the entire compiled GatsbyJS PWA to a feed as a
versioned Universal Package.
Download a package with the Universal Package task
The second task in the sample project uses the Universal Package task to fetch a tool,
imagemagick, from a feed that is within a different project in the same organization. The
tool, imagemagick, is required by the subsequent build step to resize images.
1. Add the Universal Package task by clicking the plus icon, typing "universal" in the
search box, and clicking the Add button to add the task to your pipeline.
2. Click the newly added Universal Package task and the Command to Download .
4. Select a source Feed that contains the tool, set the Package name, and choose
Version of the imagemagick tool from the source Feed.
5. After completing the fields, click View YAML to see the generated YAML.
6. The Universal Package task builder generates simplified YAML that contains non-
default values. Copy the generated YAML into your azure-pipelines.yml file at the
root of your project's git repo.
YAML
1. Add another Universal Package task to the end of the pipeline by clicking the plus
icon, typing "universal" in the search box, and clicking the Add button to add the
task to your pipeline. This task gathers all of the production-ready assets produced
by the Run gatsby build step, produce a versioned Universal Package, and publish
the package to a feed.
2. Set the Command to Publish .
3. Set Path to file(s) to publish to the directory containing your GatsbyJS project's
package.json .
4. Choose a destination feed, a package name, and set your versioning strategy.
6. Copy the resulting YAML into your azure-pipelines.yml file as before. The YAML
for this sample project displays below.
YAML
This example demonstrated how to use the Pipelines task builder to quickly generate
the YAML for the Universal Package task, which can then be placed into your azure-
pipelines.yml file. The Universal Package task builder supports all of the advanced
7 Note
Requirements
ノ Expand table
Requirement Description
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Feedback
Was this page helpful? Yes No
Use this task in a build pipeline to automatically update the versions of a packaged
Service Fabric app. This task appends a version suffix to all service and app versions,
specified in the manifest files, in an Azure Service Fabric app package.
Syntax
# Update Service Fabric App Versions v1
# Automatically updates the versions of a packaged Service Fabric
application.
- task: ServiceFabricUpdateAppVersions@1
inputs:
applicationPackagePath: # string. Required. Application Package.
versionSuffix: '.$(Build.BuildNumber)' # string. Required. Version
Value. Default: .$(Build.BuildNumber).
#versionBehavior: 'Append' # 'Append' | 'Replace'. Version Behavior.
Default: Append.
#updateOnlyChanged: false # boolean. Update only if changed. Default:
false.
#pkgArtifactName: # string. Optional. Use when updateOnlyChanged = true.
Package Artifact Name.
#logAllChanges: true # boolean. Optional. Use when updateOnlyChanged =
true. Log all changes. Default: true.
#compareType: 'LastSuccessful' # 'LastSuccessful' | 'Specific'.
Optional. Use when updateOnlyChanged = true. Compare against. Default:
LastSuccessful.
#buildNumber: # string. Optional. Use when compareType = Specific. Build
Number.
Inputs
applicationPackagePath - Application Package
string . Required.
Specifies the location of the Service Fabric application package to be deployed to the
cluster. Example: $(system.defaultworkingdirectory)/**/drop/applicationpackage .
Variables and wildcards can be used in the path.
versionSuffix - Version Value
string . Required. Default value: .$(Build.BuildNumber) .
Tip
You can modify the build number format directly or use a logging command to
dynamically set a variable in any format. For example, you can use
$(VersionSuffix) defined in a PowerShell task:
$versionSuffix = ".$([DateTimeOffset]::UtcNow.ToString('yyyyMMdd.HHmmss'))"
Appends the version value to existing values in the manifest files or replaces them.
Incrementally updates only the packages that have changed. Use the deterministic
compiler flag to ensure builds with the same inputs produce the same outputs.
Specifies the name of the artifact containing the application package from the previous
build.
Compares all files in every package and logs if the file was added, removed, or if its
content changed. Otherwise, compares files in a package only until the first change is
found for faster performance.
compareType - Compare against
string . Optional. Use when updateOnlyChanged = true . Allowed values: LastSuccessful
Compares against the last completed and successful build or against a specific build.
Specifies the build number for comparison if the task is comparing against a specific
build.
Output variables
None.
Requirements
ノ Expand table
Requirement Description
Runs on Agent
Demands Self-hosted agents must have capabilities that match the following demands
to run jobs that use this task: Cmd
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Command Any
restrictions
Feedback
Was this page helpful? Yes No
Use this task in a build pipeline to automatically update the versions of a packaged
Service Fabric app. This task appends a version suffix to all service and app versions,
specified in the manifest files, in an Azure Service Fabric app package.
Syntax
YAML
Inputs
updateType - Update Type
string . Required. Allowed values: Manifest versions , Docker image settings . Default
Specifies the type of update that should be made to the manifest files. In order to use
both update types, add an instance of this task to the build pipeline for each type of
update to be executed.
Specifies the path to the application package. Variables and wildcards can be used in the
path. applicationPackagePath must not have a trailing slash, either \ or / .
.$(Build.BuildNumber) .
Tip
You can modify the build number format directly or use a logging command to
dynamically set a variable in a format. For example, you can use $(VersionSuffix)
defined in a PowerShell task:
$versionSuffix = ".$([DateTimeOffset]::UtcNow.ToString('yyyyMMdd.HHmmss'))"
Write-Host "##vso[task.setvariable variable=VersionSuffix;]$versionSuffix"
string . Optional. Use when updateType = Manifest versions . Allowed values: Append ,
Replace . Default value: Append .
Specifies whether to append the version value to existing values in the manifest files or
replace them.
updateOnlyChanged - Update only if changed
boolean . Optional. Use when updateType = Manifest versions . Default value: false .
Appends the new version suffix to only the packages that have changed from a previous
build. If no changes are found, the version suffix from the previous build will be
appended.
7 Note
By default, the compiler will create different outputs even if no changes were made.
Use the deterministic compiler flag to ensure builds with the same inputs
produce the same outputs.
true .
Specifies the name of the artifact containing the application package for comparison.
Compares all files in every package and log if the file was added, removed, or if its
content changed. Otherwise, this boolean compares files in a package only until the first
change is found for faster performance.
true . Allowed values: LastSuccessful (Last Successful Build), Specific (Specific Build).
Specifies whether to compare against the last completed and successful build or against
a specific build.
Specific .
Specifies the build number for comparison.
Downloads a new copy of the artifact. Otherwise, this boolean uses an existing copy if
present.
Specifies the path to a text file that contains the names of the Docker images associated
with the Service Fabric application that should be updated with digests. Each image
name must be on its own line and must be in the same order as the digests in the Image
Digests file. If the images are created by the Service Fabric project, this file is generated
as part of the Package target, and its output location is controlled by the property
BuiltDockerImagesFilePath .
Specifies the path to a text file that contains the digest values of the Docker images
associated with the Service Fabric application. This file can be output by the Docker task
when using the push action. The file should contain lines of text in the format of
registry/image_name@digest_value .
Output variables
None.
Remarks
Use this task in a build pipeline to automatically update the versions of a packaged
Service Fabric app. This task appends a version suffix to all service and app versions,
specified in the manifest files, in an Azure Service Fabric app package.
7 Note
This task can only be used in a build pipeline to automatically update the versions of a
packaged Service Fabric app.
b. Image digests file: This file is generated by the docker task when it pushes
images to registry.
Examples
*Service Fabric Application Deployment task
Requirements
ノ Expand table
Requirement Description
Demands Self-hosted agents must have capabilities that match the following demands
to run jobs that use this task: Cmd
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Command Any
restrictions
Feedback
Was this page helpful? Yes No
Use this task to acquire a specific version of the .NET Core SDK from the internet or the
local cache and add it to the PATH. Use this task to change the version of .NET Core that
is used in subsequent tasks. This task also provides proxy support.
Syntax
YAML
Inputs
packageType - Package to install
string . Allowed values: runtime , sdk (SDK (contains runtime)). Default value: sdk .
If you receive an error message like ##[error]Version 6.0.x is not allowed. Allowed
version types are: majorVersion.x, majorVersion.minorVersion.x,
majorVersion.minorVersion.patchVersion. More details: Only explicit versions and
accepted, such as: 2.2.301. Version: 6.0.x is not valid. and you are using
For more information on global.json , see Select the .NET version to use.
Specifies the path from where global.json files should be searched when using
useGlobalJson . If the value is empty, system.DefaultWorkingDirectory will be considered
version - Version
Specifies the version of the .NET Core SDK or runtime to install. The version value
formats are shown with examples:
2.x : Installs the latest SDK or runtime with the specified major version, 2 .
3.1.x : Installs the latest SDK or runtime with the specified major and minor
versions, 3 and 1 .
3.1.402 : Installs the specified SDK or runtime version, 3.1.402 .
The version values for SDK or runtime installations are in the releases.json file. The link
to the releases.json of a major/minor version is in the releases-index file. For
example, the link to the releases.json file for version 3.1 .
vsVersion - Compatible Visual Studio version
string .
Specifies a compatible Visual Studio version for a corresponding .NET Core SDK
installation. The value must be a complete version number, such as 16.6.4 , which
contains a major version, a minor version, and a patch number.
The version values for SDK or runtime installations, which are used for the version
string, are in the releases.json file. The link to the releases.json of a major/minor
version is in the releases-index file. For example, the link to the releases.json file for
version 3.1 .
value: false .
If set to true , includes preview versions when the task searches for latest runtime/SDK
versions, such as searching for 2.2.x or 3.1.x . This setting is ignored if you specify an
exact version, such as 3.0.100-preview3-010431 .
Specifies where the .NET Core SDK/Runtime should be installed. Different paths can
have the following impact on .NET's behavior.
this directory is not cleaned across pipelines. All pipelines running on the agent
have access to the previously installed versions.
$(Agent.TempDirectory) : Using this path ensures that a pipeline doesn't use a
cached version of .NET Core, as this folder is cleaned after each pipeline.
Another path: You can use any path if the agent process has access to the path.
This will change the state of the machine and impact all processes running on it.
7 Note
Configures the behavior of the .NET host process when it searches for a suitable shared
framework. The values are:
false : The host process searches only for versions that are present in the folder
7 Note
Output variables
None.
Remarks
The Use .NET Core task acquires a specific version of .NET Core from internet or the
tools cache and adds it to the PATH of the Azure Pipelines Agent (hosted or private). Use
this task to change the version of .NET Core used in subsequent tasks like
DotNetCoreCLI@2. Adding this task before the DotNetCoreCLI@2 in a build definition
ensures that the version would be available at the time of building, testing and
publishing your app.
The tool installer approach also allows you to decouple from the agent update cycles. If
the .NET Core version you are looking for is missing from the Azure Pipelines agent
(Hosted or Private), then you can use this task to get the right version installed on the
agent.
Requirements
ノ Expand table
Requirement Description
Demands None
Capabilities Running this task satisfies the following demands for any subsequent tasks
in the same job: DotNetCore
Command Any
restrictions
Feedback
Was this page helpful? Yes No
Use this task to find, download, and cache a specified version of Node.js and add it to
the PATH. This task also provides proxy support.
Syntax
# Use Node.js ecosystem v1
# Set up a Node.js environment and add it to the PATH, additionally
providing proxy support.
- task: UseNode@1
inputs:
#version: '10.x' # string. Version. Default: 10.x.
#checkLatest: false # boolean. Check for Latest Version. Default: false.
#force32bit: false # boolean. Use 32 bit version on x64 agents. Default:
false.
# advanced
#retryCountOnDownloadFails: '5' # string. Set retry count when nodes
downloads failed. Default: 5.
#delayBetweenRetries: '1000' # string. Set delay between retries.
Default: 1000.
Inputs
version - Version
Required. Specifies the Node.js version using SemVer's version range syntax.
Examples: 10.x , 10.15.1 , >=10.15.0 .
Checks online for the latest available version that satisfies the version spec. This should
be false unless you need to always have the latest version. Setting the value to true
will cause the task to incur download costs that may be unnecessary, especially with the
hosted build pool.
force32bit - Use 32 bit version on x64 agents
boolean . Default value: false .
Installs the x86 version of Node.js on a 64-bit Windows agent. Only works on Windows
agents.
Use this option when the task failed to download node binaries from the mirror. The
task will retry to download the binaries for the specified times.
Use this option to set the delay between retries in milliseconds. The default value is
1000 milliseconds.
Output variables
None.
Requirements
ノ Expand table
Requirement Description
Demands None
Requirement Description
Capabilities Running this task satisfies the following demands for any subsequent tasks
in the same job: Node, npm, node.js
Command Any
restrictions
Feedback
Was this page helpful? Yes No
Use this task to find, download, and cache a specified version of Node.js and add it to
the PATH.
There is a newer version of the task available. For more information, see UseNode@1.
Syntax
# Use Node.js ecosystem v0
# Finds or downloads and caches the specified version spec of Node.js and
adds it to the PATH.
- task: NodeTool@0
inputs:
versionSource: 'spec' # 'spec' | 'fromFile'. Required. Source of
version. Default: spec.
#versionSpec: '6.x' # string. Optional. Use when versionSource = spec.
Version Spec. Default: 6.x.
#versionFilePath: # string. Optional. Use when versionSource = fromFile.
Path to the .nvmrc file.
#checkLatest: false # boolean. Check for Latest Version. Default: false.
#force32bit: false # boolean. Use 32 bit version on x64 agents. Default:
false.
# Advanced
#nodejsMirror: 'https://nodejs.org/dist' # string. Set source for
Node.js binaries. Default: https://nodejs.org/dist.
#retryCountOnDownloadFails: '5' # string. Set retry count when nodes
downloads failed. Default: 5.
#delayBetweenRetries: '1000' # string. Set delay between retries.
Default: 1000.
Inputs
versionSource - Source of version
string . Required. Allowed values: spec (Specify Node version), fromFile (Get version
Specifies the agent to check for the latest available version that satisfies the version
spec. For example, you select this option because you run this build on your self-hosted
agent, and you want to always use the latest 6.x version.
Tip
If you're using the Microsoft-hosted agents, you should leave this set to false .
Microsoft updates the Microsoft-hosted agents on a regular basis, but they're often
slightly behind the latest version. Enabling this parameter could result in your build
spending a lot of time updating to a newer minor version.
Installs the x86 version of Node regardless of the CPU architecture of the agent.
Use this option when the task failed to download node binaries from the mirror. The
task will retry to download the binaries for the specified times.
delayBetweenRetries - Set delay between retries
string . Default value: 1000 .
Use this option to set the delay between retries in milliseconds. The default value is
1000 milliseconds.
Output variables
None.
Remarks
There is a newer version of the task available. For more information, see UseNode@1.
Requirements
ノ Expand table
Requirement Description
Demands None
Capabilities Running this task satisfies the following demands for any subsequent tasks
in the same job: Node, npm, node.js
Command This task runs using the following command restrictions: restricted
restrictions
Settable variables This task has permission to set the following variables: PATH
Feedback
Was this page helpful? Yes No
Use this task to download or select a version of Python to run on an agent, and
optionally add it to PATH.
Syntax
YAML
Inputs
versionSpec - Version spec
Specifies the version range or exact version of a Python version to use, using SemVer's
version range syntax. Learn more about SemVer .
Disables downloading missing Python versions from the Github Actions registry . This
boolean should only be true if using a local installation of Python.
allowUnstable - Allow downloading unstable releases
Downloads unstable Python versions from the Github Actions Python versions registry
if set to true .
Specifies the GitHub token that enforces the anonymous requests limit in the Github
Actions python versions registry . Leaving this empty may cause download failures.
Not needed if using a local installation of Python.
Prepends the retrieved Python version to the PATH environment variable to make it
available in subsequent tasks or scripts without using the output variable.
architecture - Architecture
Output variables
This task defines the following output variables, which you can consume in downstream
steps, jobs, and stages.
pythonLocation
The directory of the installed Python distribution. Use this in subsequent tasks to access
this installation of Python.
Remarks
Use this task to download or select a version of Python to run on an agent, and
optionally add it to PATH.
Prerequisites
A Microsoft-hosted agent with side-by-side versions of Python installed, or a self-
hosted agent with Agent.ToolsDirectory configured (see FAQ).
Downloading python versions is not supported on self-hosted agents.
This task will fail if no Python versions are found in Agent.ToolsDirectory . Available
Python versions on Microsoft-hosted agents can be found here.
7 Note
x86 and x64 versions of Python are available on Microsoft-hosted Windows agents,
but not on Linux or macOS agents.
As of version 0.150 of the task, version spec will also accept pypy2 or pypy3 .
As of version 0.213.1 of the task, version spec will also accept pypy2.x or pypy3.x .
If the task completes successfully, the task's output variable will contain the directory of
the Python installation:
After running this task with "Add to PATH," the python command in subsequent scripts
will be for the highest available version of the interpreter matching the version spec and
architecture.
The versions of Python installed on the Microsoft-hosted Ubuntu and macOS images
follow the symlinking structure for Unix-like systems that are defined in PEP 394 .
) Important
The desired Python version needs to be added to the tool cache on the self-hosted
agent so the task can use it. Normally, the tool cache is located under the _work/_tool
directory of the agent; alternatively, the path can be overridden by the environment
variable AGENT_TOOLSDIRECTORY . Under that directory, create the following directory
structure based off of your Python version:
$AGENT_TOOLSDIRECTORY/
Python/
{version number}/
{platform}/
{tool files}
{platform}.complete
The version number should follow the format of 1.2.3 . The platform should either be
x86 or x64 . The tool files should be the unzipped Python version files. The
{platform}.complete should be a 0 byte file that looks like x86.complete or
x64.complete and just signifies the tool has been installed in the cache properly.
$AGENT_TOOLSDIRECTORY/
Python/
3.11.4/
x64/
{tool files}
x64.complete
To make your scripts work as they would on Microsoft-hosted agents, use the
symlinking structure from PEP 394 on Unix-like systems.
Also note that the embeddable ZIP release of Python requires extra configuration for
installed modules , including pip . If possible, we recommend using the full installer
to get a pip -compatible Python installation.
Requirements
ノ Expand table
Requirement Description
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Command This task runs using the following command restrictions: restricted
restrictions
Settable variables This task has permission to set the following variables: pythonLocation,
PATH
Use this task to select a version of Ruby to run on an agent. Optionally, the task can add
the Ruby version to PATH.
Syntax
# Use Ruby version v0
# Use the specified version of Ruby from the tool cache, optionally adding
it to the PATH.
- task: UseRubyVersion@0
inputs:
versionSpec: '>= 2.4' # string. Required. Version spec. Default: >= 2.4.
#addToPath: true # boolean. Add to PATH. Default: true.
Inputs
versionSpec - Version spec
string . Required. Default value: >= 2.4 .
Optional. Prepends the retrieved Ruby version to the PATH environment variable to
make it available in subsequent tasks or scripts without using the output variable.
Output variables
This task defines the following output variables, which you can consume in downstream
steps, jobs, and stages.
rubyLocation
Remarks
Use this task to select a version of Ruby to run on an agent, and optionally add it to
PATH.
Prerequisites
A Microsoft-hosted agent with side-by-side versions of Ruby installed, or a self-
hosted agent with Agent.ToolsDirectory configured (see FAQ).
This task will fail if no Ruby versions are found in Agent.ToolsDirectory . See other
available Ruby versions on Microsoft-hosted agents.
Requirements
ノ Expand table
Requirement Description
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Requirement Description
Command This task runs using the following command restrictions: restricted
restrictions
Settable variables This task has permission to set the following variables: rubyLocation,
PATH
See also
Tool installers
Feedback
Was this page helpful? Yes No
Use this task to build with MSBuild and set the Visual Studio version property. Learn
more about installing Visual Studio images on Azure.
Syntax
# Visual Studio build v1
# Build with MSBuild and set the Visual Studio version property.
- task: VSBuild@1
inputs:
solution: '**\*.sln' # string. Required. Solution. Default: **\*.sln.
#vsVersion: 'latest' # 'latest' | '17.0' | '16.0' | '15.0' | '14.0' |
'12.0' | '11.0'. Visual Studio Version. Default: latest.
#msbuildArgs: # string. MSBuild Arguments.
#platform: # string. Platform.
#configuration: # string. Configuration.
#clean: false # boolean. Clean. Default: false.
# Advanced
#maximumCpuCount: false # boolean. Build in Parallel. Default: false.
#restoreNugetPackages: false # boolean. Restore NuGet Packages. Default:
false.
#msbuildArchitecture: 'x86' # 'x86' | 'x64'. MSBuild Architecture.
Default: x86.
#logProjectEvents: true # boolean. Record Project Details. Default:
true.
#createLogFile: false # boolean. Create Log File. Default: false.
#logFileVerbosity: 'normal' # 'quiet' | 'minimal' | 'normal' |
'detailed' | 'diagnostic'. Optional. Use when createLogFile = true. Log File
Verbosity. Default: normal.
#enableDefaultLogger: true # boolean. Enable Default Logger. Default:
true.
#customVersion: # string. Custom Version.
Inputs
solution - Solution
Specifies the solution for the task to use in the build process.
If you want to build a single solution, click the ... button and specify the solution.
If you want to build multiple solutions, specify the search criteria. You can use a single-
folder wildcard ( * ) and recursive wildcards ( ** ). For example, **.sln searches for all
.sln files in all subdirectories.
Make sure the solutions you specify are downloaded by this build pipeline. On the
Repository tab:
If you use TFVC, make sure that the solution is a child of one of the mappings on
the Repository tab.
If you use Git, make sure that the project or solution is in your Git repo, and in a
branch that you're building.
Tip
15.0 (Visual Studio 2017), 14.0 (Visual Studio 2015), 12.0 (Visual Studio 2013), 11.0
The value of this input must match the version of Visual Studio used to create your
solution.
Azure Pipelines: If your team wants to use Visual Studio with the Microsoft-hosted
agents, select windows-latest as your default build pool. See Microsoft-hosted agents.
Specifies the platform you want to build, such as Win32 , x86 , x64 , or any cpu .
Tip
configuration - Configuration
string .
Tip
clean - Clean
boolean . Default value: false .
If set to false , the task makes an incremental build. This setting might reduce your
build time, especially if your codebase is large. This option has no practical effect unless
you also set the Clean repository to false .
If set to true , the task rebuilds all of the code in the code projects. This is equivalent to
the MSBuild /target:clean argument.
maximumCpuCount - Build in Parallel
boolean . Default value: false .
This input is deprecated. To restore NuGet packages, add a NuGet Tool Installer task
before the build.
Tip
Because Visual Studio runs as a 32-bit application, you may experience problems
when your build is processed by a build agent that is running the 64-bit version of
Team Foundation Build Service. By selecting MSBuild x86 , you may resolve these
issues.
Sets a custom version of Visual Studio. Examples: 15.0 , 16.0 , 17.0 . The required version
of Visual Studio must be installed in the system.
Azure Pipelines: If your team wants to use Visual Studio 2022 with the Microsoft-hosted
agents, select windows-2022 as your default build pool. For more info see Microsoft-
hosted agents.
Output variables
None.
Remarks
Learn more about installing Visual Studio images on Azure.
) Important
Requirements
ノ Expand table
Requirement Description
Demands Self-hosted agents must have capabilities that match the following demands
to run jobs that use this task: msbuild, visualstudio
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Command Any
restrictions
Feedback
Was this page helpful? Yes No
Use this task to run unit and functional tests (Selenium, Appium, Coded UI test, etc.)
using the Visual Studio Test (VSTest) runner. You can run test frameworks that have a
Visual Studio test adapter. Example frameworks are MSTest, xUnit, NUnit, Chutzpah (for
JavaScript tests using QUnit, Mocha and Jasmine), etc. Tests can be distributed on
multiple agents using this task (version 2).
Syntax
YAML
Inputs
testSelector - Select tests using
Test assembly: Specifies one or more test assemblies that contain your tests. You
can optionally specify a filter criteria to select only specific tests.
Test plan: Runs tests from your test plan that have an automated test method
associated with it. To learn more about how to associate tests with a test case work
item, see Associate automated tests with test cases.
Test run: Use this option when you are setting up an environment to run tests from
test plans. This option should not be used when running tests in a continuous
integration/continuous deployment (CI/CD) pipeline.
Runs tests from the specified files. Ordered tests and webtests can be run by specifying
the .orderedtest and .webtest files respectively. To run .webtest , Visual Studio 2017
Update 4 or higher is needed. The file paths are relative to the search folder. This input
supports multiple lines of minimatch patterns.
yml
# Example
- task: VSTest@2
inputs:
testSelector: 'testAssemblies'
testAssemblyVer2: |
**\*test*.dll
!**\*TestAdapter.dll
!**\obj\**
testPlan - Test plan
string . Required when testSelector = testPlan .
Specifies a test plan containing test suites with automated test cases.
Specifies one or more test suites containing automated test cases. Test case work items
must be associated with an automated test method.
Specifies the test run-based selection that is used when triggering automated test runs
from test plans. This option cannot be used for running tests in the CI/CD pipeline.
Specifies the folder to store test results. When using the default directory, it is cleaned at
the end of a pipeline run. The results directory will always be cleaned up at the start of
the vstest task before the tests are run. The relative folder path, if provided, will be
considered relative to $(Agent.TempDirectory) .
Automatically specifies and runs the tests needed to validate the code change. Learn
about using Test Impact Analysis .
Specifies the number of builds to be executed before all tests are automatically run. Test
Impact Analysis stores the mapping between test cases and source code. It is
recommended to regenerate the mapping by running all tests on a regular basis.
To run UI tests, ensure that the agent is set to run in interactive mode with Autologon
enabled. Setting up an agent to run interactively must be done before queueing the
build/release. Checking this box does not configure the agent in interactive mode
automatically. This option serves as a reminder to configure the agent appropriately to
avoid failures. Hosted Windows agents from the VS 2015 and 2017 pools can be used to
run UI tests.
(Visual Studio 2015), toolsInstaller (Installed by Tools Installer). Default value: latest .
Specifies the version of Visual Studio Test to use. If latest is specified, this input chooses
the latest version (from the list of allowed values) that is installed. To run tests without
needing Visual Studio on the agent, use the Installed by tools installer option. Be sure
to include the Visual Studio Test Platform Installer task to acquire the test platform
from NuGet.
Specifies the path to a runsettings or testsettings file to use with the tests. For Visual
Studio 15.7 and higher, use runsettings for all test types. Learn more about converting
a .testsettings file to a .runsettings file .
string .
string .
Specifies the directory path to custom test adapters. Adapters residing in the same
folder as the test assemblies are automatically discovered.
If set to true , tests are run in parallel and leverage available cores of the machine. This
will override the MaxCpuCount if specified in your runsettings file. Learn more about
how tests are run in parallel .
runTestsInIsolation - Run tests in isolation
Runs the tests in an isolated process. This likely leads to fewer errors in the
vstest.console.exe test process, but tests might run slower. This option currently cannot
be used when running with the multi-agent job setting.
string .
These options are not supported and will be ignored when running tests using the
Multi-agent parallel setting of an agent job, when running tests using the Test plan or
Test run option, or when a custom batching option is selected. The options can be
specified using a settings file instead.
A batch is a group of tests. A batch of tests runs its tests at the same time, and results
are published for the batch. If the job in which the task runs is set to use multiple
agents, each agent picks up any available batches of tests to run in parallel. A batch can
be run:
based on the number of tests and agents. Simple batching based on the number of
tests and agents participating in the test run.
based on the past running time of tests. This batching considers the past running time
to create batches of tests where each batch has approximately equal running time.
Specifies simple batching based on the number of tests and agents participating in the
test run. When the batch size is automatically determined, each batch contains (total
number of tests / number of agents) tests. If a batch size is specified, each batch will
This batching considers past running times to create batches of tests where each batch
has approximately equal running time. Quick-running tests will be batched together,
while longer-running tests may belong to a separate batch. When this option is used
with the multi-agent job setting, the total test time is reduced to a minimum.
dontDistribute - Replicate tests instead of distributing when multiple agents are used
in the job
boolean . Default value: False .
Choosing this option will not distribute tests across agents when the task is running in a
multi-agent job. Each of the selected test(s) will be repeated on each agent. This option
is not applicable when the agent job is configured to run with no parallelism or with the
multi-config option.
string .
Specifies the build platform against which the tests should be reported. If you have
defined a variable for the platform in your build task, use that with this input.
string .
Specifies the build configuration against which the tests should be reported. If you have
defined a variable for configuration in your build task, use that with this input.
failOnMinTestsNotRun - Fail the task if a minimum number of tests are not run.
Fails the task if a minimum number of tests are not run. This may be useful if any
changes to task inputs or underlying test adapter dependencies lead to only a subset of
the desired tests to be found.
Collects diagnostic data to troubleshoot catastrophic failures, such as a test crash. When
this option is checked, a sequence XML file is generated and attached to the test run.
The sequence file contains information about the sequence in which the tests had run,
so a potential culprit test can be identified.
onAbortOnly - a mini dump will be collected only when the test run is aborted.
Always - a mini dump will always be collected regardless of whether the test run
completes or not.
Never - a mini dump will not be collected regardless of whether the test run
completes or not.
Reruns any failed tests until they pass or until the maximum number of attempts is
reached.
Avoids rerunning tests when the failure rate crosses the specified threshold. This is
applicable if environment issues lead to massive failures. You can specify the percentage
of failures or number of failed tests as a threshold.
rerunFailedThreshold - % failure
string . Optional. Use when rerunFailedTests = true && rerunType =
Avoids rerunning tests when the percentage of failed test cases crosses the specified
threshold. This is applicable if environment issues lead to massive failures.
Avoids rerunning tests when the number of failed test cases crosses the specified limit.
This is applicable if environment issues lead to massive failures.
Specifies the maximum number of times a failed test should be retried. If a test passes
before the maximum number of attempts is reached, it will not be rerun again.
Output variables
None.
Remarks
Use this task to run unit and functional tests (Selenium, Appium, Coded UI test, and
more) using the Visual Studio Test runner. Along with MSTest-based tests, test
frameworks that have a Visual Studio test adapter can also be executed, such as xUnit,
NUnit, or Chutzpah.
Tests that the target .NET core framework can be executed by specifying the appropriate
target framework value in the .runsettings file.
Tests can be distributed on multiple agents using version 2 of this task. For more
information, see Run tests in parallel using the Visual Studio Test task.
Check prerequisites
If you're using a Windows self-hosted agent, this prerequisite must be installed:
Demands
The agent must have the following capability:
vstest
1. You must have Visual Studio 2017.6 or higher on the agent machine. Visual Studio
Test Platform Installer task cannot be used to run tests that use TestCase as a data
source.
2. Create a PAT that is authorized for the scope “Work Items (full)”.
3. Add a secure build or release variable called Test.TestCaseAccessToken with the
value set to the PAT created in the previous step.
If you want to run tests that belong to multiple target frameworks, you'll need to install
a compatible version of VSTest via Visual Studio Test Platform Installer and set
vsTestVersion to toolsInstaller to use it.
Requirements
ノ Expand table
Requirement Description
Demands Self-hosted agents must have capabilities that match the following demands
to run jobs that use this task: vstest
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Command Any
restrictions
Use this task to run tests with Visual Studio test runner.
Syntax
# Visual Studio Test v1
# Run tests with Visual Studio test runner.
- task: VSTest@1
inputs:
# Execution Options
testAssembly: '**\*test*.dll;-:**\obj\**' # string. Required. Test
Assembly. Default: **\*test*.dll;-:**\obj\**.
#testFiltercriteria: # string. Test Filter criteria.
#runSettingsFile: # string. Run Settings File.
#overrideTestrunParameters: # string. Override TestRun Parameters.
#codeCoverageEnabled: False # boolean. Code Coverage Enabled. Default:
False.
#runInParallel: false # boolean. Run In Parallel. Default: false.
# Advanced Execution Options
#vstestLocationMethod: 'version' # 'version' | 'location'. VSTest.
Default: version.
#vsTestVersion: '14.0' # 'latest' | '14.0' | '12.0'. Optional. Use when
vstestLocationMethod = version. VSTest version. Default: 14.0.
#vstestLocation: # string. Optional. Use when vstestLocationMethod =
location. Path to vstest.console.exe.
#pathtoCustomTestAdapters: # string. Path to Custom Test Adapters.
#otherConsoleOptions: # string. Other console options.
# Reporting Options
#testRunTitle: # string. Test Run Title.
#platform: # string. Platform.
#configuration: # string. Configuration.
#publishRunAttachments: true # boolean. Upload Test Attachments.
Default: true.
Inputs
testAssembly - Test Assembly
string . Required. Default value: **\*test*.dll;-:**\obj\** .
Specifies which test binaries to run tests on. Wildcards can be used. For example, using
**\*test*.dll;-:**\obj\** for all DLLs with "test" in the name and excluding files in any
Specifies additional criteria to filter tests from test assemblies. For example:
Priority=1|Name=MyTestMethod .
Specifies the path to the runsettings file to use with the tests. Use
$(Build.SourcesDirectory) to access the Project folder.
vstestLocationMethod - VSTest
string . Allowed values: version , location (Specify Location). Default value: version .
string .
Specifies the directory path to the custom test adapters. NuGet restored adapters are
automatically searched for.
string .
string .
platform - Platform
string .
Specifies the platform against which the tests should be reported. If you have defined a
variable for the platform in your build task, use that when providing this input.
configuration - Configuration
string .
Specifies the configuration against which the tests should be reported. If you have
defined a variable for configuration in your build task, use that when providing this
input.
Output variables
None.
Requirements
ノ Expand table
Requirement Description
Demands Self-hosted agents must have capabilities that match the following demands
to run jobs that use this task: vstest
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Command Any
restrictions
Feedback
Was this page helpful? Yes No
) Important
This task is deprecated and will be retired January 31, 2024. Use the Visual Studio
Test task to run unit and functional tests.
Syntax
# Visual Studio test agent deployment v2
# DeployVisualStudioTestAgent@2 is deprecated. Use the Visual Studio Test
task to run unit and functional tests.
- task: DeployVisualStudioTestAgent@2
inputs:
# Test Machines
testMachines: # string. Required. Machines.
adminUserName: # string. Required. Admin login.
adminPassword: # string. Required. Admin password.
winRmProtocol: 'Http' # 'Http' | 'Https'. Required. Protocol. Default:
Http.
#testCertificate: true # boolean. Optional. Use when winRmProtocol =
Https. Test Certificate. Default: true.
# Agent Configuration
machineUserName: # string. Required. Username.
machinePassword: # string. Required. Password.
#runAsProcess: false # boolean. Run UI tests. Default: false.
#isDataCollectionOnly: false # boolean. Enable data collection only.
Default: false.
# Advanced
#testPlatform: '14.0' # '15.0' | '14.0'. Test agent version. Default:
14.0.
#agentLocation: # string. Test agent location.
#updateTestAgent: false # boolean. Update test agent. Default: false.
Inputs
testMachines - Machines
string . Required.
This input has three options:
string . Required.
Specifies the administrator password for the target machines. This input can accept a
variable defined in build/release definitions as $(passwordVariable) . You may mark the
variable type as secret to secure it.
winRmProtocol - Protocol
Specifies the protocol to use for the WinRM connection with the machine(s). The default
value is HTTPS .
Provides the option to skip the authenticity validation of the machine's certificate by a
trusted certification authority. The parameter is required for the WinRM HTTPS protocol.
machineUserName - Username
string . Required.
Denotes if the test agent needs to run as an interactive process. This input is needed for
Coded UI Tests.
Optional. Specifies if the test agent is used only for data collection and not for running
tests. This can typically be found on the application under the test (AUT) machine group.
string . Allowed values: 15.0 (Visual Studio 2017), 14.0 (Visual Studio 2015). Default
value: 14.0 .
Specifies the version of Visual Studio test agent. Chooses an appropriate version to
match the VS version using the test binaries that were built.
Optional. Supplies the path to vstf_testagent.exe from the network or local location. If
no path is provided, it will be automatically downloaded from the download center .
Install the Test Agent 2015 Update 3 .
Install Test Agent 2017 .
If the Test Agent is already deployed on a machine, this option checks to see if an
update is available for that version.
Task control options
All tasks have control options in addition to their task inputs. For more information, see
Control options and common task properties.
Output variables
None.
Remarks
What's new in this task version:
Support for Visual Studio Test Agent 2017: You can now deploy and run tests using
multiple versions of Visual Studio Test Agent. Versions 2015 and 2017 are
supported.
Machine groups created from the test hub are no longer supported. You can
continue to use a list of machines or Azure resource groups.
Requirements
ノ Expand table
Requirement Description
Runs on Agent
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Feedback
Was this page helpful? Yes No
This task deploys and configures the Test Agent to run tests on a set of machines.
) Important
This task is deprecated. Use the Visual Studio Test task to run unit and functional
tests.
Syntax
# Visual Studio Test Agent Deployment v1
# Deploy and configure Test Agent to run tests on a set of machines.
- task: DeployVisualStudioTestAgent@1
inputs:
# Test Machine Group
testMachineGroup: # string. Required. Machines.
#adminUserName: # string. Admin Login.
#adminPassword: # string. Admin Password.
#winRmProtocol: # 'Http' | 'Https'. Protocol.
#testCertificate: true # boolean. Optional. Use when winRmProtocol =
Https. Test Certificate. Default: true.
#resourceFilteringMethod: 'machineNames' # 'machineNames' | 'tags'.
Select Machines By. Default: machineNames.
#testMachines: # string. Filter Criteria.
# Agent Configuration
machineUserName: # string. Required. Username.
machinePassword: # string. Required. Password.
#runAsProcess: false # boolean. Interactive Process. Default: false.
# Advanced
#agentLocation: # string. Test Agent Location.
#updateTestAgent: true # boolean. Update Test Agent. Default: true.
#isDataCollectionOnly: false # boolean. Enable Data Collection Only.
Default: false.
Inputs
testMachineGroup - Machines
string . Required.
This input has three options:
string .
Specifies the administrator password for the target machines. This input can accept a
variable defined in build/release definitions as $(passwordVariable) . You may mark the
variable type as secret to secure it.
winRmProtocol - Protocol
Specifies the protocol to use for the WinRM connection with the machine(s). The default
value is HTTPS .
Provides the option to skip the authenticity validation of the machine's certificate by a
trusted certification authority. The parameter is required for the WinRM HTTPS protocol.
tags. For Azure Resource Group, provide the VM host name for the machine name. The
default deploys an agent on all machines represented in the Machines field.
machineUserName - Username
string . Required.
Specifies the username with which the test agent needs to run.
machinePassword - Password
string . Required.
Denotes if the test agent needs to run as an interactive process. This input is needed for
Coded UI Tests.
Optional. Supplies the path to vstf_testagent.exe from the network or local location. If
no path is provided, it will be downloaded from the download center .
Output variables
None.
Requirements
ノ Expand table
Requirement Description
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Feedback
Was this page helpful? Yes No
Use this task to acquire the Microsoft test platform from nuget.org or a specified feed,
and add it to the tools cache. The installer task satisfies the vstest demand, and a
subsequent Visual Studio Test task in a build or release pipeline can run without needing
a full Visual Studio install on the agent machine.
Syntax
# Visual Studio test platform installer v1
# Acquire the test platform from nuget.org or the tool cache. Satisfies the
‘vstest’ demand and can be used for running tests and collecting diagnostic
data using the Visual Studio Test task.
- task: VisualStudioTestPlatformInstaller@1
inputs:
# Package settings
packageFeedSelector: 'nugetOrg' # 'nugetOrg' | 'customFeed' |
'netShare'. Required. Package Feed. Default: nugetOrg.
#versionSelector: 'latestPreRelease' # 'latestPreRelease' |
'latestStable' | 'specificVersion'. Required when packageFeedSelector =
nugetOrg || packageFeedSelector = customFeed. Version. Default:
latestPreRelease.
#testPlatformVersion: # string. Required when versionSelector =
specificVersion. Test Platform Version.
#customFeed: # string. Required when packageFeedSelector = customFeed.
Package Source.
#username: # string. Optional. Use when packageFeedSelector =
customFeed. User Name.
#password: # string. Optional. Use when packageFeedSelector =
customFeed. Password.
#netShare: # string. Required when packageFeedSelector = netShare. UNC
Path.
Inputs
packageFeedSelector - Package Feed
string . Required. Allowed values: nugetOrg (Official Nuget), customFeed (Custom Feed),
nugetOrg - Official NuGet: Acquires the test platform package from NuGet . This
option requires internet connectivity on the agent machine.
customFeed - Custom feed: Acquires the test platform package from a custom feed or a
netShare - Network path: Installs the test platform from a network share. The specified
Microsoft.TestPlatform.nupkg version must be downloaded from NuGet and placed on
versionSelector - Version
Installs the latest version or a specific version of the Visual Studio Test Platform. If you
use the test platform installer to run Coded UI tests, the chosen Visual Studio Test
Platform must match the major version of the Visual Studio installation that built the
test binaries. For example, if the Coded UI test project was built using Visual Studio 2017
(version 15.x), you must use Test Platform version 15.x.
Specifies the version of Visual Studio Test Platform to install on the agent. Available
versions can be viewed on NuGet .
Specifies the URL of a custom feed or a package management feed in Azure DevOps or
TFS that contains the test platform package. Public and private feeds can be specified.
password - Password
Specifies the password or personal access token (PAT) for authenticating the feed
specified in the customFeed input.
Specifies the full UNC path to the Microsoft.TestPlatform.nupkg file. The specified
Microsoft.TestPlatform.nupkg version must be downloaded from NuGet and placed
on a network share that the build/release agent can access.
Output variables
None.
Remarks
7 Note
If you are using a hosted agent, check the software table for the agent you are
using to see if Visual Studio is installed. If Visual Studio is installed, you don't need
to run the Visual Studio test platform installer task.
Use this task to acquire the Microsoft test platform from nuget.org or a specified feed,
and add it to the tools cache. The installer task satisfies the vstest demand, and a
subsequent Visual Studio Test task in a build or release pipeline can run without needing
a full Visual Studio install on the agent machine.
7 Note
The Visual Studio Test Platform Installer task must appear before the Visual
Studio Test task in the build or release pipeline.
The Test platform version option in the Visual Studio Test task must be set to
Installed by Tools Installer.
Requirements
ノ Expand table
Requirement Description
Demands None
Capabilities Running this task satisfies the following demands for any subsequent tasks
in the same job: VsTest
Command Any
restrictions
Feedback
Was this page helpful? Yes No
Syntax
# Windows machine file copy v2
# Copy files to remote Windows machines.
- task: WindowsMachineFileCopy@2
inputs:
SourcePath: # string. Required. Source.
MachineNames: # string. Required. Machines.
AdminUserName: # string. Required. Admin Login.
AdminPassword: # string. Required. Password.
TargetPath: # string. Required. Destination Folder.
# Advanced Options
#CleanTargetBeforeCopy: false # boolean. Clean Target. Default: false.
#CopyFilesInParallel: true # boolean. Copy Files in Parallel. Default:
true.
#AdditionalArguments: # string. Additional Arguments.
Inputs
SourcePath - Source
string . Required.
The path to the files to copy. Specifies the absolute path of the source folder or file on
the local machine or a UNC Share, like c:\fabrikamfiber or
\\fabrikamshare\fabrikamfiber . You can use predefined system variables, such as
makes it easy to specify the location of the build artifacts on the computer that hosts
the automation agent.
MachineNames - Machines
string . Required.
string . Required.
AdminPassword - Password
string . Required.
Specifies the password for the administrator login for the target machines. Variables
defined in build or release pipelines, such as $(passwordVariable) , are accepted. You can
mark the variable as secret to secure it.
Specifies the local path on the target machines or an accessible UNC path for copying
the files from the source, like d:\fabrikam or \\fabrikam\Web .
Deletes all files in the target folder before copying the new files to it.
Copies files to all target machines in parallel, which can speed up the copying process.
string .
Specifies additional RoboCopy arguments that are applied when copying files, like
/min:33553332 /l .
Output variables
None.
Remarks
Use this task to copy application files and other artifacts, such as PowerShell scripts and
PowerShell-DSC modules, which are required to install the application on Windows
machines. It uses RoboCopy, the command-line utility built for fast copying of data.
Requirements
ノ Expand table
Requirement Description
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Feedback
Was this page helpful? Yes No
Syntax
YAML
Inputs
SourcePath - Source
string . Required.
Specifies the absolute path of the source folder or file on the local machine or a UNC
Share, like c:\fabrikamfiber or \\fabrikamshare\fabrikamfiber .
EnvironmentName - Machines
string .
AdminPassword - Password
string .
Specifies the password for the administrator login for the target machines. Variables
defined in build/release definitions as $(passwordVariable) are accepted. You can mark
the variable type as secret to secure it.
Specifies the local path on the target machine or an accessible UNC path for copying
the files from the source, like d:\fabrikam or \\fabrikam\Web .
string .
Specifies additional robocopy arguments that are applied when copying files, like
/min:33553332 /l .
ResourceFilteringMethod - Select Machines By
string . Allowed values: machineNames (Machine Names), tags . Default value:
machineNames .
string .
This input is only valid for machine groups and is not supported for a flat list of
machines or output variables yet.
tags are provided, the task will run in all machines with the specified tags. The default
runs the task in all machines.
Output variables
None.
Requirements
ノ Expand table
Requirement Description
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Feedback
Was this page helpful? Yes No
Syntax
# Xamarin Component Restore v0
# This task is deprecated. Use 'NuGet' instead.
- task: XamarinComponentRestore@0
inputs:
solutionFile: '**/*.sln' # string. Alias: solution. Required. Path to
solution. Default: **/*.sln.
email: # string. Required. Email.
password: # string. Required. Password.
Inputs
solutionFile - Path to solution
email - Email
string . Required.
password - Password
string . Required.
Specifies the Xamarin account password. Use a new build variable with its lock enabled
on the Variables tab to encrypt this value.
Output variables
None.
Requirements
ノ Expand table
Requirement Description
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Feedback
Was this page helpful? Yes No
This task was originally used in a build or release pipeline to activate or deactivate
Xamarin licenses.
Syntax
# Xamarin License v1
# [Deprecated] Upgrade to free version of Xamarin:
https://store.xamarin.com.
- task: XamarinLicense@1
inputs:
action: 'Activate' # 'Activate' | 'Deactivate'. Required. Action.
Default: Activate.
email: # string. Required. Email.
password: # string. Required. Password.
product: 'MA' # 'MA' | 'MT' | 'MM'. Required. Xamarin Product. Default:
MA.
# Advanced
#timeout: '30' # string. Timeout in Seconds. Default: 30.
Inputs
action - Action
string . Required. Allowed values: Activate , Deactivate . Default value: Activate .
Specifies activate for the first instance of this build task before any instances of the
Xamarin.Android or Xamarin.iOS tasks. Specifies deactivate for the second instance of
this build task after all instances of the Xamarin.Android and Xamarin.iOS tasks. You
should also select Always run under Control options for the last instance of the
Xamarin license task.
email - Email
string . Required.
Specifies the Xamarin account email address.
password - Password
string . Required.
Specifies the Xamarin account password. Use a secret variable with its lock enabled on
the variables tab to encrypt this value.
Specifies how long you want to allow the build task to wait for the activation or
deactivation.
Output variables
None.
Remarks
This task is deprecated because you no longer need a Xamarin license to build your
Xamarin app. Use the free version of Xamarin from https://store.xamarin.com .
Requirements
ノ Expand table
Requirement Description
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
See also
build your Xamarin app
Feedback
Was this page helpful? Yes No
7 Note
You can now sign up with App Center and use the AppCenterDistribute@3 task
instead.
Syntax
# Xamarin Test Cloud v1
# [Deprecated] Test mobile apps with Xamarin Test Cloud using
Xamarin.UITest. Instead, use the 'App Center test' task.
- task: XamarinTestCloud@1
inputs:
appFile: # string. Alias: app. Required. App file.
#dsymFile: # string. Alias: dsym. dSYM file (iOS only).
teamApiKey: # string. Required. Team API key.
email: # string. Alias: user. Required. User email.
devices: # string. Required. Devices.
series: 'master' # string. Required. Series. Default: master.
testAssemblyDirectory: # string. Alias: testDir. Required. Test assembly
directory.
# Advanced
parallelizationOption: 'none' # 'none' | '--fixture-chunk' | '--test-
chunk'. Alias: parallelization. Required. Parallelization. Default: none.
localeOption: 'en_US' # 'da_DK' | 'nl_NL' | 'en_GB' | 'en_US' | 'fr_FR'
| 'de_DE' | 'ja_JP' | 'ru_RU' | 'es_MX' | 'es_ES' | 'user'. Alias: locale.
Required. System language. Default: en_US.
#userDefinedLocale: # string. Optional. Use when locale = user. Other
locale.
testCloudFile: '**/packages/**/tools/test-cloud.exe' # string. Alias:
testCloudLocation. Required. test-cloud.exe location. Default:
**/packages/**/tools/test-cloud.exe.
#optionalArgs: # string. Optional arguments.
#publishNUnitResults: true # boolean. Publish results to Azure
Pipelines. Default: true.
Inputs
appFile - App file
Specifies the relative path from repo root of the app(s) to test. Wildcards can be used.
For example, **/*.apk for all APK files in all subfolders. Learn more about file matching
patterns.
Provides a path relative to the .ipa file. To make crash logs easier to read, you can
upload a dSYM file that is associated with your app. This field only applies to iOS apps.
Wildcards can be used. For example: *.dSYM . Learn more about file matching patterns.
string . Required.
Specifies your Xamarin Test Cloud Team API key, which can be found under Teams &
Apps . Use a secret variable to avoid exposing this value.
devices - Devices
string . Required.
Specifies the devices string generated by Xamarin Test Cloud. The string can be found as
the value of the --devices command line argument of a Test Cloud test run.
series - Series
string . Required. Default value: master .
Specifies the series name for organizing test runs (e.g. master , production , beta ).
testAssemblyDirectory - Test assembly directory
Specifies the relative path to the folder containing the test assemblies, such as:
SolutionName/TestsProjectName/bin/Release .
parallelizationOption - Parallelization
Input alias: locale . string . Required. Allowed values: da_DK (Danish (Denmark)), nl_NL
(Dutch (Netherlands)), en_GB (English (United Kingdom)), en_US (English (United States)),
fr_FR (French (France)), de_DE (German (Germany)), ja_JP (Japanese (Japan)), ru_RU
(Russian (Russia)), es_MX (Spanish (Mexico)), es_ES (Spanish (Spain)), user (Other).
Default value: en_US .
Specifies your language. If your language isn't displayed, select Other and enter its
locale below, such as en_US .
Enters any two-letter ISO-639 language code along with any two-letter ISO 3166
country code in the format [language]_[country], such as en_US .
Specifies the path to test-cloud.exe . Wildcards can be used, and when they are, the
first occurrence of test-cloud.exe is used. Learn more about file matching patterns.
string .
Specifies the additional arguments passed to test-cloud.exe .
Output variables
None.
Requirements
ノ Expand table
Requirement Description
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Feedback
Was this page helpful? Yes No
Syntax
# Xamarin.Android v1
# Build an Android app with Xamarin.
- task: XamarinAndroid@1
inputs:
projectFile: '**/*.csproj' # string. Alias: project. Required. Project.
Default: **/*.csproj.
#target: # string. Target.
#outputDirectory: # string. Alias: outputDir. Output directory.
#configuration: # string. Configuration.
#createAppPackage: true # boolean. Create app package. Default: true.
#clean: false # boolean. Clean. Default: false.
# MSBuild Options
#msbuildLocationOption: 'version' # 'version' | 'location'. Alias:
msbuildLocationMethod. MSBuild. Default: version.
#msbuildVersionOption: '15.0' # 'latest' | '17.0' | '16.0' | '15.0' |
'14.0' | '12.0' | '4.0'. Alias: msbuildVersion. Optional. Use when
msbuildLocationMethod = version. MSBuild version. Default: 15.0.
#msbuildFile: # string. Alias: msbuildLocation. Required when
msbuildLocationMethod = location. MSBuild location.
#msbuildArchitectureOption: 'x86' # 'x86' | 'x64'. Alias:
msbuildArchitecture. Optional. Use when msbuildLocationMethod = version.
MSBuild architecture. Default: x86.
#msbuildArguments: # string. Additional arguments.
# JDK Options
jdkOption: 'JDKVersion' # 'JDKVersion' | 'Path'. Alias: jdkSelection.
Required. Select JDK to use for the build. Default: JDKVersion.
#jdkVersionOption: 'default' # 'default' | '1.11' | '1.10' | '1.9' |
'1.8' | '1.7' | '1.6'. Alias: jdkVersion. Optional. Use when jdkSelection =
JDKVersion. JDK version. Default: default.
#jdkDirectory: # string. Alias: jdkUserInputPath. Required when
jdkSelection = Path. JDK path.
#jdkArchitectureOption: 'x64' # 'x86' | 'x64'. Alias: jdkArchitecture.
Optional. Use when jdkVersion != default. JDK architecture. Default: x64.
Inputs
projectFile - Project
Specifies the relative path from repo root of Xamarin.Android project(s) to build.
Wildcards can be used. For more information, see the File matching patterns reference.
For example, **/*.csproj for all csproj files in all subfolders. The project must have a
PackageForAndroid target if Create App Package is selected.
target - Target
string .
Specifies which targets to build in this project. Use a semicolon to separate multiple
targets.
configuration - Configuration
string .
Specifies the configuration you want to build. For example, debug or release .
Tip
then modify the platform when you queue the build and enable building multiple
configurations.
msbuildLocationOption - MSBuild
Specifies the path to MSBuild (on Windows) or xbuild (on macOS). The default behavior
is to search for the latest version.
(MSBuild 15.0), 14.0 (MSBuild 14.0), 12.0 (MSBuild 12.0), 4.0 (MSBuild 4.0). Default
value: 15.0 .
Specifies the use of the latest version if the preferred version cannot be found. On
macOS, xbuild (Mono) or MSBuild (Visual Studio for Mac) will be used.
Optional. Supplies the path to MSBuild (on Windows) or xbuild (on macOS).
Supplies the architecture (x86, x64) of the MSBuild you want to run.
Specifies additional arguments passed to MSBuild (on Windows) or xbuild (on macOS).
jdkOption - Select JDK to use for the build
Input alias: jdkSelection . string . Required. Allowed values: JDKVersion (JDK Version),
Path . Default value: JDKVersion .
Specifies the JDK version that the task uses during the build process. The JDKVersion
value specifies a JDK version that the task discovers during builds. The Path value
specifies a file path for a JDK version.
Specifies the JDK version to use during the build at the jdkSelection path.
Output variables
None.
Remarks
Use this task to build an Android app with Xamarin.
Examples
Build your Xamarin app
Requirements
ノ Expand table
Requirement Description
Demands Self-hosted agents must have capabilities that match the following demands
to run jobs that use this task: MSBuild, Xamarin.Android
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Command Any
restrictions
Feedback
Was this page helpful? Yes No
Use this task in a pipeline to build an iOS app with Xamarin on macOS. For more
information, see the Xamarin guidance and Sign your app during CI.
Syntax
# Xamarin.iOS v2
# Build an iOS app with Xamarin on macOS.
- task: XamariniOS@2
inputs:
solutionFile: '**/*.sln' # string. Alias: solution. Required. Solution.
Default: **/*.sln.
configuration: 'Release' # string. Required. Configuration. Default:
Release.
#clean: false # boolean. Clean. Default: false.
#packageApp: true # boolean. Create app package. Default: true.
#buildForSimulator: false # boolean. Alias: forSimulator. Build for iOS
Simulator. Default: false.
# Advanced
#runNugetRestore: false # boolean. Run NuGet restore. Default: false.
#args: # string. Arguments.
#workingDirectory: # string. Alias: cwd. Working directory.
#mdtoolFile: # string. Alias: buildToolLocation | mdtoolLocation. Build
tool path.
# Signing & Provisioning
#signingIdentity: # string. Alias: iosSigningIdentity. Signing identity.
#signingProvisioningProfileID: # string. Alias: provProfileUuid.
Provisioning profile UUID.
Inputs
solutionFile - Solution
Specifies the relative path from the repository root of the Xamarin.iOS solution or csproj
project to the build. May contain wildcards.
configuration - Configuration
clean - Clean
Optional. Builds for the iOS Simulator instead of physical iOS devices.
Runs nuget restore on the Xamarin iOS solution to install all referenced packages
before the build. The nuget tool in the PATH of the build agent machine is used. To use
a different version of NuGet or set additional arguments, use the NuGet Installer Task .
args - Arguments
string .
Optional. Specifies additional command line arguments that are used to build.
Optional. Specifies the working directory in which builds will run. If the value is empty,
the root of the repository is used.
mdtoolFile - Build tool path
Optional. Supplies the path to xbuild (the Xamarin Studio mono build tool) or MSBuild
(the Visual Studio for Mac build tool). If the value is empty, the default xbuild or MSBuild
path is used.
Optional. Overrides the signing identity that will be used to sign the build. If the value is
empty, the setting in the Xcode project will be used. You may need to select
signingUnlockDefaultKeychain if you use this option.
Optional. Specifies the UUID of an installed provisioning profile override to be used for
this build.
Output variables
None.
Remarks
Use this task in a pipeline to build an iOS app with Xamarin on macOS. For more
information, see the Xamarin guidance and Sign your app during CI.
Examples
Build your Xamarin app
Requirements
ノ Expand table
Requirement Description
Demands Self-hosted agents must have capabilities that match the following demands
to run jobs that use this task: Xamarin.iOS
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Command Any
restrictions
Feedback
Was this page helpful? Yes No
Use this task in a pipeline to build an iOS app with Xamarin on macOS. For more
information, see the Xamarin guidance and Sign your app during CI.
Syntax
# Xamarin.iOS v1
# Build an iOS app with Xamarin on macOS.
- task: XamariniOS@1
inputs:
solutionFile: '**/*.sln' # string. Alias: solution. Required. Solution.
Default: **/*.sln.
configuration: 'Release' # string. Required. Configuration. Default:
Release.
#clean: false # boolean. Clean. Default: false.
#packageApp: true # boolean. Create app package. Default: true.
#buildForSimulator: false # boolean. Alias: forSimulator. Build for iOS
Simulator. Default: false.
# Advanced
#runNugetRestore: true # boolean. Run NuGet restore. Default: true.
#args: # string. Arguments.
#workingDirectory: # string. Alias: cwd. Working directory.
#buildToolOption: 'xbuild' # 'xbuild' | 'msbuild'. Alias: buildTool.
Build tool. Default: xbuild.
#mdtoolFile: # string. Alias: mdtoolLocation. Build tool path.
# Signing & Provisioning
#signingOption: 'file' # 'file' | 'id'. Alias: signMethod. Override
using. Default: file.
#signingIdentity: # string. Alias: iosSigningIdentity. Optional. Use
when signMethod = id. Signing identity.
#signingUnlockDefaultKeychain: false # boolean. Alias:
unlockDefaultKeychain. Optional. Use when signMethod = id. Unlock default
keychain. Default: false.
#signingDefaultKeychainPassword: # string. Alias:
defaultKeychainPassword. Optional. Use when signMethod = id. Default
keychain password.
#signingProvisioningProfileID: # string. Alias: provProfileUuid.
Optional. Use when signMethod = id. Provisioning profile UUID.
#signingP12File: # string. Alias: p12. Optional. Use when signMethod =
file. P12 certificate file.
#signingP12Password: # string. Alias: p12pwd. Optional. Use when
signMethod = file. P12 password.
#signingProvisioningProfileFile: # string. Alias: provProfile. Optional.
Use when signMethod = file. Provisioning profile file.
#signingRemoveProfile: false # boolean. Alias: removeProfile. Optional.
Use when signMethod = file. Remove profile after build. Default: false.
Inputs
solutionFile - Solution
Specifies the relative path from the repository root of the Xamarin.iOS solution to the
build. May contain wildcards.
configuration - Configuration
Specifies the configuration. Standard configurations are Ad-Hoc, AppStore, Debug, and
Release.
clean - Clean
Optional. Builds for the iOS Simulator instead of physical iOS devices.
Runs nuget restore on the Xamarin iOS solution to install all referenced packages
before the build. The nuget tool in the PATH of the build agent machine is used. To use
a different version of NuGet or set additional arguments, use the NuGet Installer Task .
args - Arguments
string .
Optional. Specifies additional command line arguments that are used to the build.
Optional. Specifies the working directory in which builds will run. If the value is empty,
the root of the repository is used.
Input alias: buildTool . string . Allowed values: xbuild (xbuild (Xamarin Studio)),
msbuild (MSBuild (Visual Studio for Mac)). Default value: xbuild .
Optional. Supplies the path to xbuild (the Xamarin Studio mono build tool) or MSBuild
(the Visual Studio for Mac build tool). If the value is empty, the default xbuild or MSBuild
path is used.
Use this input if the build uses a signing or provisioning method that is different than
the default. Choose file to use a P12 certificate and provisioning profile. Choose id to
retrieve signing settings from the default Keychain and pre-installed profiles. Leave the
corresponding fields blank if you do not wish to override the default build settings.
Overrides the signing identity that will be used to sign the build. If the value is empty,
the setting in the Xcode project will be used. You may need to select
signingUnlockDefaultKeychain if you use this option.
Resolves "User interaction is not allowed" errors by unlocking the default keychain.
Specifies the UUID of an installed provisioning profile to be used for this build.
Specifies the relative path to a PKCS12-formatted P12 certificate file containing a signing
certificate to be used for this build.
Specifies the password to the P12 certificate file. Use a build variable to encrypt this
value.
Specifies the UUID of an installed provisioning profile override to be used for this build.
signingRemoveProfile - Remove profile after build
Input alias: removeProfile . boolean . Optional. Use when signMethod = file . Default
value: false .
Specifies that the contents of the provisioning profile file should be removed from the
build agent after the build is complete. Only enable this if you are running one agent
per user..
Output variables
None.
Requirements
ノ Expand table
Requirement Description
Demands Self-hosted agents must have capabilities that match the following demands
to run jobs that use this task: Xamarin.iOS
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Command Any
restrictions
Feedback
Was this page helpful? Yes No
Use this task to build, test, or archive an Xcode workspace on macOS, and optionally
package an app.
Syntax
# Xcode v5
# Build, test, or archive an Xcode workspace on macOS. Optionally package an
app.
- task: Xcode@5
inputs:
actions: 'build' # string. Required. Actions. Default: build.
#configuration: '$(Configuration)' # string. Configuration. Default:
$(Configuration).
#sdk: '$(SDK)' # string. SDK. Default: $(SDK).
#xcWorkspacePath: '**/*.xcodeproj/project.xcworkspace' # string.
Workspace or project path. Default: **/*.xcodeproj/project.xcworkspace.
#scheme: # string. Scheme.
#xcodeVersion: 'default' # '8' | '9' | '10' | '11' | '12' | '13' |
'default' | 'specifyPath'. Xcode version. Default: default.
#xcodeDeveloperDir: # string. Optional. Use when xcodeVersion ==
specifyPath. Xcode developer path.
# Package options
#packageApp: false # boolean. Create app package. Default: false.
#archivePath: # string. Optional. Use when packageApp == true. Archive
path.
#exportPath: 'output/$(SDK)/$(Configuration)' # string. Optional. Use
when packageApp == true. Export path. Default:
output/$(SDK)/$(Configuration).
#exportOptions: 'auto' # 'auto' | 'plist' | 'specify'. Optional. Use
when packageApp == true. Export options. Default: auto.
#exportMethod: 'development' # string. Required when exportOptions ==
specify. Export method. Default: development.
#exportTeamId: # string. Optional. Use when exportOptions == specify.
Team ID.
#exportOptionsPlist: # string. Required when exportOptions == plist.
Export options plist.
#exportArgs: # string. Optional. Use when packageApp == true. Export
arguments.
# Signing & provisioning
#signingOption: 'nosign' # 'nosign' | 'default' | 'manual' | 'auto'.
Signing style. Default: nosign.
#signingIdentity: # string. Optional. Use when signingOption = manual.
Signing identity.
#provisioningProfileUuid: # string. Optional. Use when signingOption =
manual. Provisioning profile UUID.
#provisioningProfileName: # string. Optional. Use when signingOption =
manual. Provisioning profile name.
#teamId: # string. Optional. Use when signingOption = auto. Team ID.
# Devices & simulators
#destinationPlatformOption: 'default' # 'default' | 'iOS' | 'tvOS' |
'macOS' | 'custom'. Destination platform. Default: default.
#destinationPlatform: # string. Optional. Use when
destinationPlatformOption == custom. Custom destination platform.
#destinationTypeOption: 'simulators' # 'simulators' | 'devices'.
Optional. Use when destinationPlatformOption != default &&
destinationPlatformOption != macOS. Destination type. Default: simulators.
#destinationSimulators: # string. Optional. Use when
destinationPlatformOption != default && destinationPlatformOption != macOS
&& destinationTypeOption == simulators. Simulator.
#destinationDevices: # string. Optional. Use when
destinationPlatformOption != default && destinationPlatformOption != macOS
&& destinationTypeOption == devices. Device.
# Advanced
#args: # string. Arguments.
#workingDirectory: # string. Alias: cwd. Working directory.
#useXcpretty: true # boolean. Use xcpretty. Default: true.
#xcprettyArgs: # string. Optional. Use when useXcpretty == true.
Xcpretty arguments.
#publishJUnitResults: false # boolean. Publish test results to Azure
Pipelines. Default: false.
#testRunTitle: # string. Optional. Use when publishJUnitResults == true.
Test run title.
Inputs
actions - Actions
string . Required. Default value: build .
Specifies a space-delimited list of actions. Some valid options are build , clean , test ,
analyze , and archive . For example, clean build performs a clean build. See Apple:
Building from the command line with Xcode FAQ .
configuration - Configuration
Specifies the Xcode project or workspace configuration to build. When using a variable,
specify a value (for example, Release ) on the Variables tab.
sdk - SDK
Optional. Specifies a relative path from the root of the repository to the Xcode
workspace or project. For example, MyApp/MyApp.xcworkspace or MyApp/MyApp.xcodeproj .
Wildcards can be used. Learn more about file matching patterns.
scheme - Scheme
string .
Optional. Specifies an Xcode scheme name. Must be a shared scheme (shared checkbox
under Managed Schemes in Xcode). If you do not specify a scheme, and the specified
workspace has a single shared scheme, the workspace scheme will be used.
string . Allowed values: 8 (Xcode 8), 9 (Xcode 9), 10 (Xcode 10), 11 (Xcode 11), 12
(Xcode 12), 13 (Xcode 13), default , specifyPath (Specify path). Default value: default .
Specifies the target version of Xcode. Select Default to use the default version of Xcode
on the agent machine. Specifying a version number (for example, Xcode 9 ) relies on the
version's location to be set by environment variables on the agent machine (for
example, XCODE_9_DEVELOPER_DIR=/Applications/Xcode_9.0.0.app/Contents/Developer ).
Select Specify path to provide a specific path to the Xcode developer directory.
Specifies the destination for the product exported from the archive.
string . Optional. Use when packageApp == true . Allowed values: auto (Automatic),
plist , specify . Default value: auto .
Specifies options for exporting the archive. When the default value of Automatic is
selected, the export method is automatically detected from the archive. Select Plist to
specify a plist file containing export options. Select Specify to provide a specific Export
method and Team ID.
Specifies the method that Xcode uses to export the archive. For example: app-store ,
package , ad-hoc , enterprise , or development .
exportTeamId - Team ID
string . Optional. Use when exportOptions == specify .
Specifies the Apple Developer Portal 10-character team ID to use during the export.
Specifies the path to the plist file that contains options to use during the export.
exportArgs - Export arguments
string . Optional. Use when packageApp == true .
string . Allowed values: nosign (Do not code sign), default (Project defaults), manual
Specifies the method of signing the build. Select Do not code sign to disable signing.
Select Project defaults to use only the project's signing configuration. Select Manual
signing to force manual signing and optionally specify a signing identity and
provisioning profile. Select Automatic signing to force automatic signing and optionally
specify a development team ID. If your project requires signing, use the Install Apple...
tasks to install certificates and provisioning profiles prior to the Xcode build.
Specifies a signing identity override with which to sign the build. Unlocking the default
keychain on the agent machine may be required. If no value is entered, the Xcode
project's setting is used.
Specifies the UUID of an installed provisioning profile used for the build. Use separate
build tasks with different schemes or targets to specify provisioning profiles by target in
a single workspace (iOS, tvOS, watchOS).
Specifies the name of an installed provisioning profile used for the build. If specified,
this takes precedence over the provisioning profile UUID. Use separate build tasks with
different schemes or targets to specify provisioning profiles by target in a single
workspace (iOS, tvOS, watchOS).
teamId - Team ID
string . Optional. Use when signingOption = auto .
Required if you are a member of multiple development teams. Specifies the 10-
character development team ID.
value: default .
Specifies the destination device's platform used for UI testing when the generic build
device isn't valid. Choose Custom to specify a platform not included in this list. When
Default is selected, no simulators or devices are targeted.
Specifies a destination device's platform used for UI testing when the generic build
device isn't valid. Choose Custom to specify a platform not included in the list. When
Default is selected, no simulators nor devices are targeted.
Specifies the destination type to use for UI testing. Devices must be connected to the
Mac performing the build via a cable or network connection. See Devices and
Simulators in Xcode for more information.
destinationSimulators - Simulator
Specifies an Xcode simulator name used for UI testing. For example, iPhone X (iOS and
watchOS) or Apple TV 4K (tvOS). An optional target OS version can be specified in the
format OS=<versionNumber> , such as iPhone X,OS=11.1 . See this list of simulators
installed on the Hosted macOS agent for more information.
destinationDevices - Device
Specifies the name of the device used for UI testing, such as Raisa's iPad . Only one
device is currently supported. Note that Apple does not allow apostrophes ( ' ) in device
names. Instead, right single quotation marks ( ' ) can be used.
args - Arguments
string .
Optional. Specifies additional command line arguments with which to build. This input is
useful for specifying -target or -project arguments instead of a workspace/project
and scheme. See Apple: Building from the command line with Xcode FAQ .
Optional. Specifies the working directory in which to run the build. If no value is entered,
the root of the repository is used.
If xcpretty is enabled, this input specifies arguments for xcpretty . See a list of xcpretty
arguments on GitHub .
publishJUnitResults - Publish test results to Azure Pipelines
boolean . Default value: false .
Specifies whether to publish JUnit test results to Azure Pipelines. This requires xcpretty
to be enabled to generate JUnit test results.
If xcpretty and publishJUnitResults are enabled, you can specify the test run title.
Output variables
None.
Remarks
Use this task to build, test, or archive an Xcode workspace on macOS, and optionally
package an app.
Examples
Build your Xcode app
Requirements
ノ Expand table
Requirement Description
Demands Self-hosted agents must have capabilities that match the following demands
to run jobs that use this task: xcode
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Command Any
restrictions
Feedback
Was this page helpful? Yes No
Use this task to build, test, or archive an Xcode workspace on macOS, and optionally
package an app.
Syntax
YAML
# Xcode v4
# Build, test, or archive an Xcode workspace on macOS. Optionally package an
app.
- task: Xcode@4
inputs:
actions: 'build' # string. Required. Actions. Default: build.
#configuration: '$(Configuration)' # string. Configuration. Default:
$(Configuration).
#sdk: '$(SDK)' # string. SDK. Default: $(SDK).
#xcWorkspacePath: '**/*.xcodeproj/project.xcworkspace' # string.
Workspace or project path. Default: **/*.xcodeproj/project.xcworkspace.
#scheme: # string. Scheme.
#xcodeVersion: 'default' # '8' | '9' | 'default' | 'specifyPath'. Xcode
version. Default: default.
#xcodeDeveloperDir: # string. Optional. Use when xcodeVersion ==
specifyPath. Xcode developer path.
# Package options
#packageApp: false # boolean. Create app package. Default: false.
#archivePath: # string. Optional. Use when packageApp == true. Archive
path.
#exportPath: 'output/$(SDK)/$(Configuration)' # string. Optional. Use
when packageApp == true. Export path. Default:
output/$(SDK)/$(Configuration).
#exportOptions: 'auto' # 'auto' | 'plist' | 'specify'. Optional. Use
when packageApp == true. Export options. Default: auto.
#exportMethod: 'development' # string. Required when exportOptions ==
specify. Export method. Default: development.
#exportTeamId: # string. Optional. Use when exportOptions == specify.
Team ID.
#exportOptionsPlist: # string. Required when exportOptions == plist.
Export options plist.
#exportArgs: # string. Optional. Use when packageApp == true. Export
arguments.
# Signing & provisioning
#signingOption: 'nosign' # 'nosign' | 'default' | 'manual' | 'auto'.
Signing style. Default: nosign.
#signingIdentity: # string. Optional. Use when signingOption = manual.
Signing identity.
#provisioningProfileUuid: # string. Optional. Use when signingOption =
manual. Provisioning profile UUID.
#teamId: # string. Optional. Use when signingOption = auto. Team ID.
# Devices & simulators
#destinationPlatformOption: 'default' # 'default' | 'iOS' | 'tvOS' |
'macOS' | 'custom'. Destination platform. Default: default.
#destinationPlatform: # string. Optional. Use when
destinationPlatformOption == custom. Custom destination platform.
#destinationTypeOption: 'simulators' # 'simulators' | 'devices'.
Optional. Use when destinationPlatformOption != default &&
destinationPlatformOption != macOS. Destination type. Default: simulators.
#destinationSimulators: 'iPhone 7' # string. Optional. Use when
destinationPlatformOption != default && destinationPlatformOption != macOS
&& destinationTypeOption == simulators. Simulator. Default: iPhone 7.
#destinationDevices: # string. Optional. Use when
destinationPlatformOption != default && destinationPlatformOption != macOS
&& destinationTypeOption == devices. Device.
# Advanced
#args: # string. Arguments.
#workingDirectory: # string. Alias: cwd. Working directory.
#outputPattern: # string. Output directory.
#useXcpretty: false # boolean. Use xcpretty. Default: false.
#publishJUnitResults: false # boolean. Publish test results to VSTS/TFS.
Default: false.
Inputs
actions - Actions
string . Required. Default value: build .
Specifies a space-delimited list of actions. Valid options are build , clean , test ,
analyze , and archive . For example, clean build performs a clean build. See the Apple:
configuration - Configuration
Specifies the Xcode project or workspace configuration to build. When using a variable,
specify a value (for example, Release ) on the Variables tab.
sdk - SDK
Specifies an SDK to use when building the Xcode project or workspace. From the macOS
Terminal application, run xcodebuild -showsdks to display the valid list of SDKs. When
using a variable, specify a value (for example, iphonesimulator ) on the Variables tab.
xcWorkspacePath - Workspace or project path
Optional. Specifies a relative path from the root of the repository to the Xcode
workspace or project. If you specify a value, you must also specify the scheme. Do not
specify a value if you are specifying -target flag in Advanced Arguments. For example,
MyApp/MyApp.xcworkspace or MyApp/MyApp.xcodeproj .
scheme - Scheme
string .
Optional. Specifies an Xcode scheme name. Must be a shared scheme (shared checkbox
under Managed Schemes in Xcode). If you do not specify a scheme, and the specified
workspace has a single shared scheme, the workspace scheme will be used.
string . Allowed values: 8 (Xcode 8), 9 (Xcode 9), default , specifyPath (Specify path).
Specifies the target version of Xcode. Select Default to use the default version of Xcode
on the agent machine. Specifying a version number (for example, Xcode 9 ) relies on the
version's location to be set by environment variables on the agent machine (for
example, XCODE_9_DEVELOPER_DIR=/Applications/Xcode_9.0.0.app/Contents/Developer ).
Select Specify path to provide a specific path to the Xcode developer directory.
Specifies whether an IPA app package file should be generated as a part of the build.
archivePath - Archive path
string . Optional. Use when packageApp == true .
Specifies the destination for the product exported from the archive.
string . Optional. Use when packageApp == true . Allowed values: auto (Automatic),
plist , specify . Default value: auto .
Specifies options for exporting the archive. When the default value of Automatic is
selected, the export method is automatically detected from the archive. Select Plist to
specify a plist file containing export options. Select Specify to provide a specific Export
method and Team ID.
Specifies the method that Xcode uses to export the archive. For example: app-store ,
package , ad-hoc , enterprise , or development .
exportTeamId - Team ID
string . Optional. Use when exportOptions == specify .
Specifies the Apple Developer Portal 10-character team ID to use during the export.
Specifies the path to the plist file that contains options to use during the export.
exportArgs - Export arguments
string . Optional. Use when packageApp == true .
string . Allowed values: nosign (Do not code sign), default (Project defaults), manual
Specifies the method of signing the build. Select Do not code sign to disable signing.
Select Project defaults to use only the project's signing configuration. Select Manual
signing to force manual signing and optionally specify a signing identity and
provisioning profile. Select Automatic signing to force automatic signing and optionally
specify a development team ID. If your project requires signing, use the Install Apple...
tasks to install certificates and provisioning profiles prior to the Xcode build.
Specifies a signing identity override with which to sign the build. Unlocking the default
keychain on the agent machine may be required. If no value is entered, the Xcode
project's setting is used.
Specifies the UUID of an installed provisioning profile used for the build. Use separate
build tasks with different schemes or targets to specify provisioning profiles by target in
a single workspace (iOS, tvOS, watchOS).
teamId - Team ID
Required if you are a member of multiple development teams. Specifies the 10-
character development team ID.
string . Allowed values: default , iOS (iOS and watchOS), tvOS , macOS , custom . Default
value: default .
Specifies the destination device's platform used for UI testing when the generic build
device isn't valid. Choose Custom to specify a platform not included in the list. When
Default is selected, no simulators or devices are targeted.
Specifies a destination device's platform used for UI testing when the generic build
device isn't valid.
Specifies the destination type used for UI testing. Devices must be connected to the
Mac performing the build via a cable or network connection. See Devices and
Simulators in Xcode for more information.
destinationSimulators - Simulator
Specifies an Xcode simulator name used for UI testing. For example, iPhone X (iOS and
watchOS) or Apple TV 4K (tvOS). An optional target OS version can be specified in the
format OS=<versionNumber> , such as iPhone X,OS=11.1 . Learn more about installed
simulators on the Hosted macOS Preview agent.
destinationDevices - Device
string . Optional. Use when destinationPlatformOption != default &&
Specifies the name of the device used for UI testing, such as Raisa's iPad .
args - Arguments
string .
Optional. Specifies additional command line arguments with which to build. This input is
useful for specifying -target or -project arguments instead of a workspace/project
and scheme. See the Apple: Building from the command line with Xcode FAQ .
Optional. Specifies the working directory in which to run the build. If no value is entered,
the root of the repository is used.
string .
Optional. Specifies a relative path to the working directory where build output (binaries)
are placed. For example: output/$(SDK)/$(Configuration) or
output/$(TestSDK)/$(TestConfiguration) . Archive and export paths are configured
Specifies whether to use xcpretty to format xcodebuild output, and generates JUnit
test results. xcpretty must be installed on the agent machine (It is preinstalled on VSTS
hosted build agents). See xcpretty for more information.
If xcpretty is enabled, this input specifies whether to publish the JUnit test results to
VSTS/TFS.
Remarks
Use this task to build an Xcode workspace on macOS.
Examples
Build, test, and deploy Xcode apps
Requirements
ノ Expand table
Requirement Description
Demands Self-hosted agents must have capabilities that match the following demands
to run jobs that use this task: xcode
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Command Any
restrictions
Feedback
Was this page helpful? Yes No
Syntax
# Xcode Build v3
# Build an Xcode workspace on macOS.
- task: Xcode@3
inputs:
actions: 'build' # string. Required. Actions. Default: build.
#configuration: '$(Configuration)' # string. Configuration. Default:
$(Configuration).
#sdk: '$(SDK)' # string. SDK. Default: $(SDK).
#xcWorkspacePath: '**/*.xcodeproj/*.xcworkspace' # string.
Workspace/Project Path. Default: **/*.xcodeproj/*.xcworkspace.
#scheme: # string. Scheme.
#packageApp: true # boolean. Create App Package. Default: true.
# Package Options
#archivePath: # string. Archive Path.
#exportPath: 'output/$(SDK)/$(Configuration)' # string. Export Path.
Default: output/$(SDK)/$(Configuration).
#exportOptions: 'auto' # 'auto' | 'plist' | 'specify'. Export Options.
Default: auto.
#exportMethod: 'development' # string. Required when exportOptions ==
specify. Export Method. Default: development.
#exportTeamId: # string. Optional. Use when exportOptions == specify.
Team ID.
#exportOptionsPlist: # string. Required when exportOptions == plist.
Export Options Plist.
#exportArgs: # string. Export Arguments.
# Signing & Provisioning
#xcode8AutomaticSigning: false # boolean. Automatic Signing. Default:
false.
#teamId: # string. Optional. Use when xcode8AutomaticSigning = true.
Team ID.
#signMethod: 'file' # 'file' | 'id'. Override Using. Default: file.
#iosSigningIdentity: # string. Optional. Use when signMethod = id.
Signing Identity.
#unlockDefaultKeychain: false # boolean. Optional. Use when signMethod =
id. Unlock Default Keychain. Default: false.
#defaultKeychainPassword: # string. Optional. Use when signMethod = id.
Default Keychain Password.
#provProfileUuid: # string. Optional. Use when signMethod = id.
Provisioning Profile UUID.
#p12: # string. Optional. Use when signMethod = file. P12 Certificate
File.
#p12pwd: # string. Optional. Use when signMethod = file. P12 Password.
#provProfile: # string. Optional. Use when signMethod = file.
Provisioning Profile File.
#removeProfile: false # boolean. Optional. Use when signMethod = file.
Remove Profile After Build. Default: false.
# Advanced
#args: # string. Arguments.
#cwd: # string. Working Directory.
outputPattern: 'output/$(SDK)/$(Configuration)' # string. Required.
Output Directory. Default: output/$(SDK)/$(Configuration).
#xcodeDeveloperDir: # string. Xcode Developer Path.
#useXcpretty: false # boolean. Use xcpretty. Default: false.
#publishJUnitResults: false # boolean. Publish to VSTS/TFS. Default:
false.
Inputs
actions - Actions
Specifies a space-delimited list of actions. Valid options are build , clean , test ,
analyze , and archive . For example: build clean performs a clean build. See the Apple:
configuration - Configuration
string . Default value: $(Configuration) .
Specifies the Xcode project or workspace configuration to build. When using a variable,
specify a value (for example, Release ) on the Variables tab.
sdk - SDK
string . Default value: $(SDK) .
Builds an Xcode project or workspace against the specified SDK. Run xcodebuild -
showsdks to see a valid list of SDKs.
Optional. Specifies the relative path from the repo root to the Xcode workspace or
project. For example: MyApp/MyApp.xcworkspace or
MyApp/MyApp.xcworkspace/MyApp.xcodeproj . Leave blank if you intend to use -target
flag under Advanced Arguments.
scheme - Scheme
string .
Optional. Specifies the Xcode scheme name. Must be a shared scheme (shared checkbox
under Managed Schemes in Xcode). Required if Workspace is specified.
Specifies whether an IPA is generated as a part of the build. For exporting archives with
Xcode 7 and Xcode 8, review additional inputs in the Package Options section.
string .
Optional. Specifies the destination for the product exported from the archive.
Specifies the method Xcode uses to export the archive. For example, app-store ,
package , ad-hoc , enterprise , or development .
exportTeamId - Team ID
Specifies the Apple Developer Portal 10-digit team ID to use for the export.
exportOptionsPlist - Export Options Plist
Use this input if you have an Xcode 8 or Xcode 9 project configured for Automatic
Signing.
teamId - Team ID
Specifies the 10-digit developer team ID. This is required if you are a member of
multiple development teams.
string . Allowed values: file (File Contents), id (Identifiers). Default value: file .
Use this input if the build uses a signing or provisioning method that is different than
the default. Choose File Contents to use a P12 certificate and provisioning profile.
Choose Identifiers to retrieve signing settings from the default keychain and pre-
installed profiles. Leave the corresponding fields blank if you do not wish to override the
default build settings.
Specifies the signing identity override that is used to sign the build. Defaults to the
Xcode project setting. Unlock Default Keychain may need to be selected.
unlockDefaultKeychain - Unlock Default Keychain
boolean . Optional. Use when signMethod = id . Default value: false .
Resolves User interaction is not allowed errors by unlocking the default keychain.
Specifies the UUID of an installed provisioning profile to use for the build. Use separate
build tasks with different schemes or targets to specify provisioning profiles by target in
a single workspace (iOS, WatchKit, tvOS).
Specifies the relative path to a PKCS12 formatted P12 certificate file that contains a
signing certificate to be used for the build.
Specifies the password to a P12 certificate file. Use a build variable to encrypt.
Specifies the relative path to a file containing a provisioning profile override to be used
for the build. Use separate build tasks with different schemes or targets to specify
provisioning profiles by target in a single workspace (iOS, WatchKit, tvOS).
args - Arguments
string .
Specifies additional command line arguments used to build. This input is useful if you
want to use -target or -project instead of specifying a workspace and scheme.
string .
Specifies the working directory for build runs. Defaults to the root of the repository.
Specifies the relative path where build output (binaries) are placed.
string .
Optional. Specifies the path to the Xcode Developer folder if it's not the system default.
For use when multiple versions of Xcode are installed on a system. For example:
/Applications/Xcode 7.app/Contents/Developer .
Formats xcodebuild output and generates a JUnit test results report. Must be installed
on agent hosts. Learn more about xcpretty .
JUnit test results that were produced using xctool are published to VSTS/TFS.
Task control options
All tasks have control options in addition to their task inputs. For more information, see
Control options and common task properties.
Output variables
None.
Requirements
ノ Expand table
Requirement Description
Demands Self-hosted agents must have capabilities that match the following demands
to run jobs that use this task: xcode
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Command Any
restrictions
Feedback
Was this page helpful? Yes No
Syntax
# Xcode Build v2
# Build an Xcode workspace on Mac OS.
- task: Xcode@2
inputs:
actions: 'build' # string. Required. Actions. Default: build.
#configuration: '$(Configuration)' # string. Configuration. Default:
$(Configuration).
#sdk: '$(SDK)' # string. SDK. Default: $(SDK).
#xcWorkspacePath: '**/*.xcodeproj/*.xcworkspace' # string.
Workspace/Project Path. Default: **/*.xcodeproj/*.xcworkspace.
#scheme: # string. Scheme.
#packageApp: true # boolean. Create App Package. Default: true.
# Package Options
packageTool: 'xcodebuild' # 'xcrun' | 'xcodebuild'. Required. Create
Package (IPA) using. Default: xcodebuild.
#archivePath: # string. Optional. Use when packageTool == xcodebuild.
Archive Path.
#exportPath: 'output/$(SDK)/$(Configuration)' # string. Optional. Use
when packageTool == xcodebuild. Export Path. Default:
output/$(SDK)/$(Configuration).
#exportOptions: 'auto' # 'auto' | 'plist' | 'specify'. Optional. Use
when packageTool == xcodebuild. Export Options. Default: auto.
#exportMethod: 'development' # string. Required when exportOptions ==
specify. Export Method. Default: development.
#exportTeamId: # string. Optional. Use when exportOptions == specify.
Team ID.
#exportOptionsPlist: # string. Required when exportOptions == plist.
Export Options Plist.
# Signing & Provisioning
#xcode8AutomaticSigning: false # boolean. Automatic Signing. Default:
false.
#teamId: # string. Optional. Use when xcode8AutomaticSigning = true.
Team ID.
#signMethod: 'file' # 'file' | 'id'. Override Using. Default: file.
#iosSigningIdentity: # string. Optional. Use when signMethod = id.
Signing Identity.
#unlockDefaultKeychain: false # boolean. Optional. Use when signMethod =
id. Unlock Default Keychain. Default: false.
#defaultKeychainPassword: # string. Optional. Use when signMethod = id.
Default Keychain Password.
#provProfileUuid: # string. Optional. Use when signMethod = id.
Provisioning Profile UUID.
#p12: # string. Optional. Use when signMethod = file. P12 Certificate
File.
#p12pwd: # string. Optional. Use when signMethod = file. P12 Password.
#provProfile: # string. Optional. Use when signMethod = file.
Provisioning Profile File.
#removeProfile: false # boolean. Optional. Use when signMethod = file.
Remove Profile After Build. Default: false.
# Advanced
#args: # string. Arguments.
#cwd: # string. Working Directory.
outputPattern: 'output/$(SDK)/$(Configuration)' # string. Required.
Output Directory. Default: output/$(SDK)/$(Configuration).
#xcodeDeveloperDir: # string. Xcode Developer Path.
#useXcpretty: false # boolean. Use xcpretty. Default: false.
#publishJUnitResults: false # boolean. Publish to VSTS/TFS. Default:
false.
# xctool (deprecated)
#useXctool: # boolean. Use xctool.
#xctoolReporter: # string. xctool Test Reporter Format.
Inputs
actions - Actions
string . Required. Default value: build .
Specifies a space-delimited list of actions. Valid options are build , clean , test ,
analyze , and archive . For example, build clean performs a clean build. See the Apple:
configuration - Configuration
Specifies the Xcode project or workspace configuration to build. When using a variable,
specify a value (for example, Release ) on the Variables tab.
sdk - SDK
Builds an Xcode project or workspace against the specified SDK. Run xcodebuild -
showsdks to see a valid list of SDKs.
Leave blank if you intend to use -target flag under Advanced Arguments.
scheme - Scheme
string .
Optional. Specifies the Xcode scheme name. Must be a shared scheme (shared checkbox
under Managed Schemes in Xcode). Required if Workspace is specified.
Specifies whether an IPA is generated as a part of the build. For exporting archives with
Xcode 7 and Xcode 8, review additional inputs in the Package Options section.
output/$(SDK)/$(Configuration) .
Specifies the destination for the product exported from the archive.
Specifies the method Xcode uses to export the archive. For example, app-store ,
package , ad-hoc , enterprise , or development .
exportTeamId - Team ID
string . Optional. Use when exportOptions == specify .
Specifies the Apple Developer Portal 10-digit team ID to use for the export.
Use this input if you have an Xcode 8 or Xcode 9 project configured for Automatic
Signing.
teamId - Team ID
string . Optional. Use when xcode8AutomaticSigning = true .
Specifies the 10-digit developer team ID. This is required if you are a member of
multiple development teams.
string . Allowed values: file (File Contents), id (Identifiers). Default value: file .
Use this input if the build uses a signing or provisioning method that is different than
the default. Choose File Contents to use a P12 certificate and provisioning profile.
Choose Identifiers to retrieve signing settings from the default keychain and pre-
installed profiles. Leave the corresponding fields blank if you do not wish to override the
default build settings.
iosSigningIdentity - Signing Identity
Specifies the signing identity override that is used to sign the build. Defaults to the
Xcode project setting. Unlock Default Keychain may need to be selected.
Resolves User interaction is not allowed errors by unlocking the default keychain.
Specifies the UUID of an installed provisioning profile to use for the build. Use separate
build tasks with different schemes or targets to specify provisioning profiles by target in
a single workspace (iOS, WatchKit, tvOS).
Specifies the relative path to a PKCS12 formatted P12 certificate file that contains a
signing certificate to be used for the build.
Specifies the password to a P12 certificate file if specified. Use a build variable to
encrypt.
provProfile - Provisioning Profile File
string . Optional. Use when signMethod = file .
Specifies the relative path to a file containing a provisioning profile override to be used
for the build. Use separate build tasks with different schemes or targets to specify
provisioning profiles by target in a single workspace (iOS, WatchKit, tvOS).
Removes the contents of the provisioning profile file from the build agent after the build
is complete. Only check if you are running one agent per user.
args - Arguments
string .
Specifies additional command line arguments used to build. This input is useful if you
want to use -target or -project instead of specifying a workspace and scheme.
string .
Specifies the working directory for build runs. Defaults to the root of the repository.
Specifies the relative path where build output (binaries) are placed.
Optional. Specifies the path to the Xcode Developer folder if it's not the system default.
For use when multiple versions of Xcode are installed on a system. For example:
/Applications/Xcode 7.app/Contents/Developer .
JUnit test results that were produced using xctool are published to VSTS/TFS.
Uses xctool instead of xcodebuild . Must be installed on agent hosts. Learn more about
xctool .
Note: xctool is deprecated and does not work with Xcode 8.
string .
Tests the reporter format to use when the test action is specified and Use xctool is
checked. Specify junit:output-file-path-here.xml to generate a file format compatible
with the Publish Test Results task. When specified, plain is automatically added. xctool
must be installed on agent hosts. Learn more about xctool .
Note: xctool is deprecated and does not work with Xcode 8.
Output variables
None.
Requirements
ノ Expand table
Requirement Description
Demands Self-hosted agents must have capabilities that match the following demands
to run jobs that use this task: xcode
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Command Any
restrictions
Feedback
Was this page helpful? Yes No
Use this task to generate an .ipa file from Xcode build output using xcrun (Xcode 7 or
below).
Syntax
# Xcode Package iOS v0
# Generate an .ipa file from Xcode build output using xcrun (Xcode 7 or
below).
- task: XcodePackageiOS@0
inputs:
appName: 'name.app' # string. Required. Name of .app. Default: name.app.
ipaName: 'name.ipa' # string. Required. Name of .ipa. Default: name.ipa.
provisioningProfile: # string. Required. Provisioning Profile Name.
sdk: 'iphoneos' # string. Required. SDK. Default: iphoneos.
# Advanced
appPath: '$(SDK)/$(Configuration)/build.sym/$(Configuration)-$(SDK)' #
string. Required. Path to .app. Default:
$(SDK)/$(Configuration)/build.sym/$(Configuration)-$(SDK).
ipaPath:
'$(SDK)/$(Configuration)/build.sym/$(Configuration)-$(SDK)/output' # string.
Required. Path to place .ipa. Default:
$(SDK)/$(Configuration)/build.sym/$(Configuration)-$(SDK)/output.
Inputs
appName - Name of .app
Specifies the name of the .app, which is sometimes different from the .ipa.
Specifies the name of the .ipa, which is sometimes different from the .app.
provisioningProfile - Provisioning Profile Name
string . Required.
sdk - SDK
Specifies the SDK. Run xcodebuild -showsdks to see the valid list of SDKs.
$(SDK)/$(Configuration)/build.sym/$(Configuration)-$(SDK) .
$(SDK)/$(Configuration)/build.sym/$(Configuration)-$(SDK)/output .
Specifies the relative path where the .ipa is placed. The directory is created if it doesn't
exist.
Output variables
None.
Remarks
Use this task to generate an .ipa file from Xcode build output.
) Important
The Xcode Package iOS task has been deprecated. It is relevant only if you are
using Xcode 6.4. Otherwise, use the latest version of the Xcode task.
Requirements
ノ Expand table
Requirement Description
Demands Self-hosted agents must have capabilities that match the following demands
to run jobs that use this task: xcode
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Command Any
restrictions
Feedback
Was this page helpful? Yes No