From f2b64574193ba83e91f5ce037af6dab8e60b53ce Mon Sep 17 00:00:00 2001 From: Andy Neillans Date: Wed, 1 Mar 2017 13:38:13 +0000 Subject: [PATCH 1/9] Spelling error on Add-TeamAccount --- en-US/Team-Help.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/en-US/Team-Help.xml b/en-US/Team-Help.xml index 8ddccb278..f9cd0c002 100644 --- a/en-US/Team-Help.xml +++ b/en-US/Team-Help.xml @@ -3179,7 +3179,7 @@ entire URL. Just the portion before visualstudio.com. For example in the following url mydemos is the account name. https://mydemos.visualstudio.com or -The ful Team Foundation Server (TFS) url including the collection. +The full Team Foundation Server (TFS) url including the collection. http://localhost:8080/tfs/DefaultCollection String From ebdf5863cfc90eba2975cb26d2952a92c7ce133e Mon Sep 17 00:00:00 2001 From: Andy Neillans Date: Wed, 1 Mar 2017 13:39:02 +0000 Subject: [PATCH 2/9] Further spelling errors --- en-US/Team-Help.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/en-US/Team-Help.xml b/en-US/Team-Help.xml index f9cd0c002..cf404836e 100644 --- a/en-US/Team-Help.xml +++ b/en-US/Team-Help.xml @@ -3220,7 +3220,7 @@ entire URL. Just the portion before visualstudio.com. For example in the following url mydemos is the account name. https://mydemos.visualstudio.com or -The ful Team Foundation Server (TFS) url including the collection. +The full Team Foundation Server (TFS) url including the collection. http://localhost:8080/tfs/DefaultCollection String @@ -3245,7 +3245,7 @@ entire URL. Just the portion before visualstudio.com. For example in the following url mydemos is the account name. https://mydemos.visualstudio.com or -The ful Team Foundation Server (TFS) url including the collection. +The full Team Foundation Server (TFS) url including the collection. http://localhost:8080/tfs/DefaultCollection String From 1f550f0e3d89951ce45b9f4141f6794295ab3723 Mon Sep 17 00:00:00 2001 From: Andy Neillans Date: Wed, 1 Mar 2017 20:39:48 +0000 Subject: [PATCH 3/9] Moved _isOnWindows to common, removed uninitialised variable that was referenced --- .gitignore | 3 ++- src/common.ps1 | 6 +++++- src/team.psm1 | 4 ---- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/.gitignore b/.gitignore index 1ba2a033c..97de89609 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,5 @@ /sampleHelp.txt /temp.txt /pub.ps1 -test/sample.txt \ No newline at end of file +test/sample.txt +/src/.vs diff --git a/src/common.ps1 b/src/common.ps1 index b09b4a503..448135817 100644 --- a/src/common.ps1 +++ b/src/common.ps1 @@ -15,6 +15,10 @@ function _handleException { Write-Warning (ConvertFrom-Json $ex.ToString()).message } +function _isOnWindows { + ($env:os -ne $null) -and ($env:os).StartsWith("Windows") +} + # The url for release is special and used in more than one # module so I moved it here. function _buildReleaseURL { @@ -64,7 +68,7 @@ function _getUserAgent { $os = 'unknown' - if ($PSVersionTable.PSVersion.Major -lt 6 -or $IsWindows) { + if ($PSVersionTable.PSVersion.Major -lt 6 -or _isOnWindows) { $os = 'Windows' } elseif ($IsOSX) { $os = 'OSX' diff --git a/src/team.psm1 b/src/team.psm1 index 5265391c6..83649e4b1 100644 --- a/src/team.psm1 +++ b/src/team.psm1 @@ -4,10 +4,6 @@ Set-StrictMode -Version Latest $here = Split-Path -Parent $MyInvocation.MyCommand.Path . "$here\common.ps1" -function _isOnWindows { - ($env:os -ne $null) -and ($env:os).StartsWith("Windows") -} - function _testAdministrator { $user = [Security.Principal.WindowsIdentity]::GetCurrent() (New-Object Security.Principal.WindowsPrincipal $user).IsInRole([Security.Principal.WindowsBuiltinRole]::Administrator) From bcda3ce2d6730e211d8e31c8bf5fb179f5149e02 Mon Sep 17 00:00:00 2001 From: Andy Neillans Date: Wed, 1 Mar 2017 21:04:41 +0000 Subject: [PATCH 4/9] Implementing ability to use DefaultCredentials when on premise and against TFS --- src/Approvals.psm1 | 16 ++++++++++++---- src/buildDefinitions.psm1 | 28 ++++++++++++++++++++++------ src/builds.psm1 | 24 ++++++++++++++++++++---- src/common.ps1 | 10 +++++++++- src/pools.psm1 | 12 ++++++++++-- src/projects.psm1 | 36 ++++++++++++++++++++++++++++++------ src/releaseDefinitions.psm1 | 24 ++++++++++++++++++++---- 7 files changed, 123 insertions(+), 27 deletions(-) diff --git a/src/Approvals.psm1 b/src/Approvals.psm1 index 08c4927c3..ee4acb956 100644 --- a/src/Approvals.psm1 +++ b/src/Approvals.psm1 @@ -42,8 +42,12 @@ function Get-Approval { try { # Call the REST API - $resp = Invoke-RestMethod -UserAgent (_getUserAgent) -Uri $listurl -Headers @{Authorization = "Basic $env:TEAM_PAT"} - + if (_useWindowsAuthenticationOnPremise) { + $resp = Invoke-RestMethod -UserAgent (_getUserAgent) -Uri $listurl -UseDefaultCredentials + } else { + $resp = Invoke-RestMethod -UserAgent (_getUserAgent) -Uri $listurl -Headers @{Authorization = "Basic $env:TEAM_PAT"} + } + # Apply a Type Name so we can use custom format view and custom type extensions foreach($item in $resp.value) { _applyTypes -item $item @@ -96,8 +100,12 @@ function Set-Approval { try { # Call the REST API - $resp = Invoke-RestMethod -UserAgent (_getUserAgent) -Method Patch -Uri $listurl -ContentType "application/json" -Headers @{Authorization = "Basic $env:TEAM_PAT"} -Body $body - + if (_useWindowsAuthenticationOnPremise) { + $resp = Invoke-RestMethod -UserAgent (_getUserAgent) -Method Patch -Uri $listurl -ContentType "application/json" -Body $body -UseDefaultCredentials + } else { + $resp = Invoke-RestMethod -UserAgent (_getUserAgent) -Method Patch -Uri $listurl -ContentType "application/json" -Headers @{Authorization = "Basic $env:TEAM_PAT"} -Body $body + } + Write-Output "Approval $item status changed to $status" } catch { diff --git a/src/buildDefinitions.psm1 b/src/buildDefinitions.psm1 index 5dfa366b9..5d28bec70 100644 --- a/src/buildDefinitions.psm1 +++ b/src/buildDefinitions.psm1 @@ -91,8 +91,12 @@ function Get-BuildDefinition { } # Call the REST API - $resp = Invoke-RestMethod -UserAgent (_getUserAgent) -Uri $listurl -Headers @{Authorization = "Basic $env:TEAM_PAT"} - + if (_useWindowsAuthenticationOnPremise) { + $resp = Invoke-RestMethod -UserAgent (_getUserAgent) -Uri $listurl -UseDefaultCredentials + } else { + $resp = Invoke-RestMethod -UserAgent (_getUserAgent) -Uri $listurl -Headers @{Authorization = "Basic $env:TEAM_PAT"} + } + _applyTypes -item $resp Write-Output $resp @@ -110,8 +114,12 @@ function Get-BuildDefinition { } # Call the REST API - $resp = Invoke-RestMethod -UserAgent (_getUserAgent) -Uri $listurl -Headers @{Authorization = "Basic $env:TEAM_PAT"} - + if (_useWindowsAuthenticationOnPremise) { + $resp = Invoke-RestMethod -UserAgent (_getUserAgent) -Uri $listurl -UseDefaultCredentials + } else { + $resp = Invoke-RestMethod -UserAgent (_getUserAgent) -Uri $listurl -Headers @{Authorization = "Basic $env:TEAM_PAT"} + } + # Apply a Type Name so we can use custom format view and custom type extensions foreach($item in $resp.value) { _applyTypes -item $item @@ -141,7 +149,11 @@ function Add-BuildDefinition { $url = _buildURL -projectName $projectName # Call the REST API - $resp = Invoke-RestMethod -UserAgent (_getUserAgent) -Method Post -Uri $url -ContentType "application/json" -Headers @{Authorization = "Basic $env:TEAM_PAT"} -InFile $inFile + if (_useWindowsAuthenticationOnPremise) { + $resp = Invoke-RestMethod -UserAgent (_getUserAgent) -Method Post -Uri $url -ContentType "application/json" -UseDefaultCredentials -InFile $inFile + } else { + $resp = Invoke-RestMethod -UserAgent (_getUserAgent) -Method Post -Uri $url -ContentType "application/json" -Headers @{Authorization = "Basic $env:TEAM_PAT"} -InFile $inFile + } return $resp } @@ -170,7 +182,11 @@ function Remove-BuildDefinition { if ($Force -or $pscmdlet.ShouldProcess($item, "Delete Build Definition")) { # Call the REST API - $resp = Invoke-RestMethod -UserAgent (_getUserAgent) -Method Delete -Uri $listurl -Headers @{Authorization = "Basic $env:TEAM_PAT"} + if (_useWindowsAuthenticationOnPremise) { + $resp = Invoke-RestMethod -UserAgent (_getUserAgent) -Method Delete -Uri $listurl -UseDefaultCredentials + } else { + $resp = Invoke-RestMethod -UserAgent (_getUserAgent) -Method Delete -Uri $listurl -Headers @{Authorization = "Basic $env:TEAM_PAT"} + } Write-Output "Deleted build defintion $item" } diff --git a/src/builds.psm1 b/src/builds.psm1 index 0457f440c..335bdeb72 100644 --- a/src/builds.psm1 +++ b/src/builds.psm1 @@ -107,7 +107,11 @@ function Get-Build { $listurl = _buildURL -projectName $ProjectName -id $item # Call the REST API - $resp = Invoke-RestMethod -UserAgent (_getUserAgent) -Uri $listurl -Headers @{Authorization = "Basic $env:TEAM_PAT"} + if (_useWindowsAuthenticationOnPremise) { + $resp = Invoke-RestMethod -UserAgent (_getUserAgent) -Uri $listurl -UseDefaultCredentials + } else { + $resp = Invoke-RestMethod -UserAgent (_getUserAgent) -Uri $listurl -Headers @{Authorization = "Basic $env:TEAM_PAT"} + } _applyTypes -item $resp @@ -130,7 +134,11 @@ function Get-Build { $listurl += _appendQueryString -name "definitions" -value ($definitions -join ',') # Call the REST API - $resp = Invoke-RestMethod -UserAgent (_getUserAgent) -Uri $listurl -Headers @{Authorization = "Basic $env:TEAM_PAT"} + if (_useWindowsAuthenticationOnPremise) { + $resp = Invoke-RestMethod -UserAgent (_getUserAgent) -Uri $listurl -UseDefaultCredentials + } else { + $resp = Invoke-RestMethod -UserAgent (_getUserAgent) -Uri $listurl -Headers @{Authorization = "Basic $env:TEAM_PAT"} + } # Apply a Type Name so we can use custom format view and custom type extensions foreach($item in $resp.value) { @@ -199,7 +207,11 @@ function Add-Build { Write-Verbose $body # Call the REST API - $resp = Invoke-RestMethod -UserAgent (_getUserAgent) -Method Post -ContentType "application/json" -Body $body -Uri $listurl -Headers @{Authorization = "Basic $env:TEAM_PAT"} + if (_useWindowsAuthenticationOnPremise) { + $resp = Invoke-RestMethod -UserAgent (_getUserAgent) -Method Post -ContentType "application/json" -Body $body -Uri $listurl -UseDefaultCredentials + } else { + $resp = Invoke-RestMethod -UserAgent (_getUserAgent) -Method Post -ContentType "application/json" -Body $body -Uri $listurl -Headers @{Authorization = "Basic $env:TEAM_PAT"} + } _applyTypes -item $resp @@ -231,7 +243,11 @@ function Remove-Build { if ($Force -or $pscmdlet.ShouldProcess($item, "Delete Build")) { try { # Call the REST API - $resp = Invoke-RestMethod -UserAgent (_getUserAgent) -Method Delete -Uri $listurl -Headers @{Authorization = "Basic $env:TEAM_PAT"} + if (_useWindowsAuthenticationOnPremise) { + $resp = Invoke-RestMethod -UserAgent (_getUserAgent) -Method Delete -Uri $listurl -UseDefaultCredentials + } else { + $resp = Invoke-RestMethod -UserAgent (_getUserAgent) -Method Delete -Uri $listurl -Headers @{Authorization = "Basic $env:TEAM_PAT"} + } Write-Output "Deleted build $item" } diff --git a/src/common.ps1 b/src/common.ps1 index 448135817..2edf76a0e 100644 --- a/src/common.ps1 +++ b/src/common.ps1 @@ -79,6 +79,10 @@ function _getUserAgent { return "Team Module/$($versionData.ModuleVersion) ($os) PowerShell/$($PSVersionTable.PSVersion.ToString())" } +function _useWindowsAuthenticationOnPremise { + return _isOnWindows -and (!$env:TEAM_PAT) -and -not ($env:TEAM_ACCT -like "*visualstudio.com") +} + function _getProjects { if(-not $env:TEAM_ACCT) { Write-Output @() @@ -95,7 +99,11 @@ function _getProjects { # Call the REST API try { - $resp = Invoke-RestMethod -UserAgent (_getUserAgent) -Uri $listurl -Headers @{Authorization = "Basic $env:TEAM_PAT"} + if (_useWindowsAuthenticationOnPremise) { + $resp = Invoke-RestMethod -UserAgent (_getUserAgent) -Uri $listurl -UseDefaultCredentials + } else { + $resp = Invoke-RestMethod -UserAgent (_getUserAgent) -Uri $listurl -Headers @{Authorization = "Basic $env:TEAM_PAT"} + } if ($resp.count -gt 0) { Write-Output ($resp.value).name diff --git a/src/pools.psm1 b/src/pools.psm1 index a0bc87f64..c1530a057 100644 --- a/src/pools.psm1 +++ b/src/pools.psm1 @@ -60,7 +60,11 @@ function Get-Pool { $url = _buildURL -id $id # Call the REST API - $resp = Invoke-RestMethod -UserAgent (_getUserAgent) -Uri $url -Headers @{Authorization = "Basic $env:TEAM_PAT"} + if (_useWindowsAuthenticationOnPremise) { + $resp = Invoke-RestMethod -UserAgent (_getUserAgent) -Uri $url -UseDefaultCredentials + } else { + $resp = Invoke-RestMethod -UserAgent (_getUserAgent) -Uri $url -Headers @{Authorization = "Basic $env:TEAM_PAT"} + } _applyTypes -item $resp @@ -69,7 +73,11 @@ function Get-Pool { # Build the url $url = _buildURL - $resp = Invoke-RestMethod -UserAgent (_getUserAgent) -Uri $url -Headers @{Authorization = "Basic $env:TEAM_PAT"} + if (_useWindowsAuthenticationOnPremise) { + $resp = Invoke-RestMethod -UserAgent (_getUserAgent) -Uri $url -UseDefaultCredentials + } else { + $resp = Invoke-RestMethod -UserAgent (_getUserAgent) -Uri $url -Headers @{Authorization = "Basic $env:TEAM_PAT"} + } # Apply a Type Name so we can use custom format view and custom type extensions foreach($item in $resp.value) { diff --git a/src/projects.psm1 b/src/projects.psm1 index 38b2ec69f..be8a4611a 100644 --- a/src/projects.psm1 +++ b/src/projects.psm1 @@ -45,7 +45,11 @@ function _checkStatus { ) # Call the REST API - $resp = Invoke-RestMethod -UserAgent (_getUserAgent) -Uri $uri -Headers @{Authorization = "Basic $env:TEAM_PAT"} + if (_useWindowsAuthenticationOnPremise) { + $resp = Invoke-RestMethod -UserAgent (_getUserAgent) -Uri $uri -UseDefaultCredentials + } else { + $resp = Invoke-RestMethod -UserAgent (_getUserAgent) -Uri $uri -Headers @{Authorization = "Basic $env:TEAM_PAT"} + } return $resp } @@ -114,7 +118,11 @@ function Get-Project { } # Call the REST API - $resp = Invoke-RestMethod -UserAgent (_getUserAgent) -Uri $listurl -Headers @{Authorization = "Basic $env:TEAM_PAT"} + if (_useWindowsAuthenticationOnPremise) { + $resp = Invoke-RestMethod -UserAgent (_getUserAgent) -Uri $listurl -UseDefaultCredentials + } else { + $resp = Invoke-RestMethod -UserAgent (_getUserAgent) -Uri $listurl -Headers @{Authorization = "Basic $env:TEAM_PAT"} + } # Apply a Type Name so we can use custom format view and custom type extensions _applyTypes -item $resp @@ -126,7 +134,11 @@ function Get-Project { try { # Call the REST API - $resp = Invoke-RestMethod -UserAgent (_getUserAgent) -Uri $listurl -Headers @{Authorization = "Basic $env:TEAM_PAT"} + if (_useWindowsAuthenticationOnPremise) { + $resp = Invoke-RestMethod -UserAgent (_getUserAgent) -Uri $listurl -UseDefaultCredentials + } else { + $resp = Invoke-RestMethod -UserAgent (_getUserAgent) -Uri $listurl -Headers @{Authorization = "Basic $env:TEAM_PAT"} + } # Apply a Type Name so we can use custom format view and custom type extensions foreach($item in $resp.value) { @@ -191,7 +203,11 @@ function Update-Project { Write-Verbose $body # Call the REST API - $resp = Invoke-RestMethod -UserAgent (_getUserAgent) -Method Patch -ContentType "application/json" -Body $body -Uri $listurl -Headers @{Authorization = "Basic $env:TEAM_PAT"} + if (_useWindowsAuthenticationOnPremise) { + $resp = Invoke-RestMethod -UserAgent (_getUserAgent) -Method Patch -ContentType "application/json" -Body $body -Uri $listurl -UseDefaultCredentials + } else { + $resp = Invoke-RestMethod -UserAgent (_getUserAgent) -Method Patch -ContentType "application/json" -Body $body -Uri $listurl -Headers @{Authorization = "Basic $env:TEAM_PAT"} + } _trackProgress -resp $resp -title 'Updating team project' -msg $msg @@ -242,7 +258,11 @@ function Add-Project { try { # Call the REST API - $resp = Invoke-RestMethod -UserAgent (_getUserAgent) -Method Post -ContentType "application/json" -Body $body -Uri $listurl -Headers @{Authorization = "Basic $env:TEAM_PAT"} + if (_useWindowsAuthenticationOnPremise) { + $resp = Invoke-RestMethod -UserAgent (_getUserAgent) -Method Post -ContentType "application/json" -Body $body -Uri $listurl -UseDefaultCredentials + } else { + $resp = Invoke-RestMethod -UserAgent (_getUserAgent) -Method Post -ContentType "application/json" -Body $body -Uri $listurl -Headers @{Authorization = "Basic $env:TEAM_PAT"} + } _trackProgress -resp $resp -title 'Creating team project' -msg "Name: $($Name), Template: $($processTemplate), Src: $($srcCtrl)" @@ -277,7 +297,11 @@ function Remove-Project { if ($Force -or $pscmdlet.ShouldProcess($ProjectName, "Delete Project")) { # Call the REST API - $resp = Invoke-RestMethod -UserAgent (_getUserAgent) -Method Delete -Uri $listurl -Headers @{Authorization = "Basic $env:TEAM_PAT"} + if (_useWindowsAuthenticationOnPremise) { + $resp = Invoke-RestMethod -UserAgent (_getUserAgent) -Method Delete -Uri $listurl -UseDefaultCredentials + } else { + $resp = Invoke-RestMethod -UserAgent (_getUserAgent) -Method Delete -Uri $listurl -Headers @{Authorization = "Basic $env:TEAM_PAT"} + } _trackProgress -resp $resp -title 'Deleting team project' -msg "Deleting $ProjectName" diff --git a/src/releaseDefinitions.psm1 b/src/releaseDefinitions.psm1 index db545d06a..10c25e9ef 100644 --- a/src/releaseDefinitions.psm1 +++ b/src/releaseDefinitions.psm1 @@ -59,7 +59,11 @@ function Get-ReleaseDefinition { # Call the REST API Write-Debug 'Get-ReleaseDefinition Call the REST API' - $resp = Invoke-RestMethod -UserAgent (_getUserAgent) -Uri $listurl -Headers @{Authorization = "Basic $env:TEAM_PAT"} + if (_useWindowsAuthenticationOnPremise) { + $resp = Invoke-RestMethod -UserAgent (_getUserAgent) -Uri $listurl -UseDefaultCredentials + } else { + $resp = Invoke-RestMethod -UserAgent (_getUserAgent) -Uri $listurl -Headers @{Authorization = "Basic $env:TEAM_PAT"} + } # Apply a Type Name so we can use custom format view and custom type extensions _applyTypes -item $resp @@ -74,7 +78,11 @@ function Get-ReleaseDefinition { } # Call the REST API - $resp = Invoke-RestMethod -UserAgent (_getUserAgent) -Uri $listurl -Headers @{Authorization = "Basic $env:TEAM_PAT"} + if (_useWindowsAuthenticationOnPremise) { + $resp = Invoke-RestMethod -UserAgent (_getUserAgent) -Uri $listurl -UseDefaultCredentials + } else { + $resp = Invoke-RestMethod -UserAgent (_getUserAgent) -Uri $listurl -Headers @{Authorization = "Basic $env:TEAM_PAT"} + } # Apply a Type Name so we can use custom format view and custom type extensions foreach($item in $resp.value) { @@ -108,7 +116,11 @@ function Add-ReleaseDefinition { # Call the REST API Write-Debug 'Add-ReleaseDefinition Call the REST API' - $resp = Invoke-RestMethod -UserAgent (_getUserAgent) -Method Post -Uri $url -ContentType "application/json" -Headers @{Authorization = "Basic $env:TEAM_PAT"} -InFile $inFile + if (_useWindowsAuthenticationOnPremise) { + $resp = Invoke-RestMethod -UserAgent (_getUserAgent) -Method Post -Uri $url -ContentType "application/json" -UseDefaultCredentials -InFile $inFile + } else { + $resp = Invoke-RestMethod -UserAgent (_getUserAgent) -Method Post -Uri $url -ContentType "application/json" -Headers @{Authorization = "Basic $env:TEAM_PAT"} -InFile $inFile + } Write-Output $resp } @@ -140,7 +152,11 @@ function Remove-ReleaseDefinition { if ($force -or $pscmdlet.ShouldProcess($item, "Delete Release Definition")) { # Call the REST API Write-Debug 'Remove-ReleaseDefinition Call the REST API' - $resp = Invoke-RestMethod -UserAgent (_getUserAgent) -Method Delete -Uri $listurl -Headers @{Authorization = "Basic $env:TEAM_PAT"} + if (_useWindowsAuthenticationOnPremise) { + $resp = Invoke-RestMethod -UserAgent (_getUserAgent) -Method Delete -Uri $listurl -UseDefaultCredentials + } else { + $resp = Invoke-RestMethod -UserAgent (_getUserAgent) -Method Delete -Uri $listurl -Headers @{Authorization = "Basic $env:TEAM_PAT"} + } Write-Output "Deleted release defintion $item" } From dfe9fc60f2fe2fe6941f80deafcf03d8b1285be9 Mon Sep 17 00:00:00 2001 From: Andy Neillans Date: Wed, 1 Mar 2017 21:14:14 +0000 Subject: [PATCH 5/9] If no PAT provided, and on windows, assume Windows Auth --- src/team.psm1 | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/team.psm1 b/src/team.psm1 index 83649e4b1..2812f27b1 100644 --- a/src/team.psm1 +++ b/src/team.psm1 @@ -123,7 +123,13 @@ function Add-TeamAccount { $Account = "https://$($Account).visualstudio.com" } - $encodedPat = [System.Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes(":$_pat")) + $encodedPat = [System.Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes(":$_pat")) + + # If no PAT is entered, and on windows, assume we will be using default credentials for REST calls + if ((!$_pat) -and (_isOnWindows)) { + Write-Verbose "Using Default Windows Credentials for authentication; no Personal Access Token provided" + $encodedPat = "" + } _setEnvironmentVariables -Level $Level -Pat $encodedPat -Acct $account } From 8a7bcd8ee7a9bf2387a408698e1141059ad26fa5 Mon Sep 17 00:00:00 2001 From: Andy Neillans Date: Thu, 2 Mar 2017 08:52:29 +0000 Subject: [PATCH 6/9] Minor bug fix --- src/common.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/common.ps1 b/src/common.ps1 index 2edf76a0e..f281ffe12 100644 --- a/src/common.ps1 +++ b/src/common.ps1 @@ -68,7 +68,7 @@ function _getUserAgent { $os = 'unknown' - if ($PSVersionTable.PSVersion.Major -lt 6 -or _isOnWindows) { + if ($PSVersionTable.PSVersion.Major -lt 6 -or (_isOnWindows)) { $os = 'Windows' } elseif ($IsOSX) { $os = 'OSX' From cc8a775006a4fe4f1704b8f8a3ffbc8023f19157 Mon Sep 17 00:00:00 2001 From: Andy Neillans Date: Sat, 4 Mar 2017 15:34:40 +0000 Subject: [PATCH 7/9] Added a -UseWindowsAuthentication switch for windows machines only --- en-US/Team-Help.xml | 44 ++++++++++++++++++++++++++++++++++++ src/team.psm1 | 55 ++++++++++++++++++++++++++++++++++----------- 2 files changed, 86 insertions(+), 13 deletions(-) diff --git a/en-US/Team-Help.xml b/en-US/Team-Help.xml index cf404836e..b657ed432 100644 --- a/en-US/Team-Help.xml +++ b/en-US/Team-Help.xml @@ -3234,6 +3234,32 @@ http://localhost:8080/tfs/DefaultCollection String + + Add-TeamAccount + + Account + + + The Visual Studio Team Services (VSTS) account name to use. DO NOT enter the + entire URL. Just the portion before visualstudio.com. For example in the + following url mydemos is the account name. + https://mydemos.visualstudio.com + or + The full Team Foundation Server (TFS) url including the collection. + http://localhost:8080/tfs/DefaultCollection + + + String + + + + UseWindowsAuthentication + + + + + + @@ -3295,6 +3321,14 @@ To use pat + + + UseWindowsAuthentication + + + + + @@ -3318,6 +3352,16 @@ To use pat Allows you to provide all the information on the command line. + + -------------------------- EXAMPLE 3 -------------------------- + + PS C:\> + + Add-TeamAccount -Account http://localtfs:8080/tfs/DefaultCollection -UseWindowsAuthentication + + On Windows, allows you use to use Windows authentication against a local TFS server. + + diff --git a/src/team.psm1 b/src/team.psm1 index 2812f27b1..dd667ef0d 100644 --- a/src/team.psm1 +++ b/src/team.psm1 @@ -46,6 +46,7 @@ function Get-TeamInfo { function Add-TeamAccount { [CmdletBinding(DefaultParameterSetName='Secure')] param( + [parameter(ParameterSetName='Windows', Mandatory=$true, Position=1)] [parameter(ParameterSetName='Secure', Mandatory=$true, Position=1)] [Parameter(ParameterSetName='Plain')] [string] $Account, @@ -56,7 +57,7 @@ function Add-TeamAccount { ) DynamicParam { - # Only add this option on Windows Machines + # Only add these options on Windows Machines if(_isOnWindows) { Write-Verbose 'On a Windows machine' @@ -88,9 +89,28 @@ function Add-TeamAccount { # Add the ValidateSet to the attributes collection $AttributeCollection.Add($ValidateSetAttribute) + $ParameterName2 = 'UseWindowsAuthentication' + + # Create the dictionary + $RuntimeParameterDictionary2 = New-Object System.Management.Automation.RuntimeDefinedParameterDictionary + + # Create the collection of attributes + $AttributeCollection2 = New-Object System.Collections.ObjectModel.Collection[System.Attribute] + + # Create and set the parameters' attributes + $ParameterAttribute2 = New-Object System.Management.Automation.ParameterAttribute + $ParameterAttribute2.Mandatory = $true + $ParameterAttribute2.ParameterSetName = "Windows" + $ParameterAttribute2.HelpMessage = "On Windows machines allows you to use the active user identity for authentication. Not available on other platforms." + + # Add the attributes to the attributes collection + $AttributeCollection2.Add($ParameterAttribute2) + # Create and return the dynamic parameter $RuntimeParameter = New-Object System.Management.Automation.RuntimeDefinedParameter($ParameterName, [string], $AttributeCollection) $RuntimeParameterDictionary.Add($ParameterName, $RuntimeParameter) + $RuntimeParameter2 = New-Object System.Management.Automation.RuntimeDefinedParameter($ParameterName2, [switch], $AttributeCollection2) + $RuntimeParameterDictionary.Add($ParameterName2, $RuntimeParameter2) return $RuntimeParameterDictionary } else { Write-Verbose 'Not on a Windows machine' @@ -98,15 +118,6 @@ function Add-TeamAccount { } process { - if ($PAT) { - # Convert the securestring to a normal string - # this was the one technique that worked on Mac, Linux and Windows - $credential = New-Object System.Management.Automation.PSCredential $account,$PAT - $_pat = $credential.GetNetworkCredential().Password - } else { - $_pat = $PersonalAccessToken - } - if(_isOnWindows) { # Bind the parameter to a friendly variable $Level = $PSBoundParameters[$ParameterName] @@ -114,9 +125,27 @@ function Add-TeamAccount { if(-not $Level) { $Level = "Process" } + + $UsingWindowsAuth = $PSBoundParameters[$ParameterName2] + if (!($PAT) -and !($PersonalAccessToken) -and !($UsingWindowsAuth)) { + Write-Error "Personal Access Token must be provided if you are not using Windows Authentication; please see the help." + } + } else { $Level = "Process" } + + + if ($PAT) { + # Convert the securestring to a normal string + # this was the one technique that worked on Mac, Linux and Windows + $credential = New-Object System.Management.Automation.PSCredential $account,$PAT + $_pat = $credential.GetNetworkCredential().Password + } else { + $_pat = $PersonalAccessToken + } + + # If they only gave an account name add visualstudio.com if($Account.ToLower().Contains('http') -eq $false) { @@ -125,9 +154,9 @@ function Add-TeamAccount { $encodedPat = [System.Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes(":$_pat")) - # If no PAT is entered, and on windows, assume we will be using default credentials for REST calls - if ((!$_pat) -and (_isOnWindows)) { - Write-Verbose "Using Default Windows Credentials for authentication; no Personal Access Token provided" + # If no PAT is entered, and on windows, are we using default credentials for REST calls + if ((!$_pat) -and (_isOnWindows) -and ($UsingWindowsAuth)) { + Write-Verbose "Using Default Windows Credentials for authentication; no Personal Access Token required" $encodedPat = "" } From 3953642cd081891d5c14afacfdd3e6e626a769d6 Mon Sep 17 00:00:00 2001 From: Andy Neillans Date: Sat, 4 Mar 2017 16:02:22 +0000 Subject: [PATCH 8/9] Added UseDefaultCredentials to remaining REST calls --- src/cloudSubscriptions.psm1 | 6 +++++- src/git.psm1 | 24 ++++++++++++++++++++---- src/queues.psm1 | 13 ++++++++++--- src/releases.psm1 | 30 +++++++++++++++++++++++++----- src/serviceendpoints.psm1 | 30 +++++++++++++++++++++++++----- 5 files changed, 85 insertions(+), 18 deletions(-) diff --git a/src/cloudSubscriptions.psm1 b/src/cloudSubscriptions.psm1 index cbc640358..cd9b945fb 100644 --- a/src/cloudSubscriptions.psm1 +++ b/src/cloudSubscriptions.psm1 @@ -32,7 +32,11 @@ function Get-CloudSubscription { $url = _buildURL # Call the REST API - $resp = Invoke-RestMethod -UserAgent (_getUserAgent) -Uri $url -Headers @{Authorization = "Basic $env:TEAM_PAT"} + if (_useWindowsAuthenticationOnPremise) { + $resp = Invoke-RestMethod -UserAgent (_getUserAgent) -Uri $url -UseDefaultCredentials + } else { + $resp = Invoke-RestMethod -UserAgent (_getUserAgent) -Uri $url -Headers @{Authorization = "Basic $env:TEAM_PAT"} + } # Apply a Type Name so we can use custom format view and custom type extensions foreach($item in $resp.value) { diff --git a/src/git.psm1 b/src/git.psm1 index 35ff48d09..d276fa95f 100644 --- a/src/git.psm1 +++ b/src/git.psm1 @@ -55,7 +55,11 @@ function Remove-GitRepository { if ($Force -or $pscmdlet.ShouldProcess($item, "Delete Repository")) { try { # Call the REST API - $resp = Invoke-RestMethod -UserAgent (_getUserAgent) -Method Delete -Uri $listurl -Headers @{Authorization = "Basic $env:TEAM_PAT"} + if (_useWindowsAuthenticationOnPremise) { + $resp = Invoke-RestMethod -UserAgent (_getUserAgent) -Method Delete -Uri $listurl -UseDefaultCredentials + } else { + $resp = Invoke-RestMethod -UserAgent (_getUserAgent) -Method Delete -Uri $listurl -Headers @{Authorization = "Basic $env:TEAM_PAT"} + } Write-Output "Deleted repository $item" } @@ -98,7 +102,11 @@ function Add-GitRepository { try { # Call the REST API - $resp = Invoke-RestMethod -UserAgent (_getUserAgent) -Method Post -ContentType "application/json" -Body $body -Uri $listurl -Headers @{Authorization = "Basic $env:TEAM_PAT"} + if (_useWindowsAuthenticationOnPremise) { + $resp = Invoke-RestMethod -UserAgent (_getUserAgent) -Method Post -ContentType "application/json" -Body $body -Uri $listurl -UseDefaultCredentials + } else { + $resp = Invoke-RestMethod -UserAgent (_getUserAgent) -Method Post -ContentType "application/json" -Body $body -Uri $listurl -Headers @{Authorization = "Basic $env:TEAM_PAT"} + } Write-Output $resp } @@ -138,7 +146,11 @@ function Get-GitRepository { $listurl = _buildURL -projectName $ProjectName -id $item # Call the REST API - $resp = Invoke-RestMethod -UserAgent (_getUserAgent) -Uri $listurl -Headers @{Authorization = "Basic $env:TEAM_PAT"} + if (_useWindowsAuthenticationOnPremise) { + $resp = Invoke-RestMethod -UserAgent (_getUserAgent) -Uri $listurl -UseDefaultCredentials + } else { + $resp = Invoke-RestMethod -UserAgent (_getUserAgent) -Uri $listurl -Headers @{Authorization = "Basic $env:TEAM_PAT"} + } _applyTypes -item $resp @@ -149,7 +161,11 @@ function Get-GitRepository { $listurl = _buildURL -projectName $ProjectName # Call the REST API - $resp = Invoke-RestMethod -UserAgent (_getUserAgent) -Uri $listurl -Headers @{Authorization = "Basic $env:TEAM_PAT"} + if (_useWindowsAuthenticationOnPremise) { + $resp = Invoke-RestMethod -UserAgent (_getUserAgent) -Uri $listurl -UseDefaultCredentials + } else { + $resp = Invoke-RestMethod -UserAgent (_getUserAgent) -Uri $listurl -Headers @{Authorization = "Basic $env:TEAM_PAT"} + } # Apply a Type Name so we can use custom format view and custom type extensions foreach($item in $resp.value) { diff --git a/src/queues.psm1 b/src/queues.psm1 index 5b8be9cfb..2416f0368 100644 --- a/src/queues.psm1 +++ b/src/queues.psm1 @@ -60,8 +60,11 @@ function Get-Queue { if($id) { # Build the url $url = _buildURL -projectName $projectName -id $id - - $resp = Invoke-RestMethod -UserAgent (_getUserAgent) -Uri $url -Headers @{Authorization = "Basic $env:TEAM_PAT"} + if (_useWindowsAuthenticationOnPremise) { + $resp = Invoke-RestMethod -UserAgent (_getUserAgent) -Uri $url -UseDefaultCredentials + } else { + $resp = Invoke-RestMethod -UserAgent (_getUserAgent) -Uri $url -Headers @{Authorization = "Basic $env:TEAM_PAT"} + } _applyTypes -item $resp @@ -80,7 +83,11 @@ function Get-Queue { } # Call the REST API - $resp = Invoke-RestMethod -UserAgent (_getUserAgent) -Uri $url -Headers @{Authorization = "Basic $env:TEAM_PAT"} + if (_useWindowsAuthenticationOnPremise) { + $resp = Invoke-RestMethod -UserAgent (_getUserAgent) -Uri $url -UseDefaultCredentials + } else { + $resp = Invoke-RestMethod -UserAgent (_getUserAgent) -Uri $url -Headers @{Authorization = "Basic $env:TEAM_PAT"} + } # Apply a Type Name so we can use custom format view and custom type extensions foreach($item in $resp.value) { diff --git a/src/releases.psm1 b/src/releases.psm1 index 7f8255763..cf5eed47d 100644 --- a/src/releases.psm1 +++ b/src/releases.psm1 @@ -76,7 +76,11 @@ function Get-Release { # Call the REST API Write-Debug 'Get-Release Call the REST API' - $resp = Invoke-RestMethod -UserAgent (_getUserAgent) -Uri $listurl -Headers @{Authorization = "Basic $env:TEAM_PAT"} + if (_useWindowsAuthenticationOnPremise) { + $resp = Invoke-RestMethod -UserAgent (_getUserAgent) -Uri $listurl -UseDefaultCredentials + } else { + $resp = Invoke-RestMethod -UserAgent (_getUserAgent) -Uri $listurl -Headers @{Authorization = "Basic $env:TEAM_PAT"} + } # Apply a Type Name so we can use custom format view and custom type extensions _applyTypes -item $resp @@ -97,7 +101,11 @@ function Get-Release { $listurl += _appendQueryString -name "continuationToken" -value $continuationToken # Call the REST API - $resp = Invoke-RestMethod -UserAgent (_getUserAgent) -Uri $listurl -Headers @{Authorization = "Basic $env:TEAM_PAT"} + if (_useWindowsAuthenticationOnPremise) { + $resp = Invoke-RestMethod -UserAgent (_getUserAgent) -Uri $listurl -UseDefaultCredentials + } else { + $resp = Invoke-RestMethod -UserAgent (_getUserAgent) -Uri $listurl -Headers @{Authorization = "Basic $env:TEAM_PAT"} + } # Apply a Type Name so we can use custom format view and custom type extensions foreach($item in $resp.value) { @@ -202,7 +210,11 @@ function Add-Release { try { Write-Debug 'Add-Release Call the REST API' - $resp = Invoke-RestMethod -UserAgent (_getUserAgent) -Method Post -Uri $url -ContentType "application/json" -Headers @{Authorization = "Basic $env:TEAM_PAT"} -Body $body + if (_useWindowsAuthenticationOnPremise) { + $resp = Invoke-RestMethod -UserAgent (_getUserAgent) -Method Post -Uri $url -ContentType "application/json" -UseDefaultCredentials -Body $body + } else { + $resp = Invoke-RestMethod -UserAgent (_getUserAgent) -Method Post -Uri $url -ContentType "application/json" -Headers @{Authorization = "Basic $env:TEAM_PAT"} -Body $body + } _applyTypes $resp @@ -243,7 +255,11 @@ function Remove-Release { try { # Call the REST API - $resp = Invoke-RestMethod -UserAgent (_getUserAgent) -Method Delete -Uri $listurl -Headers @{Authorization = "Basic $env:TEAM_PAT"} + if (_useWindowsAuthenticationOnPremise) { + $resp = Invoke-RestMethod -UserAgent (_getUserAgent) -Method Delete -Uri $listurl -UseDefaultCredentials + } else { + $resp = Invoke-RestMethod -UserAgent (_getUserAgent) -Method Delete -Uri $listurl -Headers @{Authorization = "Basic $env:TEAM_PAT"} + } Write-Output "Deleted release $item" } @@ -288,7 +304,11 @@ function Set-ReleaseStatus { try { # Call the REST API - $resp = Invoke-RestMethod -UserAgent (_getUserAgent) -Method Patch -Uri $listurl -ContentType "application/json" -Headers @{Authorization = "Basic $env:TEAM_PAT"} -Body $body + if (_useWindowsAuthenticationOnPremise) { + $resp = Invoke-RestMethod -UserAgent (_getUserAgent) -Method Patch -Uri $listurl -ContentType "application/json" -UseDefaultCredentials -Body $body + } else { + $resp = Invoke-RestMethod -UserAgent (_getUserAgent) -Method Patch -Uri $listurl -ContentType "application/json" -Headers @{Authorization = "Basic $env:TEAM_PAT"} -Body $body + } Write-Output "Release $item status changed to $status" } diff --git a/src/serviceendpoints.psm1 b/src/serviceendpoints.psm1 index 831739db9..e823da67e 100644 --- a/src/serviceendpoints.psm1 +++ b/src/serviceendpoints.psm1 @@ -61,7 +61,11 @@ function _checkStatus { ) # Call the REST API - $resp = Invoke-RestMethod -UserAgent (_getUserAgent) -Uri $uri -Headers @{Authorization = "Basic $env:TEAM_PAT"} + if (_useWindowsAuthenticationOnPremise) { + $resp = Invoke-RestMethod -UserAgent (_getUserAgent) -Uri $uri -UseDefaultCredentials + } else { + $resp = Invoke-RestMethod -UserAgent (_getUserAgent) -Uri $uri -Headers @{Authorization = "Basic $env:TEAM_PAT"} + } return $resp } @@ -117,7 +121,11 @@ function Remove-ServiceEndpoint { if ($Force -or $pscmdlet.ShouldProcess($item, "Delete Service Endpoint")) { # Call the REST API - Invoke-RestMethod -UserAgent (_getUserAgent) -Method Delete -Uri $url -Headers @{Authorization = "Basic $env:TEAM_PAT"} + if (_useWindowsAuthenticationOnPremise) { + Invoke-RestMethod -UserAgent (_getUserAgent) -Method Delete -Uri $url -UseDefaultCredentials + } else { + Invoke-RestMethod -UserAgent (_getUserAgent) -Method Delete -Uri $url -Headers @{Authorization = "Basic $env:TEAM_PAT"} + } Write-Output "Deleted service endpoint $item" } @@ -174,7 +182,11 @@ function Add-AzureRMServiceEndpoint { $body = $obj | ConvertTo-Json # Call the REST API - $resp = Invoke-RestMethod -UserAgent (_getUserAgent) -Method Post -Body $body -ContentType "application/json" -Uri $url -Headers @{Authorization = "Basic $env:TEAM_PAT"} + if (_useWindowsAuthenticationOnPremise) { + $resp = Invoke-RestMethod -UserAgent (_getUserAgent) -Method Post -Body $body -ContentType "application/json" -Uri $url -UseDefaultCredentials + } else { + $resp = Invoke-RestMethod -UserAgent (_getUserAgent) -Method Post -Body $body -ContentType "application/json" -Uri $url -Headers @{Authorization = "Basic $env:TEAM_PAT"} + } _trackProgress -projectName $projectName -resp $resp -title 'Creating Service Endpoint' -msg "Creating $endpointName" @@ -201,7 +213,11 @@ function Get-ServiceEndpoint { $url = _buildURL -projectName $projectName -id $id # Call the REST API - $resp = Invoke-RestMethod -UserAgent (_getUserAgent) -Uri $url -Headers @{Authorization = "Basic $env:TEAM_PAT"} + if (_useWindowsAuthenticationOnPremise) { + $resp = Invoke-RestMethod -UserAgent (_getUserAgent) -Uri $url -UseDefaultCredentials + } else { + $resp = Invoke-RestMethod -UserAgent (_getUserAgent) -Uri $url -Headers @{Authorization = "Basic $env:TEAM_PAT"} + } _applyTypes -item $resp @@ -211,7 +227,11 @@ function Get-ServiceEndpoint { $url = _buildURL -projectName $projectName # Call the REST API - $resp = Invoke-RestMethod -UserAgent (_getUserAgent) -Uri $url -Headers @{Authorization = "Basic $env:TEAM_PAT"} + if (_useWindowsAuthenticationOnPremise) { + $resp = Invoke-RestMethod -UserAgent (_getUserAgent) -Uri $url -UseDefaultCredentials + } else { + $resp = Invoke-RestMethod -UserAgent (_getUserAgent) -Uri $url -Headers @{Authorization = "Basic $env:TEAM_PAT"} + } # Apply a Type Name so we can use custom format view and custom type extensions foreach($item in $resp.value) { From cde2781c9527879b39fd3c6368f687f2ba3cc001 Mon Sep 17 00:00:00 2001 From: Donovan Brown Date: Sun, 5 Mar 2017 11:48:26 -0800 Subject: [PATCH 9/9] Added help for UseWindowsAuthentication Also updated version and readme. --- README.md | 15 ++++- Team.psd1 | Bin 10852 -> 10852 bytes en-US/Team-Help.xml | 137 ++++++++++++++++++++++---------------------- 3 files changed, 83 insertions(+), 69 deletions(-) diff --git a/README.md b/README.md index 1a6f02b8a..cbc731e8c 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,17 @@ # Team -Future home of PowerShell module for accessing TFS and VSTS +Home of PowerShell module for accessing TFS and VSTS +To get started you can visit this blog [PowerShell I would like you to meet TFS and VSTS](http://www.donovanbrown.com/post/PowerShell-I-would-like-you-to-meet-TFS-and-VSTS) + +# Contributors The cases of every file is very important. This module is to be used on Windows, Linux and OSx so case is important. If the casing does not match Linux and OSx might fail. -To get started you can visit this blog [PowerShell I would like you to meet TFS and VSTS](http://www.donovanbrown.com/post/PowerShell-I-would-like-you-to-meet-TFS-and-VSTS) +# Release Notes +## 0.1.15 +Merge [Pull Request](https://github.com/DarqueWarrior/team/pull/3) from [Andy Neillans](https://github.com/aneillans) which included the following: +- Corrected typos in help files. +- Refactored location of common methods. +- Implemented using DefaultCredentials when using TFS. This removes the need to create a PAT. + +## 0.1.14 +Initial Open Source release \ No newline at end of file diff --git a/Team.psd1 b/Team.psd1 index 8c91b8c866f260fddcb428fb3b427939f622f1fb..1aa7b6c2d595fd98379d6bcd6aafc34569836ab6 100644 GIT binary patch delta 14 VcmaD7@+4$K0u!U@=0qlD4FE6V1o{8~ delta 14 VcmaD7@+4$K0u!Uj=0qlD4FE6P1o;2} diff --git a/en-US/Team-Help.xml b/en-US/Team-Help.xml index b657ed432..a2da28ba5 100644 --- a/en-US/Team-Help.xml +++ b/en-US/Team-Help.xml @@ -3184,23 +3184,27 @@ http://localhost:8080/tfs/DefaultCollection String - + PAT A secured string to capture your personal access token. This will allow you to provide your personal access token without displaying it in plain text. -To use pat +To use pat simply omit it from the Add-TeamAccount command. SecureString + + - + Level - + On Windows allows you to store your account information at the Process, User or Machine levels. When saved at the User or Machine level your account information will be in any future PowerShell processes. String + + @@ -3225,21 +3229,23 @@ http://localhost:8080/tfs/DefaultCollection String - + Level - + On Windows allows you to store your account information at the Process, User or Machine levels. When saved at the User or Machine level your account information will be in any future PowerShell processes. String + + - - Add-TeamAccount - - Account - - + + Add-TeamAccount + + Account + + The Visual Studio Team Services (VSTS) account name to use. DO NOT enter the entire URL. Just the portion before visualstudio.com. For example in the following url mydemos is the account name. @@ -3247,19 +3253,21 @@ http://localhost:8080/tfs/DefaultCollection or The full Team Foundation Server (TFS) url including the collection. http://localhost:8080/tfs/DefaultCollection - - - String - - - - UseWindowsAuthentication - - - - - - + + + String + + + + UseWindowsAuthentication + + Allows the use of the current user's Windows credentials to authenticate against a local TFS. + + SwitchParameter + + + + @@ -3281,33 +3289,35 @@ http://localhost:8080/tfs/DefaultCollection - + PAT A secured string to capture your personal access token. This will allow you to provide your personal access token without displaying it in plain text. -To use pat +To use pat simply omit it from the Add-TeamAccount command. SecureString SecureString - + + - + Level - + On Windows allows you to store your account information at the Process, User or Machine levels. When saved at the User or Machine level your account information will be in any future PowerShell processes. String String - + + PersonalAccessToken @@ -3321,14 +3331,16 @@ To use pat - - - UseWindowsAuthentication - - - - - + + + UseWindowsAuthentication + + Allows the use of the current user's Windows credentials to authenticate against a local TFS. + + SwitchParameter + + + @@ -3352,16 +3364,16 @@ To use pat Allows you to provide all the information on the command line. - - -------------------------- EXAMPLE 3 -------------------------- - - PS C:\> - - Add-TeamAccount -Account http://localtfs:8080/tfs/DefaultCollection -UseWindowsAuthentication - - On Windows, allows you use to use Windows authentication against a local TFS server. - - + + -------------------------- EXAMPLE 3 -------------------------- + + PS C:\> + + Add-TeamAccount -Account http://localtfs:8080/tfs/DefaultCollection -UseWindowsAuthentication + + On Windows, allows you use to use Windows authentication against a local TFS server. + + @@ -4377,8 +4389,7 @@ the Pipeline by Property Name Name of the project to remove. String - - + Force @@ -4418,8 +4429,7 @@ the project. String - - + @@ -5029,8 +5039,7 @@ you do not have to pass the ProjectName with each call. Get all the repositories in your Visual Studio Team Services or Team Founcation Server account, or a specific project. - - + Get GitRepository @@ -5055,8 +5064,7 @@ You can use Set-DefaultProject to set a default project so you do not have to pass the ProjectName with each call. String - - + Id @@ -5066,8 +5074,7 @@ commas to separate the IDs. To find the ID of a repository, type Get-Repository. Guid[] - - + @@ -5089,8 +5096,7 @@ you do not have to pass the ProjectName with each call. String - - + Id @@ -5104,8 +5110,7 @@ Get-Repository. Int32[] - - + @@ -5183,8 +5188,7 @@ you do not have to pass the ProjectName with each call. Specifies the name of the repository. System.String - - + @@ -5218,8 +5222,7 @@ you do not have to pass the ProjectName with each call. Int32[] - - +