Add-VSTeamBuild
SYNOPSIS
Queues a new build.
SYNTAX
ByName (Default)
Add-VSTeamBuild [-SourceBranch <String>] [-BuildParameters <Hashtable>] [-TemplateParameters <Hashtable>]
-ProjectName <String> [-QueueName <String>] [-BuildDefinitionName <String>] [<CommonParameters>]
ByID
Add-VSTeamBuild [-BuildDefinitionId <Int32>] [-SourceBranch <String>] [-BuildParameters <Hashtable>]
[-TemplateParameters <Hashtable>] -ProjectName <String> [-QueueName <String>] [-BuildDefinitionName <String>]
[<CommonParameters>]
DESCRIPTION
Add-VSTeamBuild will queue a new build.
You can override the queue in the build definition by using the QueueName parameter. You can override the default source branch by using the SourceBranch parameter. You can also set specific build parameters by using the BuildParameters parameter.
To have the BuildDefinition and QueueNames tab complete you must set a default project by calling Set-VSTeamDefaultProject before you call Add-VSTeamBuild.
EXAMPLES
Example 1
Set-VSTeamDefaultProject Demo
Add-VSTeamBuild -BuildDefinition Demo-CI
Build Definition Build Number Status Result
---
id: Add-VSTeamBuild
title: Add-VSTeamBuild
hide_title: true
hide_table_of_contents: false
custom_edit_url: https://github.com/MethodsAndPractices/vsteam/edit/trunk/.docs/Add-VSTeamBuild.md
description: ''
keywords:
- vsteam
- cmdlet
- azure devops
------
id: Add-VSTeamBuild
title: Add-VSTeamBuild
hide_title: true
hide_table_of_contents: false
custom_edit_url: https://github.com/MethodsAndPractices/vsteam/edit/trunk/.docs/Add-VSTeamBuild.md
description: ''
keywords:
- vsteam
- cmdlet
- azure devops
------
id: Add-VSTeamBuild
title: Add-VSTeamBuild
hide_title: true
hide_table_of_contents: false
custom_edit_url: https://github.com/MethodsAndPractices/vsteam/edit/trunk/.docs/Add-VSTeamBuild.md
description: ''
keywords:
- vsteam
- cmdlet
- azure devops
------
id: Add-VSTeamBuild
title: Add-VSTeamBuild
hide_title: true
hide_table_of_contents: false
custom_edit_url: https://github.com/MethodsAndPractices/vsteam/edit/trunk/.docs/Add-VSTeamBuild.md
description: ''
keywords:
- vsteam
- cmdlet
- azure devops
------
id: Add-VSTeamBuild
title: Add-VSTeamBuild
hide_title: true
hide_table_of_contents: false
custom_edit_url: https://github.com/MethodsAndPractices/vsteam/edit/trunk/.docs/Add-VSTeamBuild.md
description: ''
keywords:
- vsteam
- cmdlet
- azure devops
------
id: Add-VSTeamBuild
title: Add-VSTeamBuild
hide_title: true
hide_table_of_contents: false
custom_edit_url: https://github.com/MethodsAndPractices/vsteam/edit/trunk/.docs/Add-VSTeamBuild.md
description: ''
keywords:
- vsteam
- cmdlet
- azure devops
------
id: Add-VSTeamBuild
title: Add-VSTeamBuild
hide_title: true
hide_table_of_contents: false
custom_edit_url: https://github.com/MethodsAndPractices/vsteam/edit/trunk/.docs/Add-VSTeamBuild.md
description: ''
keywords:
- vsteam
- cmdlet
- azure devops
------
id: Add-VSTeamBuild
title: Add-VSTeamBuild
hide_title: true
hide_table_of_contents: false
custom_edit_url: https://github.com/MethodsAndPractices/vsteam/edit/trunk/.docs/Add-VSTeamBuild.md
description: ''
keywords:
- vsteam
- cmdlet
- azure devops
------
id: Add-VSTeamBuild
title: Add-VSTeamBuild
hide_title: true
hide_table_of_contents: false
custom_edit_url: https://github.com/MethodsAndPractices/vsteam/edit/trunk/.docs/Add-VSTeamBuild.md
description: ''
keywords:
- vsteam
- cmdlet
- azure devops
---- ---
id: Add-VSTeamBuild
title: Add-VSTeamBuild
hide_title: true
hide_table_of_contents: false
custom_edit_url: https://github.com/MethodsAndPractices/vsteam/edit/trunk/.docs/Add-VSTeamBuild.md
description: ''
keywords:
- vsteam
- cmdlet
- azure devops
------
id: Add-VSTeamBuild
title: Add-VSTeamBuild
hide_title: true
hide_table_of_contents: false
custom_edit_url: https://github.com/MethodsAndPractices/vsteam/edit/trunk/.docs/Add-VSTeamBuild.md
description: ''
keywords:
- vsteam
- cmdlet
- azure devops
--- ---
id: Add-VSTeamBuild
title: Add-VSTeamBuild
hide_title: true
hide_table_of_contents: false
custom_edit_url: https://github.com/MethodsAndPractices/vsteam/edit/trunk/.docs/Add-VSTeamBuild.md
description: ''
keywords:
- vsteam
- cmdlet
- azure devops
--- ---
id: Add-VSTeamBuild
title: Add-VSTeamBuild
hide_title: true
hide_table_of_contents: false
custom_edit_url: https://github.com/MethodsAndPractices/vsteam/edit/trunk/.docs/Add-VSTeamBuild.md
description: ''
keywords:
- vsteam
- cmdlet
- azure devops
---
Demo-CI Demo-CI-45 notStarted
This example queues the build for the 'develop' branch, overriding the default branch in the build definition.
Example 3
Set-VSTeamDefaultProject Demo
Add-VSTeamBuild -BuildDefinition Demo-CI -BuildParameters @{msg="hello world!"; 'system.debug'='true'}
Build Definition Build Number Status Result
---
id: Add-VSTeamBuild
title: Add-VSTeamBuild
hide_title: true
hide_table_of_contents: false
custom_edit_url: https://github.com/MethodsAndPractices/vsteam/edit/trunk/.docs/Add-VSTeamBuild.md
description: ''
keywords:
- vsteam
- cmdlet
- azure devops
------
id: Add-VSTeamBuild
title: Add-VSTeamBuild
hide_title: true
hide_table_of_contents: false
custom_edit_url: https://github.com/MethodsAndPractices/vsteam/edit/trunk/.docs/Add-VSTeamBuild.md
description: ''
keywords:
- vsteam
- cmdlet
- azure devops
------
id: Add-VSTeamBuild
title: Add-VSTeamBuild
hide_title: true
hide_table_of_contents: false
custom_edit_url: https://github.com/MethodsAndPractices/vsteam/edit/trunk/.docs/Add-VSTeamBuild.md
description: ''
keywords:
- vsteam
- cmdlet
- azure devops
------
id: Add-VSTeamBuild
title: Add-VSTeamBuild
hide_title: true
hide_table_of_contents: false
custom_edit_url: https://github.com/MethodsAndPractices/vsteam/edit/trunk/.docs/Add-VSTeamBuild.md
description: ''
keywords:
- vsteam
- cmdlet
- azure devops
------
id: Add-VSTeamBuild
title: Add-VSTeamBuild
hide_title: true
hide_table_of_contents: false
custom_edit_url: https://github.com/MethodsAndPractices/vsteam/edit/trunk/.docs/Add-VSTeamBuild.md
description: ''
keywords:
- vsteam
- cmdlet
- azure devops
------
id: Add-VSTeamBuild
title: Add-VSTeamBuild
hide_title: true
hide_table_of_contents: false
custom_edit_url: https://github.com/MethodsAndPractices/vsteam/edit/trunk/.docs/Add-VSTeamBuild.md
description: ''
keywords:
- vsteam
- cmdlet
- azure devops
------
Demo-CI Demo-CI-45 notStarted
This example queues the build and sets the system.debug variable to true and msg to 'hello world!'.
PARAMETERS
-BuildDefinitionName
The name of the build definition to use to queue to build.
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-QueueName
The name of the queue to use for this build.
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-BuildDefinitionId
The Id of the build definition to use to queue to build.
Type: Int32
Parameter Sets: ByID
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False
-SourceBranch
Which source branch to use for this build. Overrides default branch in build definition.
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-TemplateParameters
Allows the user to pass in dynamic values to the build pipeline when queuing a new build, potentially influencing how the build runs based on the values of these parameters.
Type: Hashtable
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-BuildParameters
A hashtable with build parameters.
Type: Hashtable
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-ProjectName
Specifies the team project for which this function operates.
You can tab complete from a list of available projects.
You can use Set-VSTeamDefaultProject to set a default project so you do not have to pass the ProjectName with each call.
Type: String
Parameter Sets: (All)
Aliases:
Required: True
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False
CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.
INPUTS
System.String
ProjectName
BuildDefinitionName
QueueName
SourceBranch
System.Int32
BuildDefinitionId
System.Collections.Hashtable
Build Parameters
OUTPUTS
vsteam_lib.Build
NOTES
BuildDefinition and QueueName are dynamic parameters and use the default project value to query their validate set.
If you do not set the default project by called Set-VSTeamDefaultProject you must pass in -ProjectName or you will have to type in the names.
Prerequisites:
Set the account and version that all calls will use with Set-VSTeamAccount. Default version sets to API version 3.0 (TFS2017) if not manually set.
tips:
- check called version of the API with Get-VSTeamAPIVersion or Get-VSTeamInfo
- use Set-VSTeamDefaultProject to set default project for every call
- use Set-VSTeamDefaultAPITimeout to change the default timeout of 60 seconds for all calls.
- use Profiles to load an account and the correct version