Giter Club home page Giter Club logo

vsteam's Introduction

VSTeam
VSTeam

PowerShell module to automate Azure DevOps
Explore the docs »

GitHub Workflow Status PowerShell Gallery PowerShell Gallery Version

GitHub GitHub GitHub

About the project | Requirements | Install | Change Log |

Contribute | Building Module | Maintainers

VSTeam Install Example

About The Project

VSTeam is a PowerShell module with commands for accessing your Azure DevOps Server and Azure DevOps Services).

The VSTeam module is also a provider allowing users to navigate their Azure DevOps Server and Azure DevOps as a file system.

To get started you can visit this blog PowerShell I would like you to meet TFS and VSTS

Requirements

  • Windows PowerShell 5.0 or newer.

The following modules are dependencies of the VSTeam module:

Install

Install this module from the PowerShell Gallery

Install-Module -Name VSTeam -Repository PSGallery -Scope CurrentUser

Change Log

Look at the Change Log file or the release notes on the GitHub releases.

Contribute

Check the Guidelines if you want to contribute.

Building Module

To run build the script Build-Module.ps1. The script has the following parameters:

  • -outputDir 'C:\outputdir': The final module is stored in a dist folder by default. You can override this folder by using the parameter
  • -buildHelp: Building help is skipped by default to speed up your inner loop. Use this flag to include building the help
  • -installDep: By default the build will not install dependencies unless this switch is used
  • -ipmo: build module will be imported into session. IF a loaded module exists, it will be overwritten with the build version.
  • -analyzeScript: run the static code analyzer for the scripts with PSScriptAnalyzer
  • -runTests: runs the unit tests
  • -testName 'tests to filter': can be used to filter the unit test parts that should be run. Wildcards can be used! See the Pester documentation for a more elaborate explanation.
  • -codeCoverage: outputs the code coverage. Output by default is NUnit

Below are some examples on how to build the module locally. It is expected that your working directory is at the root of the repository.

Builds the module, installs needed dependencies, loads the module into the session and also builds the help.

.\Build-Module.ps1 -installDep -ipmo -buildHelp
about module size In an effort to reduce the module size this repository contains two scripts `Build-Module.ps1` and `Merge-File.ps1` that merges similar files into a single file. The files in the formats folder are merged into `vsteam.format.ps1xml`. The files in the classes folder are merged into `vsteam.classes.ps1`. The functions from the Private and Public folders are merged into `vsteam.functions.ps1`. Finally all the files in the types folder are merged into `vsteam.types.ps1xml`. The order of the files being merged can be controlled by the `config.json` files in the repository.

The JSON config file must be in the following format:

{
   "types" : {
      "outputFile": "vsteam.types.ps1xml",
      "path": "./Source/types/",
      "fileType": "types",
      "files": [
         "*.ps1xml"
      ]
   },
   "functions" : {
      "outputFile": "vsteam.functions.ps1",
      "path": "./Source/",
      "fileType": "functions",
      "files": [
         "./Private/*.ps1",
         "./Public/*.ps1"
      ]
   },
   "formats": {
      "outputFile": "vsteam.format.ps1xml",
      "path": "./Source/formats/",
      "fileType": "formats",
      "files": [
         "vsteam_lib.TaskGroup.TableView.ps1xml"
      ]
   }
}

Run Tests Locally

Runs all unit tests and executes the static code analysis.

.\Build-Module.ps1 -runTests -codeCoverage -analyzeScript

Runs the tests, but executes only the unit tests that have the description "workitems" for the logically grouped unit tests. This can be used if you only want to test a portion of your unit tests.

.\Build-Module.ps1 -runTests -testName workitems

Run Tests in Docker

You can run your unit tests also locally and cross-platform in a standardized environment.

Maintainers

License

This project is licensed under the MIT License.

vsteam's People

Contributors

a11smiles avatar aneillans avatar asifma avatar brianschmitt avatar cadacious avatar codedbeard avatar danstur avatar darquewarrior avatar daveneeley avatar eosfor avatar geertvdc avatar gitmje avatar gpugnet avatar hangar18rip avatar jeffrey-opdam avatar kaiwalter avatar keesv avatar lentzms avatar markwragg avatar mblaschke avatar michael19842 avatar michelz avatar miiitch avatar mnieto avatar mydevopsdemos avatar sebastianschuetze avatar seekatar avatar sevaa avatar stefanstranger avatar woehrl01 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

vsteam's Issues

Looping endlessly on Add-AzureRMEndpoint

This is my first time trying out this module. I have on-prem TFS, so I did Add-TeamAccount -Account http://tfs:8080/tfs/EcoSys -UseWindowsAuthentication where "EcoSys" is my collection name.

Then, I did Add-AzureRMServiceEndpoint and it runs endlessly after I enter ProjectName. I canceled it and added -Verbose and I see this looping:

PS C:\PSModules> Add-AzureRMServiceEndpoint -Verbose

cmdlet Add-AzureRMServiceEndpoint at command pipeline position 1
Supply values for the following parameters:
(Type !? for Help.)
displayName: 100022-Flame_University
subscriptionId: 717dbfc1-958c-4a09-ba32-5fce93bbb8d6
subscriptionTenantId: a38ff870-9c86-43df-9e6b-6b01f206a398
ProjectName: Student
VERBOSE: POST http://tfs:8080/tfs/EcoSys/Student/_apis/distributedtask/serviceendpoints?api-version=3.0-preview.1 with -1-byte payload
VERBOSE: received 622-byte response of content type application/json; charset=utf-8; api-version=3.0-preview.1
VERBOSE: GET http://tfs:8080/tfs/EcoSys/Student/_apis/distributedtask/serviceendpoints/207565dc-ff90-41d7-bb61-52592a5f0f12?api-version=3.0-preview.1 with 0-byte payload
VERBOSE: received 622-byte response of content type application/json; charset=utf-8; api-version=3.0-preview.1
VERBOSE: GET http://tfs:8080/tfs/EcoSys/Student/_apis/distributedtask/serviceendpoints/207565dc-ff90-41d7-bb61-52592a5f0f12?api-version=3.0-preview.1 with 0-byte payload
VERBOSE: received 622-byte response of content type application/json; charset=utf-8; api-version=3.0-preview.1
VERBOSE: GET http://tfs:8080/tfs/EcoSys/Student/_apis/distributedtask/serviceendpoints/207565dc-ff90-41d7-bb61-52592a5f0f12?api-version=3.0-preview.1 with 0-byte payload
VERBOSE: received 622-byte response of content type application/json; charset=utf-8; api-version=3.0-preview.1
VERBOSE: GET http://tfs:8080/tfs/EcoSys/Student/_apis/distributedtask/serviceendpoints/207565dc-ff90-41d7-bb61-52592a5f0f12?api-version=3.0-preview.1 with 0-byte payload
VERBOSE: received 828-byte response of content type application/json; charset=utf-8; api-version=3.0-preview.1
VERBOSE: GET http://tfs:8080/tfs/EcoSys/Student/_apis/distributedtask/serviceendpoints/207565dc-ff90-41d7-bb61-52592a5f0f12?api-version=3.0-preview.1 with 0-byte payload
VERBOSE: received 828-byte response of content type application/json; charset=utf-8; api-version=3.0-preview.1
VERBOSE: GET http://tfs:8080/tfs/EcoSys/Student/_apis/distributedtask/serviceendpoints/207565dc-ff90-41d7-bb61-52592a5f0f12?api-version=3.0-preview.1 with 0-byte payload
VERBOSE: received 828-byte response of content type application/json; charset=utf-8; api-version=3.0-preview.1
VERBOSE: GET http://tfs:8080/tfs/EcoSys/Student/_apis/distributedtask/serviceendpoints/207565dc-ff90-41d7-bb61-52592a5f0f12?api-version=3.0-preview.1 with 0-byte payload
VERBOSE: received 828-byte response of content type application/json; charset=utf-8; api-version=3.0-preview.1
...

Whats does mean "Removed default project" after run "Add-TeamAccount"?

Hi there,

First of all, thank you for making this open source!

After run Add-TeamAccount command and fill the fields we get this message: Removed default project. It is not clear for me what happened, maybe the same happens to other users.

There follows the snippet:

PS C:\devops\tests\test01> Add-TeamAccount cmdlet Add-TeamAccount at command pipeline position 1 Supply values for the following parameters: (Type !? for Help.) Account: suati\adailson.queiroz SecurePersonalAccessToken: **************************************************** Removed default project

The type initializer for 'VSTeamProjectCache' threw an exception

Steps to reproduce

Get-VSTeamBuildDefinition -ProjectName "DemoName" -Type Build

Expected behavior

Name                   ID
----                   --
BD1                     4
BD2                     11
[Gate] BD1              21
BD3                     22

Actual behavior

The type initializer for 'VSTeamProjectCache' threw an exception.
At C:\Program Files\WindowsPowerShell\Modules\VSTeam\4.0.8\src\common.ps1:303 char:9
+    if($([VSTeamProjectCache]::timestamp) -ne (Get-Date).Minute) {
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : OperationStopped: (:) [], TypeInitializationException
    + FullyQualifiedErrorId : System.TypeInitializationException

Environment data

> $VSTeamVersionTable
> $PSVersionTable

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

Discussion

@DarqueWarrior Could you please explain this exception and how can I avoid it in future.
Also can I get json object on the output if it possible of course.

In my case I thought about this but obviously it will not work

Get-VSTeamBuildDefinition -ProjectName "Demo" -id 229 |  ConvertTo-Json | Out-File build.json
Add-VSTeamBuildDefinition -ProjectName Demo2 -InFile build.json

Also many thanks for your work. The module "VSTeam" is awesome and very long-awaited.

Need Remove-AzureRMServiceEndpoint

The function Remove-AzureRMServiceEndpoint would come in handy, and it's missing from the module.

Presumably, any Add-* should have a corresponding Remove-*.

Allow additional HTTP headers

Before I work on this, wanted to run it by you:

I'd like to add a -Headers parameter to Invoke-VSTeamRequest. Looks like it would be simple enough to affect.

Why?
Because I'm trying to use the following endpoint:

https://{instance-name}.vssps.visualstudio.com/_apis/Identities?searchFilter=Identifier&filterValue={some-sid}&options=None&queryMembership=None

In order to get that endpoint to work correctly it requires an Accept: application/json;api-version=1.0 header. Otherwise it returns the following error message:

Either descriptors or identityIds or searchFactor/factorValue must be specified

I have a why for all this, but I'll leave it at this for the moment.

Better names

Hey, your first issue!
Can I suggest that you use more specific names to avoid name collisions. Since PowerShell auto-imports modules now, the likelihood of a name collision is much higher. So, instead of Get-Queue, how about Get-TeamQueue.

Basically, make every command "Verb-TeamNoun".

I just got finished working on some PowerShell automation for VSTS, so I will be happy to submit some more command once the code shows up.

010_projects.Tests.ps1 do not work with AAD backed VSTS account

Steps to reproduce

  1. create an VSTS account backed by an Azure Active Directory
  2. install SonarQube from market place into VSTS account
  3. add an additional AAD user
  4. set $env:API_VERSION = "VSTS"
  5. set environment variables EMAIL ACCT PAT so that these are valid for the test
  6. execute 010_projects.Tests.ps1 from integration\test

Expected behavior

In a VSTS account with only MS Accounts invited the tests run successfully

   Context Users exercise
    [+] Get-VSTeamUser Should return all users 595ms
    [+] Get-VSTeamUser ById Should return Teams 1.4s
    [+] Remove-VSTeamUser should fail 543ms
    [+] Remove-VSTeamUser should delete the team 1.72s
    [+] Add-VSTeamUser should add a team 2.03s

Actual behavior

When executing the tests with an AAD backed VSTS account I get an error:

   Context Users exercise
    [+] Get-VSTeamUser Should return all users 1.22s
    [-] Get-VSTeamUser ById Should return Teams 528ms
      PropertyNotFoundException: The property 'Id' cannot be found on this object. Verify that the property exists.
      at <ScriptBlock>, C:\src\vsteam\integration\test\010_projects.Tests.ps1: line 252
    [+] Remove-VSTeamUser should fail 528ms
    [-] Remove-VSTeamUser should delete the team 634ms
      RuntimeException: Could not find user with an email equal to azuretest4@xyzcompany.com
      at Remove-VSTeamUser<Process>, C:\src\vsteam\src\users.psm1: line 152
      at <ScriptBlock>, C:\src\vsteam\integration\test\010_projects.Tests.ps1: line 261
    [+] Add-VSTeamUser should add a team 2.17s

Environment data

> $VSTeamVersionTable
Name                           Value
----                           -----
Git                            3.0
DistributedTask                3.0-preview
Tfvc                           3.0
Version                        TFS2017
Release                        3.0-preview
Build                          3.0
Account
Core                           3.0
DefaultProject
ModuleVersion                  3.0.2
MemberEntitlementManagement
ServiceFabricEndpoint
> $PSVersionTable
Name                           Value
----                           -----
PSVersion                      5.1.17134.165
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.17134.165
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

Security API

Awesome PowerShell cmdlets in VSTeam, @DarqueWarrior! I'm on a project focused on DevOps using an AAD backed VSTS account. I'm using VSTeam to create administration scripts, but I have to work-around some missing VSTS REST APIs using Invoke-RestMethod, specifically the VSTS Security API. Have you or other VSTeam contributors looked at incorporating Security API operations like the VSTS Set Access Control Entries REST API into VSTeam?

Invoke-VSTeamRequest always returns 401 - unauthorized

Steps to reproduce

Add-VSTeamProfile -Account "<account name>" -Name "<profile name>" -PersonalAccessToken "<PAT>"
Add-VSTeamAccount -Profile <profile name>
Invoke-VSTeamRequest -resource projecthistory -version '4.1-preview' -ProjectName "<project name>"

Expected behavior

This command will return the project history.

Actual behavior

Invoke-RestMethod : The remote server returned an error: (401) Unauthorized.
At C:\Program Files\WindowsPowerShell\Modules\VSTeam\2.1.10\src\common.ps1:522 char:4
+    Invoke-RestMethod @params
+    ~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebException
    + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand

Environment data

> $VSTeamVersionTable

Name                           Value                                                                                                                            
----                           -----                                                                                                                            
DefaultProject                                                                                                                                                  
Build                          4.0                                                                                                                              
Release                        4.1-preview                                                                                                                      
Version                        VSTS                                                                                                                             
MemberEntitlementManagement    4.1-preview                                                                                                                      
Tfvc                           4.0                                                                                                                              
DistributedTask                4.1-preview                                                                                                                      
Git                            4.0                                                                                                                              
Core                           4.0                                                                                                                              
Account                        https://<company name>.visualstudio.com                                                                                                
ModuleVersion                  2.1.10 
> $PSVersionTable
Name                           Value                                                                                                                            
----                           -----                                                                                                                            
PSVersion                      5.1.16299.251                                                                                                                    
PSEdition                      Desktop                                                                                                                          
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}                                                                                                          
BuildVersion                   10.0.16299.251                                                                                                                   
CLRVersion                     4.0.30319.42000                                                                                                                  
WSManStackVersion              3.0                                                                                                                              
PSRemotingProtocolVersion      2.3                                                                                                                              
SerializationVersion           1.1.0.1 

