You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何使用az devops invoke调用Azure DevOps Identities REST服务遇错求解

解决az devops invoke调用Azure DevOps Identities REST服务的问题

问题原因

  • 核心错误「The requested resource does not support http method 'GET'」由两个问题导致:
    • --resource参数指定错误:对应REST接口的/identities路径,需用复数Identities而非单数Identity
    • 未显式声明HTTP方法:az devops invoke默认使用POST请求,而该身份查询接口仅支持GET方法
  • 警告「The Azure DevOps Extension for the Azure CLI does not support Azure DevOps Server.」是因为原命令使用了IMS服务专用域名vssps.dev.azure.com,CLI扩展默认适配dev.azure.com,但该警告不影响功能执行

修正后的执行命令

az devops invoke `
--http-method GET `
--query-parameters searchFilter=General filterValue=$($identity_name) queryMembership=None `
--org "https://dev.azure.com/$orgName" `
--area IMS `
--resource Identities `
--api-version 7.1

关键说明

  • 将org地址改为dev.azure.com可消除上述警告
  • 确认$identity_name和$orgName变量已正确赋值
  • 修正后的命令完全匹配目标REST接口的调用逻辑,可正常返回查询结果

内容的提问来源于stack exchange,提问作者JDH

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.16 13:24:58