Hi,
I'm creating custom policy (audit) and currently I have following policy rule
"policyRule": {
"if": {
"field": "Microsoft.Compute/virtualMachines/storageProfile.osDisk.osType",
"like": "Windows*"
},
"then": {
"effect": "[parameters('effect')]",
"details": {
"type": "Microsoft.Compute/virtualMachines/extensions",
"existenceCondition": {
"allOf": [
{
"field": "Microsoft.Compute/virtualMachines/extensions/publisher",
"equals": "Microsoft.Azure.AzureDefenderForServers"
},
{
"field": "Microsoft.Compute/virtualMachines/extensions/type",
"equals": "MDE.Windows"
},
{
"field": "Microsoft.Compute/virtualMachines/extensions/provisioningState",
"equals": "Succeeded"
}
]
}
}
}
}
but now this rule also contain Windows workstation but I would want only collect data from servers so could I use something like this instead?
"field": "Microsoft.Compute/virtualMachines/extended.instanceView.osName",
"like": "Windows Server*"
We have several servers that have been migrated so this can not be used because they have nothing under storageProfile.imageReference
"field": "Microsoft.Compute/imagePublisher",
"equals": "MicrosoftWindowsServer"