【问题标题】:Enable Azure Defender for all resource types using Azure Policies使用 Azure 策略为所有资源类型启用 Azure Defender
【发布时间】:2021-10-07 20:50:21
【问题描述】:

出于安全原因,我必须在 ASC 中为所有资源类型启用 Azure Defender。由于我们在 Azure 中确实有很多不同的订阅,而且数量还在增加,因此我们必须配置 Azure 策略来强制执行。

已经有一个为所有资源启用 Azure Defender 的选项,但我在文档中没有找到任何有用的信息来通过 Azure Policy 启用此功能。

我有两个符合我要求的解决方案。第一个是,我们为所有资源类型启用 Azure Defender,另一个是我们只启用特定的资源类型(对我来说,目前只有开源关系数据库的资源类型是相关的)。

我只发现了initiative that deploys the Azure Defender to the database server,,但它不会在我的 Azure 安全中心内激活该选项。 Microsoft 是否有任何其他文档可以完成此操作?

【问题讨论】:

    标签: azure-policy azure-security azure-defender


    【解决方案1】:

    我们有同样的要求。我使用“deployIfNotExists”创建了一个自定义策略,以激活 ASC 标准层作为激活所需 Azure Defender 组件的先决条件。

    "if" : {
      "allOf" : [
        {
          "field" : "type",
          "equals" : "Microsoft.Resources/subscriptions"
        }
      ]
    },
    "then" : {
      "effect" : "deployIfNotExists",
      "details" : {
        "type" : "Microsoft.Security/pricings",
        "deploymentScope" : "Subscription",
        "existenceScope" : "Subscription",
        "roleDefinitionIds" : [
          "/providers/Microsoft.Authorization/roleDefinitions/8e3af657-a8ff-443c-a75c-2fe8c4bcb635"
        ],
        "existenceCondition" : {
          "field" : "Microsoft.Security/pricings/pricingTier",
          "equals" : "Standard"
        },
        "deployment" : {
          "location" : "westeurope",
          "properties" : {
            "mode" : "incremental",
            "parameters" : {},
            "template" : {
              "$schema" : "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
              "contentVersion" : "1.0.0.0",
              "parameters" : {},
              "variables" : {},
              "resources" : [
                {
                  "type" : "Microsoft.Security/pricings",
                  "apiVersion" : "2017-08-01-preview",
                  "name" : "default",
                  "properties" : {
                    "pricingTier" : "Standard"
                  }
                },
                {
                  "type" : "Microsoft.Security/pricings",
                  "apiVersion" : "2018-06-01",
                  "name" : "AppServices",
                  "properties" : {
                    "pricingTier" : "Standard"
                  }
                },
                {
                  "type" : "Microsoft.Security/pricings",
                  "apiVersion" : "2018-06-01",
                  "name" : "ContainerRegistry",
                  "properties" : {
                    "pricingTier" : "Standard"
                  }
                },
                {
                  "type" : "Microsoft.Security/pricings",
                  "apiVersion" : "2018-06-01",
                  "name" : "KeyVaults",
                  "properties" : {
                    "pricingTier" : "Standard"
                  }
                },
                {
                  "type" : "Microsoft.Security/pricings",
                  "apiVersion" : "2018-06-01",
                  "name" : "KubernetesService",
                  "properties" : {
                    "pricingTier" : "Standard"
                  }
                },
                {
                  "type" : "Microsoft.Security/pricings",
                  "apiVersion" : "2018-06-01",
                  "name" : "SqlServers",
                  "properties" : {
                    "pricingTier" : "Standard"
                  }
                },
                {
                  "type" : "Microsoft.Security/pricings",
                  "apiVersion" : "2018-06-01",
                  "name" : "SqlServerVirtualMachines",
                  "properties" : {
                    "pricingTier" : "Standard"
                  }
                },
                {
                  "type" : "Microsoft.Security/pricings",
                  "apiVersion" : "2018-06-01",
                  "name" : "StorageAccounts",
                  "properties" : {
                    "pricingTier" : "Standard"
                  }
                },
                {
                  "type" : "Microsoft.Security/pricings",
                  "apiVersion" : "2018-06-01",
                  "name" : "VirtualMachines",
                  "properties" : {
                    "pricingTier" : "Standard"
                  }
                }
              ],
              "outputs" : {}
            }
          }
        }
      }
    }
    

    但这不起作用。

    不合规的原因 当前值必须等于目标值。

    字段 Microsoft.Security/pricings/pricingTier

    路径 properties.pricingTier

    当前值 “免费”

    目标值 “标准”

    我们已经和微软开了相应的票,但仍然没有得到他们的任何有效帮助。 打开票时,我收到了这篇文章作为可能的解决方案,以前没有发现过。也许对你有帮助。

    https://techcommunity.microsoft.com/t5/azure-security-center/managing-security-center-at-scale-using-arm-templates-and-azure/ba-p/327761

    【讨论】:

      【解决方案2】:

      Microsoft Defender for Cloud(Azure 安全中心)具有内置 Azure 策略来强制启用 Defender 计划。

      对于单个订阅,您可以使用“Microsoft Defender for X should be enabled”推荐中的“强制”选项,这将带您进入相关的策略创建页面:

      或通过Azure Policy portal,直接通过“配置 Azure Defender 以启用 ”策略在订阅或管理组范围上分配相同的策略。将此分配给“deployifnotexist”,它将强制执行 Defender 计划状态。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2020-07-23
        • 1970-01-01
        • 2020-05-07
        • 2020-01-21
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多