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

如何无需订阅级,在资源级别为Azure App Service启用Microsoft Defender for Cloud?

关于仅在资源级别为App Service启用Microsoft Defender for Cloud的说明

核心结论

Microsoft Defender for Cloud的App Service防护不支持直接在单个资源级别启用,必须先在订阅级别开启AppServices定价层,之后可通过配置「排除资源」的方式,仅让指定的App Service实例获得防护。你遇到的InvalidUrlConfiguration错误,正是因为该防护计划不支持资源级定价配置。

实现步骤(订阅级开启+资源级筛选)

1. 订阅级别开启App Service防护

GUI操作

  • 登录Azure门户,进入「Microsoft Defender for Cloud」>「环境设置」
  • 选择目标订阅,点击「定价」
  • 在「应用服务」行,将定价层设置为「标准」,点击「保存」

CLI操作

执行以下Azure CLI命令:

az security pricing create -n AppServices --tier Standard --subscription <你的订阅ID>

REST API操作

发送PUT请求到以下地址:

https://management.azure.com/subscriptions/<你的订阅ID>/providers/Microsoft.Security/pricings/AppServices?api-version=2024-01-01

请求体:

{
  "properties": {
    "pricingTier": "Standard"
  }
}

2. 仅让指定App Service获得防护(排除其他资源)

完成订阅级开启后,通过排除不需要防护的App Service,实现仅特定资源启用防护的效果:

GUI操作

  • 在「Microsoft Defender for Cloud」>「环境设置」> 目标订阅 >「定价」
  • 点击「应用服务」行的「配置」
  • 在「排除的资源」标签下,添加不需要防护的App Service实例,点击「保存」

CLI操作

使用以下命令排除指定资源:

az security pricing update -n AppServices --subscription <你的订阅ID> --add properties.exclusions scope=/subscriptions/<订阅ID>/resourceGroups/<资源组>/providers/Microsoft.Web/sites/<不需要的App Service名称>

REST API操作

发送PUT请求更新定价配置:

https://management.azure.com/subscriptions/<你的订阅ID>/providers/Microsoft.Security/pricings/AppServices?api-version=2024-01-01

请求体(包含排除列表):

{
  "properties": {
    "pricingTier": "Standard",
    "exclusions": [
      {
        "scope": "/subscriptions/<订阅ID>/resourceGroups/<资源组>/providers/Microsoft.Web/sites/<不需要的App Service名称>"
      }
    ]
  }
}

关于之前API调用的说明

你尝试的资源级定价API路径仅适用于部分支持资源级防护的服务(比如你成功配置的VM),但App Service防护并不支持这种模式,因此会返回InvalidUrlConfiguration错误。调用{scopeId}/providers/Microsoft.Security/pricings返回空数组,也说明该资源级别下没有可配置的定价计划。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.06.23 06:36:02