如何在TFS Build任务中获取代理用户功能? [英] How to get an agent user capability in TFS Build task?

查看:76
本文介绍了如何在TFS Build任务中获取代理用户功能?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在TFS 2015构建代理中声明了名为 MyCapability的用户功能,其路径为值。如何在构建任务的Powershell脚本中获得此值?

I've declared a user capability named "MyCapability" in a TFS 2015 build agent with a path as value. How can I get this value in the powershell script of my build task ?

$ env:MyCapability $ MyCapability 不起作用。

推荐答案

您无法从PowerShell访问功能

You cannot access the capabilities from PowerShell through a variable unfortunately.

您可以使用 Rest Client 连接回TFS并阅读Build Agent以及构建定义以读取配置的值。这将需要访问OAuth令牌,该令牌可以通过构建定义的配置页面上的复选框进行配置。

You could use the Rest Client to connect back to TFS and read the Build Agent as well as the Build Definition to read out the configured values. This will require access to the OAuth token, which can be configured through a checkbox on the Build Definition's configuration page.

这篇关于如何在TFS Build任务中获取代理用户功能?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