Skip to content

The value of -ProjectName erroneously fails validation if the collection/account contains over 100 projects #567

@sevaa

Description

@sevaa

Steps to reproduce

Create 101 projects in a collection. Remember which one was the last one created.

powershell -Command Add-VSTeamVariableGroup -ProjectName TheLastProject -Name Temp -Variables @{a="a"} -Type Vsts

The exact nature of the command doesn't matter, all commands with -ProjectName are affected.

This has to do with the way project list validation works - it calls Get-VSTeamProject, and that one has an implicit limit of 100 records. Can be overridden with the -Top parameter, but the cache logic doesn't do that.

There is a workaround: set the env variable TEAM_PROJECTCOUNT to a high number.

Expected behavior

I expected that the command would not error out. As long as it does, I'd expect an error message that points at the root cause.

Actual behavior?

I had the following actual outcome: error,

Add-VSTeamVariableGroup : Cannot validate argument on parameter 'ProjectName'. 'TheLastProject' is invalid

On Which OS have you tried it?

Windows

What was your server version?

other (specify)

Other server version

Azure DevOps Services 2022

Log output of used API

Billing                     : 5.1-preview.1
Build                       : 5.1
Core                        : 5.1
DistributedTask             : 6.0-preview
DistributedTaskReleased     : 5.1
ExtensionsManagement        : 6.0-preview
Git                         : 5.1
Graph                       : 6.0-preview
HierarchyQuery              : 5.1-preview
MemberEntitlementManagement : 6.0-preview
Packaging                   : 6.0-preview
Pipelines                   : 5.1-preview
Policy                      : 5.1
Processes                   : 6.0-preview
Release                     : 5.1
ServiceEndpoints            : 5.0-preview
TaskGroups                  : 6.0-preview
Tfvc                        : 5.1
VariableGroups              : 5.1-preview.1
Version                     : AzD
Wiki                        : 6.0
WorkItemTracking            : 6.0-preview.1

Log output of $PSVersionTable

Name                           Value
----                           -----
PSVersion                      5.1.19041.4291
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.19041.4291
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugwhen a bug has been identified or filed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions