PowerShell I would like you to meet TFS and VSTS

Today I released my first PowerShell module to the PowerShell Gallery called Team. Team is a PowerShell module that exposes portions of the REST API for Visual Studio Team Services and Team Foundation Server.

It is written in pure PowerShell and can be used on Mac, Linux or Windows to connect to TFS or VSTS.  To install Team you can use the Install-Module cmdlet.  Just make sure on Windows you run PowerShell as administrator and on Mac or Linux you sudo your PowerShell session.  Then simply issue the following command.

PS> Install-Module -Name Team 

Once the module is installed you can view all the provided functions by running Get-Command.

PS>Get-Command -Module Team

CommandType     Name                                               Version    Source
-----------     ----                                               -------    ------
Function        Add-AzureRMServiceEndpoint                         0.1.1      Team
Function        Add-Build                                          0.1.1      Team
Function        Add-BuildDefinition                                0.1.1      Team
Function        Add-Project                                        0.1.1      Team
Function        Add-ReleaseDefinition                              0.1.1      Team
Function        Add-TeamAccount                                    0.1.1      Team
Function        Clear-DefaultProject                               0.1.1      Team
Function        Get-Build                                          0.1.1      Team
Function        Get-BuildDefinition                                0.1.1      Team
Function        Get-CloudSubscription                              0.1.1      Team
Function        Get-Pool                                           0.1.1      Team
Function        Get-Project                                        0.1.1      Team
Function        Get-Queue                                          0.1.1      Team
Function        Get-ReleaseDefinition                              0.1.1      Team
Function        Get-ServiceEndpoint                                0.1.1      Team
Function        Get-TeamInfo                                       0.1.1      Team
Function        Remove-Build                                       0.1.1      Team
Function        Remove-BuildDefinition                             0.1.1      Team
Function        Remove-Project                                     0.1.1      Team
Function        Remove-ReleaseDefinition                           0.1.1      Team
Function        Remove-ServiceEndpoint                             0.1.1      Team
Function        Remove-TeamAccount                                 0.1.1      Team
Function        Set-DefaultProject                                 0.1.1      Team
Function        Update-Project                                     0.1.1      Team

This is just what is there now and more will follow.  Once I put a coat of polish on the module I will open source it on GitHub.

To get started with the module make sure and call Add-TeamAccount first.  This will require your Team Services account name or full TFS URL including collection and a Personal Access Token. Team only supports TFS 2017 and Team Services.

Comments (14) -

  • If you are having trouble with Install-Module on Linux you can use
    Save-Module -Name Team -Path .
    Then
    Import-Module ./Team/0.1.4/team.psd1
  • Looking at the cmdlet names it looks very cool and useful. Are there any plans to offer some sort of documentation and examples online? Maybe when the github repository goes public?
    • There is documentation and examples in the functions. Use
      help get-releasedefinition
      for example.  I will continue to polish and improve the help.
      • As I like to read documentation from a centralized location outside the console, I created this gist-script to share and hel pothers (gist.github.com/.../f6df9af26c365b34dda496d9dfad1043)

        Once you install the Team module, execute:

        Export-ModuleDocumentation.ps1 -Module Team

        Markdown files are available in your temp folder under a folder TeamDocumentation.
  • Nothing on GitHub by the link
    • It will be there in a week or two. But to use it just fire up PowerShell and type Install-Module Team.
  • Exactly what I was looking for, however, we're still running TFS 2015 Update 3. Is there any chance to get it working with this version?
    • I am afraid not. But you will not regret the upgrade to 2017. It is really nice and worth the effort.
  • Hi Donovan - this looks awesome!

    I've installed the module, and am able to run Add-TeamAccount, but when I try to Get-Project, or Get-BuildDefinition, I  get a 401 error (not authorized). I am the account owner, mind you, so I shouldn't be blocked.

    Any idea why this might be?
  • what version are you using and are you adding tfs or vsts?

Add comment

Loading