Add-VSTeamUser -License None is not valid

Steps to reproduce

PS C:\> $AzureDevOpsNewUserRequest = Add-VSTeamUser -Email user@contoso.com -License None
PS C:\> $AzureDevOpsNewUserRequest.operationResult.errors.value
A user cannot be assigned an Account-None license.

Expected behavior

A user of the type Stakeholder should be created

Actual behavior

Error message: "A user cannot be assigned an Account-None license."

Environment data

No output from $VSTeamVersionTable. However, the module version is 4.0.9.

$PSVersionTable:

PSVersion                      5.1.14393.2485
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.14393.2485
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

How to remove orphan endpoints?

I have a few "orphan" endpoints which were created with an older build of this module. I don't seem to be able to delete them through TFS, and there is no obvious way to do it via PowerShell.

image

Simple change to link work items to parent work items...

The Add-VSTeamWorkItem method in workitems.psm1 needs an additional parameter to link the workitem to a parent item. Otherwise the work item is orphaned.

The following code will link the new work item to a parent (if provided). All I did was add ParentId as a Parameter and wrap the $body variable in an IF block.

function Add-VSTeamWorkItem {
   [CmdletBinding()]
   param(
      [Parameter(Mandatory = $true)]
      [string]$Title,
      [Parameter(Mandatory = $false)]
      [string]$ParentId
   )

   DynamicParam {
      $dp = _buildProjectNameDynamicParam -mandatory $true

      # If they have not set the default project you can't find the
      # validateset so skip that check. However, we still need to give
      # the option to pass a WorkItemType to use.
      if ($Global:PSDefaultParameterValues["*:projectName"]) {
         $wittypes = _getWorkItemTypes -ProjectName $Global:PSDefaultParameterValues["*:projectName"]
         $arrSet = $wittypes
      }
      else {
         Write-Verbose 'Call Set-VSTeamDefaultProject for Tab Complete of WorkItemType'
         $wittypes = $null
         $arrSet = $null
      }

      $ParameterName = 'WorkItemType'
      $rp = _buildDynamicParam -ParameterName $ParameterName -arrSet $arrSet
      $dp.Add($ParameterName, $rp)

      $dp
   }

   Process {
      # Bind the parameter to a friendly variable
      $ProjectName = $PSBoundParameters["ProjectName"]

      # The type has to start with a $
      $WorkItemType = "`$$($PSBoundParameters["WorkItemType"])"

      if ($ParentId){
         #https://stackoverflow.com/questions/50518798/how-to-add-work-item-as-child-to-parent
         $parentUri = _buildRequestURI -ProjectName $ProjectName -Area 'wit' -Resource 'workitems' -id $ParentId
         $body = '[{"op": "add", "path": "/fields/System.Title", "from": null, "value": "' + $Title + '"}'
         $body += ',{"op": "add", "path": "/relations/-", '
         $body += '"value": {"rel": "System.LinkTypes.Hierarchy-Reverse", "url": "' + $parentURI + '"}}]'
      }
      else{
         $body = '[{"op": "add", "path": "/fields/System.Title", "from": null, "value": "' + $Title + '"}]'
      }

      # Call the REST API
      $resp = _callAPI -ProjectName $ProjectName -Area 'wit' -Resource 'workitems'  `
         -Version $([VSTeamVersions]::Core) -id $WorkItemType -Method Post `
         -ContentType 'application/json-patch+json' -Body $body

      _applyTypesToWorkItem -item $resp

      return $resp
   }
}

integration\test\010_projects.Tests.ps1 fails with "Get-VSTeamAgent Should return agents"

Is a special setup of the VSTS account required for integration testing - e.g. a private agent?

Steps to reproduce

from vsteam folder

Invoke-Pester -Script .\integration\test\010_projects.Tests.ps1

Expected behavior

execute all project integration tests on an empty VSTS account with no errors

Actual behavior

    Context Agent full exercise
      [-] Get-VSTeamAgent Should return agents 492ms
        Expected $null to be different from the actual value, but got the same value.
        251:          $actual | Should Not Be $null
        at Invoke-LegacyAssertion, C:\Program Files\WindowsPowerShell\Modules\Pester\4.4.0\Functions\Assertions\Should.ps1: line 188
        at <ScriptBlock>, C:\...\vsteam\integration\test\010_projects.Tests.ps1: line 251

Environment data

> $VSTeamVersionTable
Name                           Value
----                           -----
Git                            3.0
DistributedTask                3.0-preview
Tfvc                           3.0
Version                        TFS2017
Release                        3.0-preview
Build                          3.0
Account
Core                           3.0
DefaultProject
ModuleVersion                  3.0.7
MemberEntitlementManagement
ServiceFabricEndpoint
> $PSVersionTable
Name                           Value
----                           -----
PSVersion                      5.1.15063.1206
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.15063.1206
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

Support multiple artifacts in Add-VSTeamRelease function

Like in the REST API, this function of Add-VSTeamRelease should allow to create a release with multiple artifacts. Right now is hardcoded to only and always exactly ONE artifact for a release definition.

Futhermore, it also should support none artifacts (empty), since it's possible through the REST API of this function.

No support for tfvc api

Are there plans to support the tfvc api?
I am willing to help, but don't want to duplicate on going effort

Extension Managment API commandlets

This one is available in the Node API https://github.com/Microsoft/vsts-node-api/blob/master/api/ExtensionManagementApi.ts and I believe has support going back a few API versions.

The only direct use case for the existing library is that it would allow some self-healing when hitting something like https://github.com/DarqueWarrior/vsteam/blob/6404a26fa7f72845b235989ea18ffcbe8f5c4821/src/serviceendpoints.psm1#L157 where the SonarQube extension is missing, it could Install it to the server/service and install it into the collection.

