Skip to main content

Add-VSTeamBuildPermission

SYNOPSIS​

Add Permissions to builds and multi staging pipelines

SYNTAX​

ByProjectAndUser (Default)​

Add-VSTeamBuildPermission -ProjectID <String> [-BuildID <String>] -User <Object> [-Allow <BuildPermissions>]
[-Deny <BuildPermissions>] [-OverwriteMask] [<CommonParameters>]

ByProjectAndDescriptor​

Add-VSTeamBuildPermission -ProjectID <String> [-BuildID <String>] -Descriptor <String>
[-Allow <BuildPermissions>] [-Deny <BuildPermissions>] [-OverwriteMask] [<CommonParameters>]

ByProjectAndGroup​

Add-VSTeamBuildPermission -ProjectID <String> [-BuildID <String>] -Group <Object> [-Allow <BuildPermissions>]
[-Deny <BuildPermissions>] [-OverwriteMask] [<CommonParameters>]

DESCRIPTION​

Add Permissions to builds and multi staging pipelines

EXAMPLES​

Example 1​

$project = Get-VSTeamProject -Name MyProject
$user = Get-VSTeamUser -Descriptor "Microsoft.IdentityModel.Claims.ClaimsIdentity;788df857-dcd8-444d-885e-bff359bc1982\\test@testuser.com"
Add-VSTeamBuildPermission -Project $project -User $user -Allow DestroyBuilds, DeleteBuildDefinition, AdministerBuildPermissions -Deny StopBuilds, QueueBuilds, EditBuildDefinition

Adds the user 'test@testuser.com' with the given descriptor to the build pipelines on project level. Permits the user to destroy builds, delete build definitions and administer them. Also denies to stop or queue builds as well as editing build definitions.

Example 2​

$project = Get-VSTeamProject -Name MyProject
$user = Get-VSTeamUser -Descriptor "Microsoft.IdentityModel.Claims.ClaimsIdentity;788df857-dcd8-444d-885e-bff359bc1982\\test@testuser.com"
Add-VSTeamBuildPermission -Project $project -User $user
Warning: Permission masks for Allow and Deny do not inlude any permission. No Permission will change!

Tries to the user 'test@testuser.com' with the given descriptor to the build pipelines on project level. No permissions (allow and deny) are given, it is possible but a warning is thrown.

Example 3​

$project = Get-VSTeamProject -Name MyProject
$user = Get-VSTeamUser -Descriptor "Microsoft.IdentityModel.Claims.ClaimsIdentity;788df857-dcd8-444d-885e-bff359bc1982\\test@testuser.com"
Add-VSTeamBuildPermission -Project $project -BuildID 5 -User $user -Allow DestroyBuilds -Deny StopBuilds

Allows the user 'test@testuser.com' to the build with ID 5 to destry builds and deny to stop builds.

PARAMETERS​

-ProjectID​

ID of the project.

Type: String
Parameter Sets: (All)
Aliases:

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

-BuildID​

The build ID of the build pipeline to permit the identity object to.

Type: String
Parameter Sets: (All)
Aliases:

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

-Descriptor​

The descriptor of the user or group to permit to

Type: String
Parameter Sets: ByProjectAndDescriptor
Aliases:

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

-User​

The user or service account to permit to. Service accounts are handled like normal users. The descriptor differs a little bit.

Type: Object
Parameter Sets: ByProjectAndUser
Aliases:

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

-Group​

The group to permit to

Type: Object
Parameter Sets: ByProjectAndGroup
Aliases:

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

-Allow​

Permissions that should be allowed. If no permissions are needed, then leave this parameter out.

Type: BuildPermissions
Parameter Sets: (All)
Aliases:

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

-Deny​

Permissions that should be denied. If no permissions are needed, then leave this parameter out.

Type: BuildPermissions
Parameter Sets: (All)
Aliases:

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

-OverwriteMask​

Switch to overwrite the mask values rather than merge them.

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

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​

System.Object​

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