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

部署Application Insights智能检测警报时遇区域注册错误求助

解决西欧区域部署Smart Detector警报规则的订阅注册错误

错误原因

你遇到的错误是由于Azure订阅未在西欧(westeurope)区域注册microsoft.alertsManagement资源提供商,导致无法创建smartDetectorAlertRules类型的警报资源。

解决步骤

1. 注册microsoft.alertsManagement资源提供商

你需要在订阅层面完成该资源提供商的注册,操作方式如下:

  • Azure CLI方式:
    执行以下命令(注册过程需1-5分钟,命令会等待注册完成):
    az provider register --namespace microsoft.alertsManagement --wait
    
  • Azure门户方式:
    1. 登录Azure门户,搜索并进入目标订阅
    2. 左侧菜单选择「资源提供商」,在列表中找到microsoft.alertsManagement
    3. 若状态为「未注册」,点击「注册」按钮;已注册则跳过此步骤

2. 修正ARM模板中的区域配置

你的模板里location: regionId存在变量未定义的问题,建议直接继承资源组的区域,避免手动指定错误:
将模板中的location字段修改为:

location: resourceGroup().location

同时补充模板缺失的appName、memorySeverity参数定义,修正后的完整模板示例如下:

@description('Resource Group for the action group')
param actionGroupResourceGroup string = resourceGroup().name

@description('Name of the Action group for alerting.')
param actionGroupName string

@description('Name of the target Application Insights resource')
param appName string

@description('Severity level for the memory leak alert (S0-S4)')
param memorySeverity string = 'S2'

@description('Reference to the target Application Insights resource')
resource applicationInsights 'microsoft.insights/components@2020-02-02' existing = {
  name: appName
}

@description('Set name for the memory leak alert rule.')
var memoryLeakAlertRuleName = 'Potential Memory Leak - ${appName}'

@description('Set action group id.')
var actionGroupId = '/subscriptions/${subscription().subscriptionId}/resourceGroups/${actionGroupResourceGroup}/providers/microsoft.insights/ActionGroups/${actionGroupName}'

// Create a memory leak detection alert
resource memoryLeakAlertRule 'microsoft.alertsManagement/smartDetectorAlertRules@2021-04-01' = {
  name: memoryLeakAlertRuleName
  location: resourceGroup().location
  properties: {
    description: 'Potential Memory Leak notifies you of increased memory consumption pattern by your app which may indicate a potential memory leak.'
    scope: [
      applicationInsights.id
    ]
    actionGroups: {
      groupIds: [
        actionGroupId
      ]
    }
    detector: {
      id: 'MemoryLeakDetector'
    }
    frequency: 'PT24H'
    severity: memorySeverity
    state: 'isEnabled'
  }
}

3. 重新部署模板

完成提供商注册和模板修正后,重新执行部署操作即可正常创建智能检测警报规则。

内容的提问来源于stack exchange,提问作者Jennifer M.

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.08.05 21:01:53