简体   繁体   English

如何从内部部署TFS2015获取PAT

[英]How to get PAT from on-premise TFS2015

We want to migrate our custom steps from XAML build to new build task in TFS2015 on-premise. 我们希望将自定义步骤从XAML构建迁移到TFS2015内部部署的新构建任务。 I installed NodeJS and tfx-cli but when tfx-cli want to connect to TFS I need to provide pat (personal access token) but I cannot find where I can get it. 我安装了NodeJS和tfx-cli,但是当tfx-cli想要连接到TFS时,我需要提供pat(个人访问令牌),但我找不到我能得到它的地方。 All samples is for VSO but not for on-premise TFS2015. 所有样本均适用于VSO,但不适用于内部部署TFS2015。 Is it possible to get PAT from on-premise TFS2015? 是否可以从内部部署TFS2015获取PAT?

TFS 2015 doesn't support Personal Access Tokens, this feature was introduced with TFS 2017. In the mean time you'll either need to configure basic auth and use that (only enable basic auth if your TFS server is running over SSL), Or use the trick below to trick the command lien tools to authenticate by lettign an NTLM proxy (like Fiddler) handle the auth for you. TFS 2015不支持个人访问令牌,此功能是在TFS 2017中引入的。与此同时,您需要配置基本身份验证并使用它(如果您的TFS服务器通过SSL运行,则仅启用基本身份验证),或者使用下面的技巧欺骗命令lien工具通过lettign验证NTLM代理(如Fiddler)为您处理auth。

If you do not want to configure Basic Authentication on your TFS server (which many people don't want due to security concerns), then you can use a neat trick to let Fiddler handle your authentication: 如果您不想在TFS服务器上配置基本身份验证(许多人不希望出于安全考虑),那么您可以使用一个巧妙的技巧让Fiddler处理您的身份验证:

在此输入图像描述

Then enter: 然后输入:

C:\>set http_proxy=http://localhost:8888
C:\>tfx login --auth-type basic --service-url http://jessehouwing:8080/tfs/DefaultCollection

You'll be prompted for a username and a password, it doesn't really matter what you enter, fiddler will handle the authentication for you in the background: 系统会提示您输入用户名和密码,输入的内容并不重要,fiddler会在后台为您处理身份验证:

More detailed steps outlined on my blog . 我的博客上列出了更详细的步骤

If you're battling self-signed certificates, which is also a common problem when using tfx against a on-premise TFS server, make sure you're using a recent enough version of Node and point it to an aditional cert store using environment variables: 如果您正在与自签名证书作斗争,这也是在对内部部署TFS服务器使用tfx时的常见问题,请确保使用最新版本的Node并使用环境变量将其指向aditional证书库:

As of Node.js 7.3.0 (and the LTS versions 6.10.0 and 4.8.0) it is now possible to add extra well-known certificates to Node.js with an environment variable. 从Node.js 7.3.0(以及LTS版本6.10.0和4.8.0)开始,现在可以使用环境变量向Node.js添加额外的已知证书。 This can be useful in cloud or other deployment environments to add trusted certificates as a matter of policy (as opposed to explicit coding), or on personal machines, for example, to add the CAs for proxy servers. 这在云或其他部署环境中可用于添加可信证书作为策略(与显式编码相对),或在个人计算机上添加,例如,为代理服务器添加CA. See the CLI documentation for more information on using NODE_EXTRA_CA_CERTS, as well as the original pull-request. 有关使用NODE_EXTRA_CA_CERTS以及原始pull-request的更多信息,请参阅CLI文档。

NODE_EXTRA_CA_CERTS=file# NODE_EXTRA_CA_CERTS =文件#

Added in: v7.3.0 添加于:v7.3.0

When set, the well known "root" CAs (like VeriSign) will be extended with the extra certificates in file. 设置后,众所周知的“根”CA(如VeriSign)将使用文件中的额外证书进行扩展。 The file should consist of one or more trusted certificates in PEM format. 该文件应包含一个或多个PEM格式的可信证书。 A message will be emitted (once) with process.emitWarning() if the file is missing or malformed, but any errors are otherwise ignored. 如果文件丢失或格式错误,将使用process.emitWarning()发出一次消息(一次),否则将忽略任何错误。

Note that neither the well known nor extra certificates are used when the ca options property is explicitly specified for a TLS or HTTPS client or server. 请注意,在为TLS或HTTPS客户端或服务器显式指定ca options属性时,既不使用已知证书也不使用额外证书。

There's another option for tfx-cli to connect to the TFS instance, and it is basic authentication. tfx-cli还有另一个连接到TFS实例的选项,它是基本身份验证。 Just use the following format: 只需使用以下格式:

tfx login --auth-type basic --username myuser --password mypassword --service-url http://tfscollectionurl

Here is the quote from Github : 以下是Github的引用:

You can alternatively use basic auth by passing --auth-type basic (read Configuring Basic Auth ). 您也可以通过传递--auth-type basic (读取配置基本身份验证)来使用基本身份验证 NTLM will come soon. NTLM很快就会到来。

Note: Using this feature will store your login credentials on disk in plain text. 注意:使用此功能会以纯文本格式将登录凭据存储在磁盘上。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM