Skip to main content

Get-VSTeamApproval

SYNOPSIS

Gets a list of approvals for all releases for a team project.

SYNTAX

Get-VSTeamApproval [-StatusFilter <String>] [-ReleaseId <Int32[]>] [-AssignedToFilter <String>]
-ProjectName <String> [<CommonParameters>]

DESCRIPTION

The Get-VSTeamApproval function gets the approvals for all releases for a team project.

With just a project name, this function gets all of the pending approvals for that team project.

When using with AzD "IncludeMyGroupApprovals" will be added to the request when Assigned To Filter is not empty.

When using with TFS "IncludeMyGroupApprovals" will be added to the request when Assigned To Filter, Release Id Filter are not empty and Status Filter equals Pending.

The vsteam_lib.Approval type has three custom table formats:

  • Pending: ID, Status, Release Name, Environment, Type, Approver Name, Release Definitions
  • Approved: Release Name, Environment, Is Automated, Approval Type, Approver Name, Release Definitions, Comments
  • Rejected: Release Name, Environment, Approval Type, Approver Name, Release Definition, Comments

EXAMPLES

Example 1

Get-VSTeamApproval -ProjectName Demo

This command gets a list of all pending approvals.

Example 2

Get-VSTeamApproval -ProjectName Demo -StatusFilter Approved | Format-Table -View Approved

This command gets a list of all approved approvals using a custom table format.

Example 3

Get-VSTeamApproval -ProjectName Demo -AssignedToFilter Administrator -StatusFilter Rejected | FT -View Rejected

This command gets a list of all approvals rejected by Administrator using a custom table format.

PARAMETERS

-StatusFilter

By default the function returns Pending approvals.

Using this filter you can return Approved, ReAssigned or Rejected approvals.

There is a custom table view for each status.

Type: String
Parameter Sets: (All)
Aliases:

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

-ReleaseId

Only approvals for the release ids provided will be returned.

Type: Int32[]
Parameter Sets: (All)
Aliases:

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

-AssignedToFilter

Approvals are filtered to only those assigned to this user.

Type: String
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

OUTPUTS

vsteam_lib.BuildDefinition

NOTES

You can pipe build definition IDs to this function.

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

Add-VSTeamBuildDefinition

Remove-VSTeamBuildDefinition