Taskgroups - Add

Create a task group.

POST https://dev.azure.com/{organization}/{project}/_apis/distributedtask/taskgroups?api-version=5.0-preview.1

URI Parameters

Name In Required Type Description
organization
path True

string

The name of the Azure DevOps organization.

project
path True

string

Project ID or project name

api-version
query True

string

Version of the API to use. This should be set to '5.0-preview.1' to use this version of the api.

Request Body

Name Type Description
author

string

Sets author name of the task group.

category

string

Sets category of the task group.

description

string

Sets description of the task group.

friendlyName

string

Sets friendly name of the task group.

iconUrl

string

Sets url icon of the task group.

inputs

TaskInputDefinition[]

Sets input for the task group.

instanceNameFormat

string

Sets display name of the task group.

name

string

Sets name of the task group.

parentDefinitionId

string

Sets parent task group Id. This is used while creating a draft task group.

runsOn

string[]

Sets RunsOn of the task group. Value can be 'Agent', 'Server' or 'DeploymentGroup'.

tasks

TaskGroupStep[]

Sets tasks for the task group.

version

TaskVersion

Sets version of the task group.

Responses

Name Type Description
200 OK

TaskGroup

successful operation

Security

oauth2

Type: oauth2
Flow: accessCode
Authorization URL: https://app.vssps.visualstudio.com/oauth2/authorize&response_type=Assertion
Token URL: https://app.vssps.visualstudio.com/oauth2/token?client_assertion_type=urn:ietf:params:oauth:client-assertion-type:jwt-bearer&grant_type=urn:ietf:params:oauth:grant-type:jwt-bearer

Scopes

Name Description
vso.taskgroups_write Grants the ability to read and create task groups

Examples

Create a task group

Sample Request

POST https://dev.azure.com/fabrikam/MyFirstProject/_apis/distributedtask/taskgroups?api-version=5.0-preview.1

{
  "tasks": [
    {
      "displayName": "PowerShell Script",
      "alwaysRun": false,
      "continueOnError": false,
      "enabled": true,
      "timeoutInMinutes": 0,
      "inputs": {
        "scriptType": "inlineScript",
        "inlineScript": "\"Production script1\""
      },
      "task": {
        "id": "e213ff0f-5d5c-4791-802d-52ea3e7be1f1",
        "versionSpec": "1.*",
        "definitionType": "task"
      }
    },
    {
      "displayName": "PowerShell Script",
      "alwaysRun": false,
      "continueOnError": false,
      "enabled": true,
      "timeoutInMinutes": 0,
      "inputs": {
        "scriptType": "inlineScript",
        "inlineScript": "\"Production script2\""
      },
      "task": {
        "id": "e213ff0f-5d5c-4791-802d-52ea3e7be1f1",
        "versionSpec": "1.*",
        "definitionType": "task"
      }
    }
  ],
  "name": "My PowerShell TG",
  "version": {
    "major": 1,
    "minor": 0,
    "patch": 0,
    "isTest": false
  },
  "category": "Deploy",
  "definitionType": "metaTask",
  "instanceNameFormat": "Task group: TG"
}

Sample Response

{
  "tasks": [
    {
      "displayName": "PowerShell Script",
      "alwaysRun": false,
      "continueOnError": false,
      "enabled": true,
      "timeoutInMinutes": 0,
      "inputs": {
        "scriptType": "inlineScript",
        "inlineScript": "\"Production script1\""
      },
      "task": {
        "id": "e213ff0f-5d5c-4791-802d-52ea3e7be1f1",
        "versionSpec": "1.*",
        "definitionType": "task"
      }
    },
    {
      "displayName": "PowerShell Script",
      "alwaysRun": false,
      "continueOnError": false,
      "enabled": true,
      "timeoutInMinutes": 0,
      "inputs": {
        "scriptType": "inlineScript",
        "inlineScript": "\"Production script2\""
      },
      "task": {
        "id": "e213ff0f-5d5c-4791-802d-52ea3e7be1f1",
        "versionSpec": "1.*",
        "definitionType": "task"
      }
    }
  ],
  "runsOn": [
    "Agent",
    "DeploymentGroup"
  ],
  "revision": 1,
  "createdBy": {
    "id": "4adb1680-0eac-6149-b5ee-fc8b4f6ca227",
    "displayName": "Chuck Reinhart",
    "uniqueName": "fabfiber@outlook.com"
  },
  "createdOn": "2017-08-24T09:53:15.003Z",
  "modifiedBy": {
    "id": "4adb1680-0eac-6149-b5ee-fc8b4f6ca227",
    "displayName": "Chuck Reinhart",
    "uniqueName": "fabfiber@outlook.com"
  },
  "modifiedOn": "2017-08-24T09:53:15.003Z",
  "id": "544d6e0b-a3d1-41ed-a8d6-f73c55a5eab8",
  "name": "My PowerShell TG",
  "version": {
    "major": 1,
    "minor": 0,
    "patch": 0,
    "isTest": false
  },
  "category": "Deploy",
  "definitionType": "metaTask",
  "instanceNameFormat": "Task group: TG"
}

