How to: Work with release definitions

Last Update: 5/16/2017

Team Services | TFS 2017 | TFS 2015 | Previous versions: XAML Build, Release

Also check out the new release definition editor.

This topic shows you how to:

Create a new release definition

  1. Open the Build & Release hub and choose Releases.

  2. Choose the + icon and select Create release definition.

    Creating a new release definition

Select a template

If a template is relevant to your scenario, select it to automatically add some tasks and apply typical settings. For example, if you select the Azure App Service Deployment template, you automatically get a task to deploy your app to Azure App Services.

Start with an empty definition

If there's no template for your scenario, select Empty and then add the tasks you need.

Specify the artifacts, deployment trigger, and queue

  1. Choose the type of source for your artifacts, if appropriate, and specify the details such as the project and build definition.

  2. If you want the release to start when a new build of the artifacts is available, set (tick) the Continuous deployment... checkbox.

  3. Choose an agent queue if you don't want to use the Hosted queue.

Replicate a definition

If your definition has a pattern that you want to replicate in other definitions, clone it or export it.

Cloning an existing release definition

When you clone a definition, the copy appears in your list of releases. You can save it with a new name.

When you export a definition, you can import it afterwards. Then, if required, modify it and save it with a new name.

Importing an existing release definition

Create and use a template

Create a template for a definition from an environment within the definition.

Creating a template from an existing release definition

After you create a template, it appears in the Custom tab of the Create release definition wizard. Your team members can use it to follow the pattern in new definitions. For more details, see Environment templates in Release Management.

Use the REST API

Create release definitions using the Release Management REST API.

Add more environments

A release definition, by default, contains a single environment. Configure additional environments in a release definition to represent the target server(s) or locations where you will deploy your app.

  1. Open the + Add environment list and choose Create new environment.

    Adding a new environment to a release definition

  2. In the Add new environment dialog select a template for the new environment to automatically add appropriate tasks, or create an empty environment with no default tasks.

  3. Select the pre-deployment approval, trigger, and queue settings for the new environment. You can quickly select users or groups as pre-deployment approvers by typing part of the name.

  4. Choose Create and then edit the new environment name as required.

After you have created and configured your environments, add tasks to them.

You can add environments using the Release Management REST API.

Clone an environment

A release definition often contains several environments such as development, testing, QA, and production. Typically, all of these environments are fundamentally similar - and the techniques used to set up and deploy to each one are the same with the exception of minor differences in configuration for each environment and task (such as target URLs, service paths, and server names).

After you have added an environment to a release definition and configured it by adding tasks and setting the properties for each one, clone it to create another environment within the same definition.

Cloning an environment in a release definition

Alternatively, select the environment you want to clone in the environments column, open the + Add environment list, and choose Clone selected environment.

Cloning an environment in a release definition

The cloned environment has the same tasks, task properties, and configuration settings as the original.

The Add new environment dialog that opens lets you change the pre-deployment approval, trigger, and queue settings for the cloned environment.

Define processes in an environment

The deployment steps in an environment are described using tasks.

Add tasks

Select an environment in the definition and choose + Add tasks. By default, the task selector shows tasks generally used in a release definition. More tasks are available in the other tabs of the Task catalog dialog. A link at the bottom of the list takes you to Visual Studio Marketplace where you can download and install additional tasks.

You can add tasks specifically for execution on the release agent, on the server, or on a deployment group.

Adding a new task phase

For more details, see Environments and Phases in Build and Release Management.

You can add tasks to an environment using the Release Management REST API.

Use task groups

A task group lets you to encapsulate a sequence of tasks already defined in a build or a release definition into a single reusable task that can be added to a build or release definition just like any other task. You can choose to extract the parameters from the encapsulated tasks as configuration variables, and abstract the rest of the task information.

Creating task group context action

For more details, see Task groups.


Release definition concepts

A release definition contains all the tasks and settings used to create a release and deployment to your target machines. To learn more about release definition settings, see:


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


How do I programmatically create a release definition?

Release Management REST API

Do I need an agent?

You need at least one agent to run your build or release. Get an agent.

I can't select a default agent queue and I can't queue my build or release. How do I fix this?

See queues.

I use Team Foundation Server on-premises and I don't see some of these features. Why not?

Some of these features are available only on Visual Studio Team Services and not yet available on-premises. Some features are available on-premises if you have upgraded to the latest version of TFS.

Help and support