My personal use case is it makes it easier not to call out to the node cli from our PowerShell scripts 😉

/cc @pabrams

Add-VSTeamAccount failes to connect to VSTS

Hello,

maybe its not a bug and i am using it wrong, but i did not manage it to authenticate to VSTS.
I get the HTTP 401 error ... do the VSTS admin need to give me the permission to use the API or what do i wrong?

Thanks
Steffen

Steps to reproduce

param (
    $Account = '[email protected]',
    $PersonalAccessToken = 'TokenGeneratedFromVSTS'
)

Import-Module VSTeam
Add-VSTeamAccount -Account $Account -PersonalAccessToken $PersonalAccessToken
Get-Project

Expected behavior

The list of my projects.

Actual behavior


Removed default project
WARNING: An error occurred: Der Remoteserver hat einen Fehler zurückgegeben: (401) Nicht autorisiert.

Environment data

> $VSTeamVersionTable

Name                           Value
----                           -----
Git                            4.0
DistributedTask                4.1-preview
Tfvc                           4.0
Version                        VSTS
Release                        4.1-preview
Build                          4.0
Account                        https://kampmann.visualstudio.com
Core                           4.0
DefaultProject
ModuleVersion                  3.0.5
MemberEntitlementManagement    4.1-preview
ServiceFabricEndpoint          4.1-preview
> $PSVersionTable

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

Add-Build should accept build definition id

VSTS build system allows creating multiple build definitions with same name in different folders. We would like to take advantage of this feature because we have different branches of same software at different clients. So, we would like to create build folders by branch name and copy paste the build definitions and just change the source branch. Add-Build cmdlet doesn't support this. It takes BuildDefnition as string and tries to find a unique build definition by passed-in name and raises error when it finds more than one build definition with same name. I think it should have the option to accept id and name or even BuildDefinition object so caller can resolve before calling Add-Build and pass whatever makes sense. Any thoughts?

Get VSTeam API version error

With the VSTeam branch vsteampsdrive I get the following error when creating a new profile with the Add-Profile function.

Add-Profile -PersonalAccessToken '[AccessTokenValue]' -Name contoso -Version VSTS -verbose

