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

如何修复使用Azure CLI创建Application Insight警报时的‘Scope can not be updated’错误

解决Azure中使用az monitor scheduled-query创建Application Insight警报时的"Scope can not be updated"错误
  • 确认操作类型:如果是新建警报,必须使用create子命令,不要误用update。错误常出现在误将新建操作写成更新,导致尝试修改不允许变更的scope参数。正确创建命令示例:

    az monitor scheduled-query create --name "你的警报名称" --resource-group "资源组名称" --scopes "/subscriptions/订阅ID/resourceGroups/资源组名称/providers/microsoft.insights/components/你的ApplicationInsights名称" --condition "count requests where success == false > 5" --description "请求失败警报" --severity 2
    
  • 若为更新现有警报,禁止修改scope参数:Azure计划查询警报创建后,关联的资源范围(scope)不支持变更。更新命令中需移除--scopes参数,仅修改允许变更的内容(如警报条件、描述等)。正确更新命令示例:

    az monitor scheduled-query update --name "你的警报名称" --resource-group "资源组名称" --condition "count requests where success == false > 10"
    
  • 校验scope参数格式:确保使用的是正确的Application Insights组件资源ID,可通过以下命令获取准确ID:

    az resource show --resource-group "资源组名称" --name "你的ApplicationInsights名称" --resource-type "microsoft.insights/components" --query id --output tsv
    

    直接复制输出结果作为--scopes参数值,避免手动输入错误。

  • 检查账户权限:执行命令的账户需拥有Monitoring Contributor或Owner权限,权限不足可能触发类似请求错误。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.08.22 23:06:09