无法使用Powershell命令连接到TFS - get-tfsserver

时间:2017-03-31 11:03:13

标签: powershell azure-devops

我正在尝试使用Powershell命令连接到TFS:

$tfsCollectionPath = "https://xxx.visualstudio.com"

[string]$username = "xxxx@hotmail.com"
$password = ConvertTo-SecureString 'xxxxx' -AsPlainText -Force 
$credential = New-Object System.Management.Automation.PSCredential ($username, $password)

$tfs = get-tfsserver $tfsCollectionPath -credential $credential

然而,我收到以下错误

get-tfsserver : TF30063: You are not authorized to access https://xxxx.visualstudio.com

2 个答案:

答案 0 :(得分:0)

使用Personal Authentication Token作为密码。

答案 1 :(得分:0)

请参阅以下步骤:

  1. 打开Team Explorer并连接到您的VSTS
  2. 会提示对话框登录
  3. 输入您的用户名和密码>登录
  4. 成功登录后,您可以在PowerShell中使用Get-TfsServer命令(例如$ tfs = Get-TfsServer -Name“vsts url”)