简体   繁体   English

TFS在目标计算机上构建“ PowerShell”步骤失败:如何调试?

[英]TFS Build “PowerShell on Target Machines” Step Fails: How to debug?

I'm trying to automate the deployment of the solution my team is working on through TFS Build server. 我正在尝试通过TFS Build服务器自动化团队正在研究的解决方案的部署。 One of the steps which executes a PowerShell script on the target machine fails with the following error: 在目标计算机上执行PowerShell脚本的步骤之一失败,并显示以下错误:

Microsoft ODBC Driver 11 for SQL Server : Login failed for user 'sa'..

The PowerShell script I'm trying to execute does in fact connect to multiple databases using the sa credentials. 实际上,我尝试执行的PowerShell脚本确实使用sa凭据连接到多个数据库。 When I try to execute the same script passing it the exact same arguments by hand (ie: executing the script from the target machine VM itself) it works like a charm. 当我尝试执行相同的脚本并通过手工传递完全相同的参数(即:从目标计算机VM本身执行脚本)时,它就像一个符咒。 But when it is being executed as part of the build steps it fails with the aforementioned error. 但是,当将其作为构建步骤的一部分执行时,它会因上述错误而失败。

Is there a way to further debug the issue? 有没有办法进一步调试问题? It would be great if there is a way to output trace statements from the script so I could have some insight on what is actually going on. 如果有一种方法可以从脚本输出跟踪语句,那将很好,这样我就可以对实际发生的事情有一些了解。

Usually all the related error should reflect in TFS build log. 通常,所有相关错误应反映在TFS构建日志中。 To narrow your issue you can try to connect to the TFS build agent with the credentials used for the build service and manually run the ps script. 要缩小问题的范围,您可以尝试使用用于构建服务的凭据连接到TFS构建代理然后手动运行ps脚本。

If you execute the ps script with your own account, which will not help to the issue. 如果您使用自己的帐户执行ps脚本,则无济于事。 Usually this kind of problems is related to permissions. 通常,这类问题与权限有关。 Your build service account are lack of related permission. 您的构建服务帐户缺少相关权限。 Try to add it to Administrator or SQL Administrator group and execute the build again. 尝试将其添加到Administrator或SQL Administrator组,然后再次执行构建。

暂无
暂无

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

相关问题 目标机器上的 PowerShell 在 TFS 2018 发布管道中失败 - PowerShell on Target Machines Fails in TFS 2018 Release Pipeline “目标计算机上的 PowerShell”任务失败,并在 TFS 2017\Azure Dev Ops 中出现错误 - “PowerShell on Target Machines” task fails with an error in TFS 2017\Azure Dev Ops 针对不同AD域中的计算机的TFS“目标计算机上的Powershell”任务 - TFS 'Powershell on Target Machines' task for machines in different AD domain 使用PowerShell从构建步骤访问TFS TeamProjectCollection - Access TFS TeamProjectCollection from build step with PowerShell TFS vNext Powershell构建步骤正在使用旧版本的Powershell模块 - TFS vNext Powershell build step is using older version of Powershell module 如何在TFS Build Definition中获取PowerShell脚本任务,以便与x64 MSBuild步骤配合使用? - How to get PowerShell Script Task in TFS Build Definition to play nice with x64 MSBuild step? TFS构建powershell脚本步骤:无法访问$(Date:yyyyMMdd)变量 - TFS build powershell script step : Not able to access $(Date:yyyyMMdd) variable TFS中的Robocopy构建PowerShell步骤报告失败但没有错误 - Robocopy in TFS Build PowerShell Step Reports Failure But Has No Error 使用PS环境变量的TFS 2015构建步骤失败 - TFS 2015 Build Step using PS environment variables fails 目标计算机上的 PowerShell -TFS 任务,在远程服务器中更改执行策略后安全警告仍然存在 - PowerShell on Target Machines -TFS task, Security Warning persists after changing execution policy in remote server
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM