即使我拥有足够的权限,为什么我仍无法访问VSTS Analytics API服务 [英] Why can't I access the VSTS analytics API service even though I have sufficient permissions

查看:62
本文介绍了即使我拥有足够的权限,为什么我仍无法访问VSTS Analytics API服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试从私有代理通过Powershell脚本调用Analytics API,并且收到以下错误响应: [error]Invoke-RestMethod : {"error":{"code":"0","message":"Using this service requires \"View Analytics\" permission on

I try to make a call from a powershell script to the analytics API from my private agent, and I get the following error response: [error]Invoke-RestMethod : {"error":{"code":"0","message":"Using this service requires \"View Analytics\" permission on

我检查了查看分析"的安全设置,并显示允许".

I checked my security settings for "View analytics" and it says 'Allow'.

我为我的私人代理设置的PAT启用了所有作用域.

The PAT I've set my private agent up with has all scopes enabled.

我可以使用另一个具有基本授权的PAT通过Postman访问此API.

I can access this API through Postman using another PAT with authorization Basic.

此外,如果我将Powershell脚本中的标头从以下位置更改:

Also, if I change my header in my powershell script from:

$header =  @{Authorization = "Bearer $env:SYSTEM_ACCESSTOKEN"}

收件人:

$header =  @{Authorization = "Basic <hard coded base64 encoded string used in the header for my Postman queries>"}

有效.

问题:发生了什么事?

推荐答案

System_Accesstoken是在构建/发行过程中动态生成的令牌,不是您用于配置代理的令牌.

The System_Accesstoken is the token that generated dynamically during the build/release, it isn’t the token that you used to configure the agent.

您用于配置代理的令牌仅用于代理的初始配置.

The token that you used to configure agent is used only for the initial configuration of the agent.

向服务帐户授予构建/发布权限:

To grant the permission to the service account for build/release:

  1. 转到团队项目的安全性页面
  2. 在过滤器用户和组搜索框中键入project collection build service,然后选择Project Collection build Service (xxx)用户(非组)
  3. View analytics设置为允许.
  1. Go to security page of the team project
  2. Type project collection build service in filter users and groups search box and select Project Collection build Service (xxx) user (not group)
  3. Set View analytics to allow.

这篇关于即使我拥有足够的权限,为什么我仍无法访问VSTS Analytics API服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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