Skip to main content

Add-VSTeamRelease

SYNOPSIS

Queues a new release.

SYNTAX

ById (Default)

Add-VSTeamRelease -DefinitionId <Int32> [-Description <String>] -ArtifactAlias <String> [-Name <String>]
-BuildId <String> [-SourceBranch <String>] [-Force] -ProjectName <String> [-DefinitionName <String>] [-WhatIf]
[-Confirm] [<CommonParameters>]

ByName

Add-VSTeamRelease [-Description <String>] [-Name <String>] -BuildNumber <String> [-SourceBranch <String>]
[-Force] -ProjectName <String> [-DefinitionName <String>] [-WhatIf] [-Confirm] [<CommonParameters>]

DESCRIPTION

Add-VSTeamRelease will queue a new release.

The environments will deploy according to how the release definition is configured in the Triggers tab.

You must call Set-VSTeamAccount before calling this function.

EXAMPLES

Example 1

Get-VSTeamBuild | ft id,name

id name
-- ---
id: Add-VSTeamRelease
title: Add-VSTeamRelease
hide_title: true
hide_table_of_contents: false
custom_edit_url: https://github.com/MethodsAndPractices/vsteam/edit/trunk/.docs/Add-VSTeamRelease.md
description: ''
keywords:
- vsteam
- cmdlet
- azure devops
---- -----
1 Demo-CD Demo-CI

Add-VSTeamRelease -DefinitionId 1 -Description Test -ArtifactAlias Demo-CI -BuildId 44

This example shows how to find the Build ID, Artifact Alias, and Release definition ID required to start a release. If you call Set-VSTeamDefaultProject you can use Example 2 which is much easier.

Example 2

Add-VSTeamRelease -DefinitionName Demo-CD -Description Test -BuildNumber Demo-CI-44

This command starts a new release using the Demo-CD release definition and the build with build number Demo-CI-44.

You must set a default project to tab complete DefinitionName and BuildNumber.

PARAMETERS

-DefinitionId

The id of the release definition to use.

Type: Int32
Parameter Sets: ById
Aliases:

Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Description

The description to use on the release.

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-ArtifactAlias

The alias of the artifact to use with this release.

Type: String
Parameter Sets: ById
Aliases:

Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Name

The name of this release.

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-BuildId

The id of the build to use with this release.

Type: String
Parameter Sets: ById
Aliases:

Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-DefinitionName

The name of the release definition to use.

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-SourceBranch

The branch of the artifact

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-BuildNumber

The number of the build to use.

Type: String
Parameter Sets: ByName
Aliases:

Required: True
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

-Force

Forces the function without confirmation.

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

-WhatIf

Shows what would happen if the function runs. The function is not run.

Type: SwitchParameter
Parameter Sets: (All)
Aliases: wi

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

-Confirm

Prompts you for confirmation before running the function.

Type: SwitchParameter
Parameter Sets: (All)
Aliases: cf

Required: False
Position: Named
Default value: False
Accept pipeline input: False
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

OUTPUTS

NOTES

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