Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get-VSTeamVariableGroup by name throws error 404 with TFS 2020 u1.1 #442

Closed
2 of 7 tasks
sevaa opened this issue Jan 28, 2022 · 1 comment · Fixed by #523
Closed
2 of 7 tasks

Get-VSTeamVariableGroup by name throws error 404 with TFS 2020 u1.1 #442

sevaa opened this issue Jan 28, 2022 · 1 comment · Fixed by #523
Labels
bug when a bug has been identified or filed

Comments

@sevaa
Copy link
Contributor

sevaa commented Jan 28, 2022

Steps to reproduce

Set-VSTeamAccount "http://tfs.acme.com:8080/tfs/MyCollection/" -UseWindowsAuthentication
Get-VSTeamVariableGroup -ProjectName MyProject -Name MyGroup

Expected behavior

A group record

Actual behavior

Error message with a large HTML along the lines of "error 404"

Retrieval by ID works.

If you set the project by Set-VSTeamDefaultProject, same result.

Environment data

OS

  • macOS
  • Windows
  • Linux

Server

  • TFS 2017
  • TFS 2018
  • Azure DevOps Server
  • Azure DevOps Service
Billing                     :
Build                       : 3.0
Core                        : 3.0
DistributedTask             : 3.0-preview
DistributedTaskReleased     :
ExtensionsManagement        : 3.0-preview
Git                         : 3.0
Graph                       :
HierarchyQuery              :
MemberEntitlementManagement :
Packaging                   : 3.0-preview
Pipelines                   :
Policy                      : 3.0
Processes                   :
Release                     : 3.0-preview
ServiceEndpoints            : 3.0-preview
TaskGroups                  : 3.0-preview
Tfvc                        : 3.0
VariableGroups              :
Version                     : TFS2017
Name                           Value
----                           -----
PSVersion                      5.1.18362.1801
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.18362.1801
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
@SebastianSchuetze SebastianSchuetze added the bug when a bug has been identified or filed label Feb 8, 2022
@sevaa
Copy link
Contributor Author

sevaa commented Nov 8, 2022

The immediate cause of my issue is that _getApiVersion VariableGroups returns a blank string for my TFS; as a result, the URL for the variable getting misses the api-version parmeter and goes "https://tfs.niaid.nih.gov/tfs/Admin//AMBIS/_apis/distributedtask/variablegroups&groupName=Configuration".

The real bug is that the URL generation logic in _buildRequestURI produces a malformed URL if a blank api-version and a nonblank query string object is passed.

Yet another bug is that _appendQueryString unconditionally adds a & separator, even if the query string was originally empty. Normally it would have the api-version, but if the api-version is blank, _appendQueryString can't be used as is.


Looks like the root cause is that the Set-VSTeamAccount is not resolving the version of my on prem TFS instance and is not feeding the right set of api-version values. If the first line goes instead

Set-VSTeamAccount "http://tfs.acme.com:8080/tfs/MyCollection/" -UseWindowsAuthentication -Version AzD2019

That resolves the issue. Still, not cool.


On a side note, the notion that on-prem TFS is presumed to be TFS2017 - see _getVSTeamAPIVersion - is also rather questionable. That's a five year old version, soon to be unsupported. Maybe the module should try and interrogate the instance? That's a design decision above my pay grade, though.

sevaa pushed a commit to sevaa/vsteam that referenced this issue Nov 8, 2022
SebastianSchuetze added a commit that referenced this issue May 20, 2023
Refactor to get rid of crude and incorrect _appendQueryString. Query string parameter values that can potentially be strings should be URLEncoded. Also, _appendQueryString was assuming that the URL already had a query string and produced invalid URLs if the API version was blank.

Fixes #442, #517
---------

Co-authored-by: Seva Alekseyev <sevaa@nih.gov>
Co-authored-by: Sebastian Schütze <sebastian.schuetze@razorspoint.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug when a bug has been identified or filed
Projects
None yet
2 participants