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

Azure API Management中用Bicep配置API出站策略时实体未找到

使用Bicep为API操作配置出站策略时遇到实体未找到错误

我在尝试用Bicep文件为API的指定操作配置出站策略时,收到以下验证错误:

"statusMessage": {
        "status": "Failed",
        "error": {
          "code": "ValidationError",
          "message": "Entity with specified identifier not found"
        }
      }

我使用的Bicep代码片段如下:

resource relationApiSym 'Microsoft.ApiManagement/service/apis@2022-08-01' existing = {
  name: relationsApi.name
  parent: apiManagementInstance
  resource operationRegisterId 'operations@2022-08-01' existing = {
    name : 'post-registerrelation-id'
    resource policyId 'policies@2022-08-01' = {
      name: 'policy'
      properties: {
        format: 'xml'
        value:'<policies>\r\n<inbound>\r\n<base />\r\n</inbound>\r\n<backend>\r\n<base />\r\n</backend>\r\n<outbound>\r\n<base />\r\n<choose>\r\n<when condition="@(context.Response.StatusCode == 200)">\r\n<set-body>@{var response = context.Response.Body.As&lt;JObject&gt;();foreach (var key in new [] {"RelatieId"}) {response.Property (key).Remove ();}return response.ToString();}\r\n</set-body>\r\n</when>\r\n</choose>\r\n</outbound>\r\n<on-error>\r\n<base />\r\n</on-error>\r\n</policies>'      
      }
    }
  }
}

我已确认目标操作名称post-register-relation-id确实存在,但查看部署日志的目标URL时,发现策略并未被创建:

部署日志片段

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.20 03:13:12