Definitions

Name Description
AuthorizationHeader
DataSourceBinding
Demand
IdentityRef
JObject
JToken
ReferenceLinks

The class to represent a collection of REST reference links.

TaskDefinitionReference
TaskExecution
TaskGroup
TaskGroupCreateParameter
TaskGroupDefinition
TaskGroupStep

Represents tasks in the task group.

TaskInputDefinition
TaskInputValidation
TaskOutputVariable
TaskReference
TaskSourceDefinition
TaskVersion

AuthorizationHeader

Name Type Description
name

string

Gets or sets the name of authorization header.

value

string

Gets or sets the value of authorization header.

DataSourceBinding

Name Type Description
callbackContextTemplate

string

Pagination format supported by this data source(ContinuationToken/SkipTop).

callbackRequiredTemplate

string

Subsequent calls needed?

dataSourceName

string

Gets or sets the name of the data source.

endpointId

string

Gets or sets the endpoint Id.

endpointUrl

string

Gets or sets the url of the service endpoint.

headers

AuthorizationHeader[]

Gets or sets the authorization headers.

initialContextTemplate

string

Defines the initial value of the query params

parameters

object

Gets or sets the parameters for the data source.

resultSelector

string

Gets or sets the result selector.

resultTemplate

string

Gets or sets the result template.

target

string

Gets or sets the target of the data source.

Demand

Name Type Description
name

string

value

string

IdentityRef

Name Type Description
_links

ReferenceLinks

This field contains zero or more interesting links about the graph subject. These links may be invoked to obtain additional relationships or more detailed information about this graph subject.

descriptor

string

The descriptor is the primary way to reference the graph subject while the system is running. This field will uniquely identify the same graph subject across both Accounts and Organizations.

directoryAlias

string

displayName

string

This is the non-unique display name of the graph subject. To change this field, you must alter its value in the source provider.

id

string

imageUrl

string

inactive

boolean

isAadIdentity

boolean

isContainer

boolean

isDeletedInOrigin

boolean

profileUrl

string

uniqueName

string

url

string

This url is the full route to the source resource of this graph subject.

JObject

Name Type Description
item

JToken

type

string

JToken

Name Type Description
first

JToken

hasValues

boolean

item

JToken

last

JToken

next

JToken

parent

string

path

string

previous

JToken

root

JToken

type

string

The class to represent a collection of REST reference links.

Name Type Description
links

object

The readonly view of the links. Because Reference links are readonly, we only want to expose them as read only.

TaskDefinitionReference

Name Type Description
definitionType

string

Gets or sets the definition type. Values can be 'task' or 'metaTask'.

id

string

Gets or sets the unique identifier of task.

versionSpec

string

Gets or sets the version specification of task.

TaskExecution

Name Type Description
execTask

TaskReference

The utility task to run. Specifying this means that this task definition is simply a meta task to call another task. This is useful for tasks that call utility tasks like powershell and commandline

platformInstructions

object

If a task is going to run code, then this provides the type/script etc... information by platform. For example, it might look like. net45: { typeName: "Microsoft.TeamFoundation.Automation.Tasks.PowerShellTask", assemblyName: "Microsoft.TeamFoundation.Automation.Tasks.PowerShell.dll" } net20: { typeName: "Microsoft.TeamFoundation.Automation.Tasks.PowerShellTask", assemblyName: "Microsoft.TeamFoundation.Automation.Tasks.PowerShell.dll" } java: { jar: "powershelltask.tasks.automation.teamfoundation.microsoft.com", } node: { script: "powershellhost.js", }

