【问题标题】:Unauthorized error when uploading task to TFS将任务上传到 TFS 时出现未经授权的错误
【发布时间】:2017-05-18 16:04:48
【问题描述】:

我的 Windows 10 笔记本电脑中安装了 TFS 2015 Update 3,我正在尝试将自定义任务上传到 TFS。我已经安装了 Node.js 和 tfs-cli,但是当我尝试使用我的登录凭据上传我的任务时,我收到 401 Unauthorized 错误。

我使用的命令是

tfx build tasks upload –-task-path ./MyTask --auth-type basic
--username <user> --password <password> 
--service-url http://localhost:8080/tfs/defaultcollection

我已按照 TFS 其他帖子中的建议为 TFS 启用基本身份验证,但这似乎没有任何区别,

我得到的错误是

TFS Cross Platform Command Line Interface v0.4.5
Copyright Microsoft Corporation
error: Error: Failed Request: Unauthorized(401) - http://localhost:8080/tfs/defaultcollection/_apis/distributedtask

我的用户被配置为具有 TFS 的“高级”访问级别,但我需要添加其他权限吗?查看其他帖子,上面的命令看起来适用于 TFS2017,但我无法让它在 TFS 2015 上运行。

任何帮助将不胜感激。

【问题讨论】:

    标签: tfs


    【解决方案1】:

    对于 401 错误,首先请仔细检查您是否在此 tutorial 之后正确启用了基本身份验证。

    然后在对您的 TFS 服务器使用 tfx 时尝试在发出命令之前登录。

    输入以下登录命令:

    tfx login --auth-type basic
    
    1. 系统将提示您添加服务网址。
    2. 系统将提示您输入用户名。使用 domain\user(例如 fabrikam\彼得)。如果您在工作组机器上工作,请使用 machinename\user

      系统将提示您输入密码。输入您输入的用户名的密码。

    您现在可以使用任何其他 tfx 命令。

    > tfx login --auth-type basic
    Copyright Microsoft Corporation
    
    Enter service url > http://localhost:8080/tfs/defaultcollection
    Enter username > fabfiber\peter
    Enter password > *******
    logged in successfully
    

    更多详情请参考:Use the TFS Cross Platform Command Line with TFS using basic authentication

    此外,您需要是顶级代理池管理员 组 操作任务请参阅here 了解权限要求。

    【讨论】:

      猜你喜欢
      • 2014-06-25
      • 1970-01-01
      • 2023-03-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-03-08
      • 2018-03-25
      相关资源
      最近更新 更多