[英]Azure Devops Agent doesnt have permission to create a Service Endpoint (how do you allocate permissions)
As part of our release pipeline we're attempting to create a service endpoint using the rest api . 作为发布流程的一部分,我们尝试使用rest api创建服务端点 。 we're using a powershell script to call the endpoint. 我们正在使用Powershell脚本调用端点。 This script is run in a Powershell Pipeline Task. 该脚本在Powershell Pipeline Task中运行。
To call the endpoint, we use the oAuth token provided to the Agent via the variable ( $env:SYSTEM_ACCESSTOKEN
) 要调用端点,我们使用通过变量( $env:SYSTEM_ACCESSTOKEN
) 提供给代理的oAuth令牌。
by checking the agent configuration option: 通过检查代理配置选项:
Unfortunately, when the endpoint is called this token doesn't seem to have permission to create the service endpoint. 不幸的是,当端点被调用时,该令牌似乎没有创建服务端点的权限。 If i hard code my own PAT, this call succeeds. 如果我对自己的PAT进行硬编码,则此调用成功。
The Create Service Connection task is the powershell task that runs the script our powershell function Create-ServiceConnection from module file Vsts-ServiceConnection.psm1 创建服务连接任务是powershell任务,该任务运行脚本,该脚本来自模块文件Vsts-ServiceConnection.psm1我们的powershell函数Create-ServiceConnection。
The error message is very well descriptive but the difficulty is finding how do i allocate permissions that will be provided to the Agents oAuth token? 该错误消息具有很好的描述性,但困难在于查找如何分配将分配给代理oAuth令牌的权限?
UPDATE: 更新:
after finding this answer VSTS: Using System.AccessToken to create a service endpoint 找到此答案后VSTS:使用System.AccessToken创建服务端点
i added the permission to the "Project Collection Build Service" and it worked! 我将权限添加到“ Project Collection Build Service”中,并且它起作用了!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.