【发布时间】:2021-05-21 09:20:47
【问题描述】:
我正在尝试运行一个 shellscript 程序以使用 tfsapi 服务连接 tfs。
Jenkins 在登录用户上运行,但我想将 tfs 连接到不同的用户(而不是 Windows 登录用户)
如何向我的 powershell 代码添加凭据?我使用 UseDefaultCredentials 但需要使用不同的用户来连接 tfs。我该怎么做?
$tfsServerURL = "https://test.tfs.siemens.net/test"
$BuildDefinition = "test.rgs.project"
$URL = "$($tfsServerURL)"
#Get ID of Builddefinition
$buildDefinitionID = (Invoke-RestMethod -Uri ($URL + '/_apis/build/definitions?api-version=2.0&name=' + $BuildDefinition) -Method GET -UseDefaultCredentials).value.id
【问题讨论】:
标签: powershell api tfs