vsteam icon indicating copy to clipboard operation
vsteam copied to clipboard

"This account does not support packages" with AzD2019

Open japj opened this issue 5 years ago • 7 comments

Steps to reproduce

Connect to an Azure DevOps 2019 server with -Version AzD2019 and run:

Get-VSTeamFeed

Expected behavior

show list of package feeds

Actual behavior

This account does not support packages.
At C:\Program Files\WindowsPowerShell\Modules\VSTeam\6.4.3\vsteam.functions.ps1:197 char:7
+       throw 'This account does not support packages.'
+       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : OperationStopped: (This account does not support packages.:String) [], RuntimeException
    + FullyQualifiedErrorId : This account does not support packages.

Environment data

OS

  • [x] Windows

Server

  • [x] Azure DevOps Server
> Get-VSTeamAPIVersion

> $PSVersionTable
Name                           Value
----                           -----
Release                        5.0
Version                        AzD2019
MemberEntitlementManagement
TaskGroups                     3.2-preview.1
DistributedTask                5.0
Core                           5.0
Packaging
ServiceFabricEndpoint          5.0
VariableGroups                 5.0
Build                          5.0
Git                            5.0
ExtensionsManagement           5.0
Graph
Tfvc                           5.0

japj avatar Jan 28 '20 07:01 japj

it looks like [VSTeamVersions]::Packaging = '5.0-preview' at https://github.com/DarqueWarrior/vsteam/blob/master/Source/Public/Set-VSTeamAPIVersion.ps1#L73 might solve this issue

japj avatar Jan 28 '20 07:01 japj

@japj would you be able to create a PR for this. Could you also then add a unit test, which is testing this call for AzD2019?

SebastianSchuetze avatar Feb 11 '20 05:02 SebastianSchuetze

@SebastianSchuetze unfortunately I don't have any experience/knowledge with generating the right (and clean) json samplefiles for the unit tests. Is there any documentation/scripts on how to generate those correctly?

japj avatar Feb 11 '20 07:02 japj

Which JSON do you exactly mean? The one that is returned from the API?

SebastianSchuetze avatar Feb 11 '20 07:02 SebastianSchuetze

@SebastianSchuetze yes, the JSON files that are stored in the vsteam/unit/test/sampleFiles/ (and are used by the unit tests)

japj avatar Sep 17 '20 15:09 japj

@japj they are basically just files returned from the API when making calls (GET, POST etc.). So you can make a call and just save the JSON. Most of the time sending JSON with a request is not happening so often. Maybe you just want to make sure, that you replace sensitive info with syntactical correct fakes.

Does this help you?

SebastianSchuetze avatar Sep 17 '20 17:09 SebastianSchuetze

If you want to see the raw JSON returned by a call you can do what I do to generate the sample files for unit test.

  1. Call the desired function with -Verbose. This will show you the URL used to call the API.
Get-VSTeamProject -Verbose
VERBOSE: Team Module/7.0.0 (Windows) PowerShell/7.0.3
VERBOSE: GET https://dev.azure.com/BlackShirt/_apis/projects?api-version=5.1&stateFilter=WellFormed&$top=100 with 0-byte payload
VERBOSE: received 573-byte response of content type application/json
VERBOSE: Content encoding: utf-8
VERBOSE: return type: PSCustomObject
VERBOSE: @{count=2; value=System.Object[]}

Name          Description
----          -----------
Voting-App    Vote App
PeopleTracker
  1. Copy the URL and use the Invoke-VSTeamRequest function to call it.
Invoke-VSTeamRequest -Url 'https://dev.azure.com/BlackShirt/_apis/projects?api-version=5.1&stateFilter=WellFormed&$top=100' -JSON

{
  "count": 2,
  "value": [
    {
      "id": "00000000-0000-0000-0000-000000000000",
      "name": "Voting-App",
      "description": "Vote App",
      "url": "https://dev.azure.com/BlackShirt/_apis/projects/f5563894-c8da-49cf-bf5c-7caeaeed1af7",
      "state": "wellFormed",
      "revision": 159,
      "visibility": "private",
      "lastUpdateTime": "2020-05-19T00:02:23.517Z"
    },
    {
      "id": "00000000-0000-0000-0000-000000000000",
      "name": "PeopleTracker",
      "url": "https://dev.azure.com/BlackShirt/_apis/projects/15af52f7-47f1-40a7-817a-7661062cea76",
      "state": "wellFormed",
      "revision": 150,
      "visibility": "private",
      "lastUpdateTime": "2019-09-25T20:47:14.247Z"
    }
  ]
}

DarqueWarrior avatar Sep 17 '20 22:09 DarqueWarrior