我们有同样的要求。我使用“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
路径属性.pricingTier
当前值“免费”
目标值“标准”
我们已经和微软开了相应的票,但仍然没有得到他们的任何有效帮助。打开票时,我收到了这篇文章作为可能的解决方案,以前没有发现过。也许它会帮助你。
https://techcommunity.microsoft.com/t5/azure-security-center/managing-security-center-at-scale-using-arm-templates-and-azure/ba-p/327761