We have the same requirement. I created a custom policy with `deployIfNotExists' to activate ASC Standard tier as a prerequisite to activate needed Azure Defender components.
"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" : {}
}
}
}
}
}
But this doesn't work.
Reason for non-compliance
Current value must be equal to the target value.
Field
Microsoft.Security/pricings/pricingTier
Path
properties.pricingTier
Current value
"Free"
Target value
"Standard"
We have opened a corresponding ticket with Micrsoft but still haven't received any effective help from their end.
While opening the ticket, I received this article as a possible solution, hadn't found this before. Maybe it will help you.
https://techcommunity.microsoft.com/t5/azure-security-center/managing-security-center-at-scale-using-arm-templates-and-azure/ba-p/327761