TaskGroup

Name Type Description
agentExecution

TaskExecution

author

string

category

string

comment

string

Gets or sets comment.

contentsUploaded

boolean

contributionIdentifier

string

contributionVersion

string

createdBy

IdentityRef

Gets or sets the identity who created.

createdOn

string

Gets or sets date on which it got created.

dataSourceBindings

DataSourceBinding[]

definitionType

string

deleted

boolean

Gets or sets as 'true' to indicate as deleted, 'false' otherwise.

demands

Demand[]

deprecated

boolean

description

string

disabled

boolean

execution

<string,  JObject>

friendlyName

string

groups

TaskGroupDefinition[]

helpMarkDown

string

hostType

string

iconUrl

string

id

string

inputs

TaskInputDefinition[]

instanceNameFormat

string

minimumAgentVersion

string

modifiedBy

IdentityRef

Gets or sets the identity who modified.

modifiedOn

string

Gets or sets date on which it got modified.

name

string

outputVariables

TaskOutputVariable[]

owner

string

Gets or sets the owner.

packageLocation

string

packageType

string

parentDefinitionId

string

Gets or sets parent task group Id. This is used while creating a draft task group.

postJobExecution

<string,  JObject>

preJobExecution

<string,  JObject>

preview

boolean

releaseNotes

string

revision

integer

Gets or sets revision.

runsOn

string[]

satisfies

string[]

serverOwned

boolean

showEnvironmentVariables

boolean

sourceDefinitions

TaskSourceDefinition[]

sourceLocation

string

tasks

TaskGroupStep[]

Gets or sets the tasks.

version

TaskVersion

visibility

string[]

TaskGroupCreateParameter

Name Type Description
author

string

Sets author name of the task group.

category

string

Sets category of the task group.

description

string

Sets description of the task group.

friendlyName

string

Sets friendly name of the task group.

iconUrl

string

Sets url icon of the task group.

inputs

TaskInputDefinition[]

Sets input for the task group.

instanceNameFormat

string

Sets display name of the task group.

name

string

Sets name of the task group.

parentDefinitionId

string

Sets parent task group Id. This is used while creating a draft task group.

runsOn

string[]

Sets RunsOn of the task group. Value can be 'Agent', 'Server' or 'DeploymentGroup'.

tasks

TaskGroupStep[]

Sets tasks for the task group.

version

TaskVersion

Sets version of the task group.

TaskGroupDefinition

Name Type Description
displayName

string

isExpanded

boolean

name

string

tags

string[]

visibleRule

string

TaskGroupStep

Represents tasks in the task group.

Name Type Description
alwaysRun

boolean

Gets or sets as 'true' to run the task always, 'false' otherwise.

condition

string

Gets or sets condition for the task.

continueOnError

boolean

Gets or sets as 'true' to continue on error, 'false' otherwise.

displayName

string

Gets or sets the display name.

enabled

boolean

Gets or sets as task is enabled or not.

environment

object

Gets dictionary of environment variables.

inputs

object

Gets or sets dictionary of inputs.

task

TaskDefinitionReference

Gets or sets the reference of the task.

timeoutInMinutes

integer

Gets or sets the maximum time, in minutes, that a task is allowed to execute on agent before being cancelled by server. A zero value indicates an infinite timeout.

TaskInputDefinition

Name Type Description
aliases

string[]

defaultValue

string

groupName

string

helpMarkDown

string

label

string

name

string

options

object

properties

object

required

boolean

type

string

validation

TaskInputValidation

visibleRule

string

TaskInputValidation

Name Type Description
expression

string

Conditional expression

message

string

Message explaining how user can correct if validation fails

TaskOutputVariable

Name Type Description
description

string

name

string

TaskReference

Name Type Description
id

string

inputs

object

name

string

version

string

TaskSourceDefinition

Name Type Description
authKey

string

endpoint

string

keySelector

string

selector

string

target

string

TaskVersion

Name Type Description
isTest

boolean

major

integer

minor

integer

patch

integer