Error:
_getVSTeamAPIVersion : Cannot bind argument to parameter 'instance' because it is an empty string.
At C:\Users\stefstr\Documents\GitHub\vsteam\src\profile.psm1:177 char:52
+          Version = (_getVSTeamAPIVersion -Instance $Account -Version  ...
+                                                    ~~~~~~~~
    + CategoryInfo          : InvalidData: (:) [_getVSTeamAPIVersion], ParameterBindingValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationErrorEmptyStringNotAllowed,_getVSTeamAPIVersion

This is caused by the change in the following commit

Get-VSTeamGitRepository fails when not specifying project name

The docs say 'gets all repositories in your visual studio team services account, or a specific project'. But when running without specifying the ProjectName parameter the function fails.

To reproduce:

Add-VSTeamAccount -Account "YourAccountName" -PersonalAccessToken "YourAccessToken"
Gete-VSTeamGitRepository

I was expecting it to return all the git repositories within the VSTS account, across all projects.

It works fine when specifying a project name though. Just not lining up with docs and parameter requirements.

Error in TypeData in integration\test\010_projects.Tests

Steps to reproduce

  1. fork / clone repo
  2. change to repo folder
  3. execute integration test
Import-Module .\VSTeam.psd1 -Force;
Invoke-Pester -Script .\integration\test\010_projects.Tests.ps1;

Expected behavior

integration tests conclude successfully

Actual behavior

PSDrive tests fail

    Context PS Drive full exercise
New-PSDrive : The following error occurred while loading the extended type data file: Error in TypeData "Team.Build.Artifact": The member DefaultDisplayPropertySet is already present.
Error in TypeData "Team.Build.Artifact": The member downloadUrl is already present.
Error in TypeData "Team.Build.Artifact": The member url is already present.
Error in TypeData "Team.Build.Artifact": The member data is already present.
Error in TypeData "Team.Build.Artifact": The member type is already present.
Error in TypeData "Team.Build": The member lastChangedByUser is already present.
Error in TypeData "Team.Build": The member requestedByUser is already present.
Error in TypeData "Team.Build": The member requestedForUser is already present.
Error in TypeData "Team.Build": The member repositoryType is already present.
Error in TypeData "Team.Build": The member projectName is already present.
Error in TypeData "Team.Build": The member definitionName is already present.
Error in TypeData "Team.Build": The member queueID is already present.
Error in TypeData "Team.Build": The member queueName is already present.
Error in TypeData "Team.Build": The member name is already present.

Environment data

> $VSTeamVersionTable
> $PSVersionTable
Name                           Value
----                           -----
PSVersion                      5.1.15063.1292
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.15063.1292
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

Version in PowerShell Gallery still at 0.1.134

Is the version in the PowerShell Gallery going to be updated? It's way behind the module version in this repository, so when you install the module using Install-Module -Name Team you get a very out-of-date version.

Unable to find type [VSTeamVersions]

Steps to reproduce

  1. On a windows Server 2012 R2 machine.
  2. Install latest VSTeam powershell module.
  3. Create a new PowerShell script (ps1) file and call 'Import-Module -Name VSTeam' in the script.
  4. Execute the script in PowerShell console.

Expected behavior

The PowerShell module VSTeam should import successfully.

Actual behavior

An error is thrown, please see the log output below

VERBOSE: Loading module from path 'C:\Program Files\WindowsPowerShell\Modules\VSTeam\4.0.10\VSTeam.psd1'.
VERBOSE: Loading 'TypesToProcess' from path 'C:\Program
Files\WindowsPowerShell\Modules\VSTeam\4.0.10\types\Approvals.ps1xml'.
VERBOSE: Loading 'TypesToProcess' from path 'C:\Program
Files\WindowsPowerShell\Modules\VSTeam\4.0.10\types\builds.ps1xml'.
VERBOSE: Loading 'TypesToProcess' from path 'C:\Program
Files\WindowsPowerShell\Modules\VSTeam\4.0.10\types\cloudSubscriptions.ps1xml'.
VERBOSE: Loading 'TypesToProcess' from path 'C:\Program
Files\WindowsPowerShell\Modules\VSTeam\4.0.10\types\repositories.ps1xml'.
VERBOSE: Loading 'TypesToProcess' from path 'C:\Program
Files\WindowsPowerShell\Modules\VSTeam\4.0.10\types\policies.ps1xml'.
VERBOSE: Loading 'TypesToProcess' from path 'C:\Program
Files\WindowsPowerShell\Modules\VSTeam\4.0.10\types\releaseDefinitions.ps1xml'.
VERBOSE: Loading 'TypesToProcess' from path 'C:\Program
Files\WindowsPowerShell\Modules\VSTeam\4.0.10\types\releases.ps1xml'.
VERBOSE: Loading 'TypesToProcess' from path 'C:\Program
Files\WindowsPowerShell\Modules\VSTeam\4.0.10\types\serviceendpoints.ps1xml'.
VERBOSE: Loading 'TypesToProcess' from path 'C:\Program
Files\WindowsPowerShell\Modules\VSTeam\4.0.10\types\team.ps1xml'.
VERBOSE: Loading 'TypesToProcess' from path 'C:\Program
Files\WindowsPowerShell\Modules\VSTeam\4.0.10\types\teammembers.ps1xml'.
VERBOSE: Loading 'TypesToProcess' from path 'C:\Program
Files\WindowsPowerShell\Modules\VSTeam\4.0.10\types\teams.ps1xml'.
VERBOSE: Loading 'TypesToProcess' from path 'C:\Program
Files\WindowsPowerShell\Modules\VSTeam\4.0.10\types\tfvc.ps1xml'.
VERBOSE: Loading 'TypesToProcess' from path 'C:\Program
Files\WindowsPowerShell\Modules\VSTeam\4.0.10\types\users.ps1xml'.
VERBOSE: Loading 'TypesToProcess' from path 'C:\Program
Files\WindowsPowerShell\Modules\VSTeam\4.0.10\types\workitems.ps1xml'.
VERBOSE: Loading 'TypesToProcess' from path 'C:\Program
Files\WindowsPowerShell\Modules\VSTeam\4.0.10\types\pullrequest.ps1xml'.
VERBOSE: Loading 'FormatsToProcess' from path 'C:\Program
Files\WindowsPowerShell\Modules\VSTeam\4.0.10\formats\Approvals.format.ps1xml'.
VERBOSE: Loading 'FormatsToProcess' from path 'C:\Program
Files\WindowsPowerShell\Modules\VSTeam\4.0.10\formats\builds.format.ps1xml'.
VERBOSE: Loading 'FormatsToProcess' from path 'C:\Program
Files\WindowsPowerShell\Modules\VSTeam\4.0.10\formats\policyTypes.format.ps1xml'.
VERBOSE: Loading 'FormatsToProcess' from path 'C:\Program
Files\WindowsPowerShell\Modules\VSTeam\4.0.10\formats\profile.format.ps1xml'.
VERBOSE: Loading 'FormatsToProcess' from path 'C:\Program
Files\WindowsPowerShell\Modules\VSTeam\4.0.10\formats\serviceendpoints.format.ps1xml'.
VERBOSE: Loading 'FormatsToProcess' from path 'C:\Program
Files\WindowsPowerShell\Modules\VSTeam\4.0.10\formats\serviceendpointTypes.format.ps1xml'.
VERBOSE: Loading 'FormatsToProcess' from path 'C:\Program
Files\WindowsPowerShell\Modules\VSTeam\4.0.10\formats\team.format.ps1xml'.
VERBOSE: Loading 'FormatsToProcess' from path 'C:\Program
Files\WindowsPowerShell\Modules\VSTeam\4.0.10\formats\users.format.ps1xml'.
VERBOSE: Loading 'FormatsToProcess' from path 'C:\Program
Files\WindowsPowerShell\Modules\VSTeam\4.0.10\formats\workitemTypes.format.ps1xml'.
VERBOSE: Loading 'FormatsToProcess' from path 'C:\Program
Files\WindowsPowerShell\Modules\VSTeam\4.0.10\formats\workitems.format.ps1xml'.
VERBOSE: Loading 'FormatsToProcess' from path 'C:\Program
Files\WindowsPowerShell\Modules\VSTeam\4.0.10\formats\vsteamPSDrive.format.ps1xml'.
VERBOSE: Populating RepositorySourceLocation property for module VSTeam.
VERBOSE: Loading module from path 'C:\Program Files\WindowsPowerShell\Modules\VSTeam\4.0.10\src\teamspsdrive.ps1'.
VERBOSE: Dot-sourcing the script file 'C:\Program Files\WindowsPowerShell\Modules\VSTeam\4.0.10\src\teamspsdrive.ps1'.
VERBOSE: Loading module from path 'C:\Program Files\WindowsPowerShell\Modules\VSTeam\4.0.10\src\team.psm1'.
Unable to find type [VSTeamVersions].
At C:\Program Files\WindowsPowerShell\Modules\VSTeam\4.0.10\src\team.psm1:504 char:1
+ [VSTeamVersions]::ModuleVersion = _getModuleVersion
+ ~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (VSTeamVersions:TypeName) [], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : TypeNotFound

Import-Module : The module to process 'C:\Program Files\WindowsPowerShell\Modules\VSTeam\4.0.10\src\team.psm1', listed
in field 'NestedModules' of module manifest 'C:\Program Files\WindowsPowerShell\Modules\VSTeam\4.0.10\VSTeam.psd1' was
not processed because no valid module was found in any module directory.
At C:\ReleaseManagement\InstallScripts\WindowsUpdateMonitor.ps1:20 char:1
+ Import-Module -Name VSTeam -Verbose
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ResourceUnavailable: (VSTeam:String) [Import-Module], PSInvalidOperationException
    + FullyQualifiedErrorId : Modules_ModuleFileNotFound,Microsoft.PowerShell.Commands.ImportModuleCommand

Environment data

> $VSTeamVersionTable
> $PSVersionTable
Name                           Value
----                           -----
PSVersion                      5.1.14409.1005
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.14409.1005
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

Please note that if I use VSTeam version 3.0.x the module is imported successfully without any errors.

Add-VSTeamUser - add option for specifying licensing source (e.g. MSDN)

The Add-VSTeamUser currently (per version 4.0.9) let's us specify -License with the following valid options:
[ValidateSet('Advanced', 'EarlyAdopter', 'Express', 'None', 'Professional', 'StakeHolder')]

In the UI we can also add users with an access level called "Visual Studio Subscriber". Under the hood, this seems to specify a Licensing Source of type MSDN.

Some relevant links from the documentation:
LicensingSource
MsdnLicenseType
Access Level

It would be nice to be able to also add users with the licensing source MSDN by using Add-VSTeamUser.

[TFS 2018] Build definition imported partially

I tried to import new build definition to my TFS 2018(update 2) On Premise using the VsTeam module and i have an issue past execution (success executiuoin

Powershell command used to import build defintion to TFS

Add-VSTeamBuildDefinition -ProjectName "project-test" -InFile "bd-project-test-template.json"

This (bellow) is a fragment of json used to import build definition (phases) to TFS:

....
"process": {
    "phases": [
        {
            "steps": [
                {
                    "environment": {},
                    "enabled": true,
                    "continueOnError": false,
                    "alwaysRun": false,
                    "displayName": "Restore",
                    "timeoutInMinutes": 0,
                    "task": {
                        "id": "ffd7bc7f-a32c-4b4b-a52d-ebfdb60046bc",
                        "versionSpec": "1.*",
                        "definitionType": "task"
                    },
                    "inputs": {
                        "command": "restore",
                        "publishWebProjects": "true",
                        "projects": "$(Parameters.RestoreBuildProjects)",
                        "arguments": "--configfile nuget.config --force",
                        "zipAfterPublish": "true"
                    }
                },
                {
                    "environment": {},
                    "enabled": true,
                    "continueOnError": false,
                    "alwaysRun": false,
                    "displayName": "Build",
                    "timeoutInMinutes": 0,
                    "task": {
                        "id": "ffd7bc7f-a32c-4b4b-a52d-ebfdb60046bc",
                        "versionSpec": "1.*",
                        "definitionType": "task"
                    },
                    "inputs": {
                        "command": "build",
                        "publishWebProjects": "true",
                        "projects": "$(Parameters.RestoreBuildProjects)",
                        "arguments": "--configuration $(BuildConfiguration) --no-restore",
                        "zipAfterPublish": "true"
                    }
                },
                {
                    "environment": {},
                    "enabled": true,
                    "continueOnError": false,
                    "alwaysRun": false,
                    "displayName": "Test",
                    "timeoutInMinutes": 0,
                    "task": {
                        "id": "ffd7bc7f-a32c-4b4b-a52d-ebfdb60046bc",
                        "versionSpec": "1.*",
                        "definitionType": "task"
                    },
                    "inputs": {
                        "command": "test",
                        "publishWebProjects": "true",
                        "projects": "$(Parameters.TestProjects)",
                        "arguments": "--configuration $(BuildConfiguration)",
                        "zipAfterPublish": "true"
                    }
                }
            ],
            "name": "Phase 1",
            "refName": "Phase_1",
            "target": {
                "executionOptions": null,
                "allowScriptsAuthAccessOption": false,
                "type": 1
            },
            "jobAuthorizationScope": 0
        }
    ],
    "type": 1
},
...

Expected behavior

01_bd_project_test_excpected

Actual behavior

01_bd_project_test

Obs: I tried to use New-Guid, empty GUID, removed the GUID line, etc.

Broken on premise :(

Unfortunately #10 breaks on premise usage of the module. Need to consider a different way for identifying whether the user has entered a FQDN (i.e. local) TFS server, or means a VSTS account.
Ironically, possibly the best method would be just looking for a slash (/) as this wouldn't be in an account name, but would be guaranteed to be present in an on-premise url.

Thoughts?

Get-VSTeamBuildDefinition -Type not considered correctly

Steps to reproduce

I extended integration test

      It 'Add-VSTeamBuildDefinition should add a build definition' {
         Add-VSTeamBuildDefinition -ProjectName $newProjectName -InFile $tmpBuildDef1
         $buildDef = Get-VSTeamBuildDefinition -ProjectName $newProjectName
         $buildDef | Should Not Be $null
      }

      It 'Add-VSTeamBuildDefinition should add another build definition' {
         Add-VSTeamBuildDefinition -ProjectName $newProjectName -InFile $tmpBuildDef2
         $buildDefs = Get-VSTeamBuildDefinition -ProjectName $newProjectName
         $buildDefs.Count | Should Be 2
      }

      It 'Get-VSTeamBuildDefinition by Type "build" should return 2 build definitions' {
         $buildDefs = Get-VSTeamBuildDefinition -ProjectName $newProjectName -Type build
         $buildDefs.Count | Should Be 2
      }

      It 'Get-VSTeamBuildDefinition by Type "xaml" should return no build definitions' {
         $buildDefs = Get-VSTeamBuildDefinition -ProjectName $newProjectName -Type xaml
         $buildDefs.Count | Should Be 0
      }

to check that the correct build definitions types are returned.

Expected behavior

I expected that these tests pass

Actual behavior

      [+] Get-VSTeamBuildDefinition by Type "build" should return 2 build definitions 8.15s
      [-] Get-VSTeamBuildDefinition by Type "xaml" should return no build definitions 469ms
        Expected 0, but got 2.
        213:          $buildDefs.Count | Should Be 0
        at Invoke-LegacyAssertion, C:\Program Files\WindowsPowerShell\Modules\Pester\4.4.0\Functions\Assertions\Should.ps1: line 188
        at <ScriptBlock>, C:\Users\y1wle\src\Kai\vsteam\integration\test\010_projects.Tests.ps1: line 213

Discussion

@DarqueWarrior the API call does not consider the type always returns 2 build definitions:

         $resp = _callAPI -ProjectName $ProjectName -Area build -Resource definitions -Version $([VSTeamVersions]::Build) `
            -QueryString @{type = $type; name = $filter; includeAllProperties = $true}

Can you confirm this?
Is that the intended behavior of the API? Are buildDefinition.type "build" == "xaml"?

[Feature] Add Support for Variable Groups

As a continuous delivery and automation engineer
I would like to be able to list, add, edit and delete VSTS Variable Groups via PowerShell
So that requests from service management systems can automatically configure Variable Groups containing Azure Service Principals and other system related information consumed by release definitions.

The API endpoint for this is not documented, but it does look like it is available as part of DistributedTask:

https://social.msdn.microsoft.com/Forums/vstudio/en-US/f4e2350b-9bd4-451b-8597-83ae9268a0f7/accessing-library-variable-groups-for-a-project-via-the-vsts-api?forum=TFService

I'm happy to look into this further and contribute a PR for the feature if this is something you'd be happy including.

Better secure Personal Access Token stored by Add-Profile cmdlet

With the the Add-Profile Cmdlet you can create Profiles which are stored in the $home/vsteam_profiles.json file.

In this file the Personal Access Token is stored as plain text. I would suggest to secure this value better using the same technique I used for my Wunderlist Module.

Check the Set-WunderlistAuthentication function in the Wunderlist Module.

I can try to implement this if you want.

/Stefan

Trouble with some Aliases

Hi,
I just installed the module and I noticed some Aliases which are still with the "VSTeam" part in their name.
I don't know if it's normal or not so I ask you directly.

Here are the aliases :

  • Add-VSTeamReleaseEnvironment
  • Remove-VSTeamAzureRMServiceEndpoint
  • Remove-VSTeamServiceFabricEndpoint
  • Remove-VSTeamSonarQubeEndpoint

Of course, these aliases are not in the function set when I enter my "Get-Command -Module VSTeam" command.
It's not a real big deal, and if you want, I can send you a PR to fix it.

Get-VSTeamBuildDefinition should allow access to the build process

Currently it seems that Get-VSTeamBuildDefinition allows you to get metadata for a build definition, but does not allow access to the actual build process. Interestingly the Update-VSTeamBuildDefinition and Add-VSTeamBuildDefinition commands allow you to specify an input file to use as the build process.

I would like to use VSTeam to build a script to patch multiple build definitions at once, but it seems that that is not currently possible, given the above situation. Is this something to consider? I could take a stab at a PR, but I'm not sure if it fits the vision.

gulp makeMarkdownJSONFile throws

I'm guessing this is being caused by the version of Node, but I can't find one that works.

Repro steps
On a clean machine (tried Windows 10 and Ubuntu 16.10) which has not previously had node installed, install a new version of node, I've tried:

  • 4.x latest
  • 5.x latest
  • 6.x latest
  • 8.x latest

clone this repo
run npm install
run gulp makeMarkdownJSONFile

Expected results
the markdown.json file is generated

Actual results

Using gulpfile F:\src\vsteam\gulpfile.js
 Starting 'makeMarkdownJSONFile'...
 Finished 'makeMarkdownJSONFile' after 3.74 ms
path.js:28
    throw new TypeError('Path must be a string. Received ' + inspect(path));
    ^

TypeError: Path must be a string. Received undefined
    at assertPath (path.js:28:11)
    at Object.resolve (path.js:221:7)
    at DestroyableTransform.saveFile [as _transform] (F:\src\vsteam\node_modules\vinyl-fs\lib\dest\index.js:36:26)
    at DestroyableTransform.Transform._read (F:\src\vsteam\node_modules\vinyl-fs\node_modules\readable-stream\lib\_stream_transform.js:184:10)
    at DestroyableTransform.Transform._write (F:\src\vsteam\node_modules\vinyl-fs\node_modules\readable-stream\lib\_stream_transform.js:172:12)
    at doWrite (F:\src\vsteam\node_modules\vinyl-fs\node_modules\readable-stream\lib\_stream_writable.js:237:10)
    at writeOrBuffer (F:\src\vsteam\node_modules\vinyl-fs\node_modules\readable-stream\lib\_stream_writable.js:227:5)
    at DestroyableTransform.Writable.write (F:\src\vsteam\node_modules\vinyl-fs\node_modules\readable-stream\lib\_stream_writable.js:194:11)
    at DestroyableTransform.ondata (F:\src\vsteam\node_modules\readable-stream\lib\_stream_readable.js:619:20)
    at emitOne (events.js:116:13)

BuildTag Functions

I've added three new methods in my fork:

  • Get-BuildTags
  • Add-BuildTag
  • Remove-BuildTag

I'd like to start a PR, but before I do, would you mind running a quick review of the commit? I've tried to maintain relative consistency with the existing code, but I've not worked in a lot of modules before.

ObsidianPhoenix@ab80bb9

One thing of note, I modified _buildUrl. The Tags require another level below the item Id. So I extracted the code to a common method. I had some issues with $Logs causing issues, so I needed an if to cope with it, not sure if thats the best way to handle it.

Thanks

Adding a project yields this error

I tried to create my first project using Team, and I got this issue, although the project appears to be created successfully as I would expect. (My pat has all scopes as a collection admin)

image

Thanks

Kevin.

Add-TeamAccount -UseWindowsAuthentication

Hi
Subsequent commands fail if Add-TeamAccount and login using Windows Authentication to avoid the use of plain text personal access token.
`Add-TeamAccount -Account $vstsAccountURL -UseWindowsAuthentication -verbose

VERBOSE: Using Default Windows Credentials for authentication; no Personal Access Token required
Removed default project
VERBOSE: VSTS
VERBOSE: Git: 4.0
VERBOSE: Core: 4.0
VERBOSE: Build: 4.0
VERBOSE: Release: 4.1-preview
VERBOSE: DistributedTask: 4.1-preview
VERBOSE: MemberEntitlementManagement: 4.1-preview
PS C:\Users\alexm> get-VSTeamProject
The property 'value' cannot be found on this object. Verify that the property exists.
At C:\Users\alexm\Documents\WindowsPowerShell\Modules\vsteam\2.1.5\src\projects.psm1:110 char:31

  •         foreach ($item in $resp.value) {
    
  •                           ~~~~~~~~~~~
    
    • CategoryInfo : NotSpecified: (:) [], PropertyNotFoundException
    • FullyQualifiedErrorId : PropertyNotFoundStrict`

cannot able to retrive the "Authored Date" property from Get-vsteamGitRef command

Feature Request:
Add "authored Date" property for the Get-VSTeamGitRef

Example:
Get-VSTeamGitRepository -ProjectName $projname |ForEach-Object {Get-VSTeamGitRef -ProjectName $projname -RepositoryID $_.id |select "AutoredDate"

Steps to reproduce

Expected behavior

Get-VSTeamGitRepository -ProjectName $projname |ForEach-Object {Get-VSTeamGitRef -ProjectName $projname -RepositoryID $_.id |select "AutoredDate"


Actual behavior
---------------

```none

Environment data

> $VSTeamVersionTable
> $PSVersionTable

Is there any way to add Team Members?

I feel bad asking this, but is there a way to add a VSTS Group to a Project using this? I cannot see where to add Team Members. We're using this to migrate 1,300 projects to TFS... I can't set them up manually, and am looking for a way to add a Member to Contributors for all projects I create.

Any thoughts?

Thanks for the great work all !!!

Get-VSTeamUser: The controller for path "/_apis/userentitlements/" was not found or does not implement IController

Steps to reproduce

Add-VSTeamAccount -Account XXX.visualstudio.com -SecurePersonalAccessToken $pat
Get-VSTeamProject
Set-VSTeamDefaultProject "YYY"
Get-VSTeamInfo
Get-VSTeamUser

Same result with

Get-VSTeamUser -Select "Projects"

Expected behavior

Return the list of users

Actual behavior

At the execution of Get-VSTeamUser, I have the following error

Invoke-RestMethod :
    The controller for path &#39;/_apis/userentitlements/&#39; was not found or does not implement IController.

        body {
            font-family: Segoe UI, Tahoma, Arial, Verdana;
            font-size: small;
            height: 100%;
            margin: 0;
        }
        A {
            color: #007ACC;
            text-decoration: none;
<snip>

          404

              Not Found
              We could not find the requested page

              Go back home





                  Service Status and Support
                  @VSTS




              More information about this error
              The controller for path &#39;/_apis/userentitlements/&#39; was not found or does not implement
ontroller.



              Here are some additional tips


                          Verify the URL you are trying to access is correct
<snip>
At C:\Program Files\WindowsPowerShell\Modules\VSTeam\3.0.0\src\common.ps1:566 char:12
+    $resp = Invoke-RestMethod @params
+            ~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebExc
   eption
    + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand
The property 'value' cannot be found on this object. Verify that the property exists.
At C:\Program Files\WindowsPowerShell\Modules\VSTeam\3.0.0\src\users.psm1:72 char:31
+             foreach ($item in $resp.value) {
+                               ~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], PropertyNotFoundException
    + FullyQualifiedErrorId : PropertyNotFoundStrict

The property 'value' cannot be found on this object. Verify that the property exists.
At C:\Program Files\WindowsPowerShell\Modules\VSTeam\3.0.0\src\users.psm1:76 char:13
+             Write-Output $resp.value
+             ~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], PropertyNotFoundException
    + FullyQualifiedErrorId : PropertyNotFoundStrict

Environment data

> $VSTeamVersionTable
Name                           Value
----                           -----
Git                            4.0
DistributedTask                4.1-preview
Tfvc                           4.0
Version                        VSTS
Release                        4.1-preview
Build                          4.0
Account                        https://XXX.visualstudio.com
Core                           4.0
DefaultProject                 YYY
ModuleVersion                  3.0.0
MemberEntitlementManagement    4.1-preview
ServiceFabricEndpoint          4.1-preview
> $PSVersionTable
Name                           Value
----                           -----
PSVersion                      5.1.14409.1012
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.14409.1012
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

Alligning SHiPS PSDrive properties with VSTeam module properties

The current implementation of the SHiPS PSDrive feature does not alligns with the original VSTeam object properties.

Example:
Original VSTeam Module property members of the Build Object are:

  • name
  • buildNumber
  • buildNumberRevision
  • definition
  • finishTime
  • id
  • keepForever
  • lastChangedBy
  • lastChangedDate
  • logs
  • orchestrationPlan
  • plans
  • priority
  • project
  • queue
  • queueTime
  • reason
  • repository
  • requestedBy
  • requestedFor
  • result
  • retainedByRelease
  • sourceBranch
  • sourceVersion
  • startTime
  • status
  • uri
  • url
  • _links
  • definitionName
  • lastChangedByUser
  • projectName
  • queueID
  • queueName
  • repositoryType
  • requestedByUser
  • requestedForUser

The Object properties for the SHiPS Build Object are the following:

  • BuildDefinition
  • BuildNumber
  • BuildRequestedByUser
  • BuildResult
  • BuildStartTime
  • BuildStatus
  • Name

We need allign the properties so we can pipe object from the the drive to the functions of the vsteam module.

/Stefan

[Suggestion]Function Naming

Just a personal preference, though I wanted to raise it here.
Please consider using the following naming convention for your functions (or similar)

Verb-(ModuleName)(Function)

Example:
Add-TeamBuild
New-TeamBuild
Add-TeamBuildDefinition
Get-TeamRelease
...
This will help mitigate conflicting functions from other modules, and making it more consistent

Thanks for the module

"Page not found" with build and releases

Steps to reproduce

Add-TeamAccount to specify my TFS, and then http://tfs:8080/tfs/PROD as my account. It says "Removed default project", so for now I think it is the normal behavior.

Expected behavior

With Get-Build and Get-VSTeamRelease, it should provide the prompt to enter the name of the team project.

Actual behavior

It says:

Invoke-RestMethod :                                                                                                                                                                                                                                     Page not found. - Microsoft Team Foundation Server                                                                                                                                                                                                  body { font-family: Segoe UI, Helvetica Neue, Helvetica, Arial, Verdana; font-size: 16px; height: 100%; }               A { color: #007ACC; text-decoration: none; }                                                                            A:hover { text-decoration: underline; }                                                                                 h1 { font-size: 32px; color: #888; margin-bottom: 0px; }                                                                h2 { font-size: 24px; color: #888; font-weight: normal; margin-top: 0px; }                                              pre { font-family: Consolas, Courier New, monospace; font-size: 12px; border: 1px solid #ccc; background-color: #eee; padding: 10px;}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   function toggle() {                                                                                                         var icon = document.getElementById("moreInfoIcon");                                                                     var section = document.getElementById("moreInfo");                                                                      icon.src = section.style.display === ""                                                                                     ? "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8%2F9hAAAABGdBTUEAALGPC%2FxhBQAAAAlwSFlzAAAOwgAADsIBFShKgAAAABl0RVh0U29mdHdhcmUAUGFpbnQuTkVUIHYzLjUuODc7gF0AAAB2SURBVDhPY2AYBThDoKWlJa2jo0OO7CBaunTpfxAGGmRCliEgzc%2BePfs%2Ff%2F78%2F01NTZokGwIyAARAhkybNo10Q2AGwAwBeuV%2Fa2urHtEuWb58OWUuABkAC4Pm5mY7om2GKQQZAMJkaQYZAgx5P4rSAclOHjANAOQrXesb81M5AAAAAElFTkSuQmCC"                                                                                                            : "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8%2F9hAAAABGdBTUEAALGPC%2FxhBQAAAAlwSFlzAAAOwgAADsIBFShKgAAAABl0RVh0U29mdHdhcmUAUGFpbnQuTkVUIHYzLjUuODc7gF0AAABCSURBVDhPY2AYBfQJATU1NWsgLifLNhUVFVeg5v8gTLIBMM2RkZGkG4CsmWQD0DWTbAAowGD%2BRqLJC0SSA24EagAAq9sjtZrUZogAAAAASUVORK5CYII%3D";                                                         section.style.display = section.style.display === "" ? "none" : "";                                                 }                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           Error                                                                                                                   The page you are looking for is currently unavailable.                                                                                                                                                                                          Page not found.                                                                                                          More information about this error                                                                                                                                                                                                                  Page not found.                                                                                                                                                                                                                             Things you can try:                                                                                                                                                                                                                                 Refresh the current page                                                                                                Go back to the previous page                                                                                                                                                                                                                    Sign in as a different user                                                                                                                                                                                                                     Submit feedback to Microsoft about this error                                                                                                                                                                                                                                                                                                                                                                                                                                                   Microsoft Visual Studio Team Foundation Server                                                                          © Microsoft Corporation. All rights reserved.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               At C:\Program Files\PowerShell\Modules\VSTeam\4.0.1\src\common.ps1:486 char:12                                          +    $resp = Invoke-RestMethod @params                                                                                  +            ~~~~~~~~~~~~~~~~~~~~~~~~~                                                                                  + CategoryInfo          : InvalidOperation: (Method: GET, Re...rShell/6.0.4                                             }:HttpRequestMessage) [Invoke-RestMethod], HttpResponseException                                                        + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand           The property 'value' cannot be found on this object. Verify that the property exists.                                   At C:\Program Files\PowerShell\Modules\VSTeam\4.0.1\src\releases.psm1:106 char:28                                       +          foreach ($item in $resp.value) {                                                                             +                            ~~~~~~~~~~~                                                                                + CategoryInfo          : NotSpecified: (:) [], PropertyNotFoundException                                               + FullyQualifiedErrorId : PropertyNotFoundStrict                                                                                                                                                                                                The property 'value' cannot be found on this object. Verify that the property exists.                                   At C:\Program Files\PowerShell\Modules\VSTeam\4.0.1\src\releases.psm1:110 char:10                                       +          Write-Output $resp.value                                                                                     +          ~~~~~~~~~~~~~~~~~~~~~~~~                                                                                     + CategoryInfo          : NotSpecified: (:) [], PropertyNotFoundException                                               + FullyQualifiedErrorId : PropertyNotFoundStrict

Environment data

> $VSTeamVersionTable
Last version.
> $PSVersionTable
Version 5 of PowerShell Standard and 6 of PowerShell Core.

Add "Remove-VsteamGitRef" command

Feature:
Need to Add "Remove-VSTeamGitRef" command similar to "Get-VSTeamGitRef" command.

Steps to reproduce

Expected behavior

Remove-VSTeamGitRef -ProjectName $Projname -RepositoryID $RepID

Actual behavior

Remove-VSTeamGitRef command not available.

Environment data

> $VSTeamVersionTable
> $PSVersionTable

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.