We're using Azure Policy to push out diagnostic settings for various PaaS solutions and running into some issues where we'd love to have one policy for 10+ regions and have them send logs to the regional log analytic workspace.
I know we could create 10+ policies and scope it to the specific regions, but I really don't want to have to maintain that many policies, therefore I'm hoping to add conditional logic to one policy and do it.
I've already done this for deploying the DCR rules by pulling variables from the VMs and then having logic within the policy. Therefore I assume it would be the same concept for diagnostic settings but I'm slightly concerned about the logic below and when it would check for that value vs. when my conditional logic would kick in.
{
"anyOf": [
{
"value": "[parameters('matchWorkspace')]",
"equals": false
},
{
"field": "Microsoft.Insights/diagnosticSettings/workspaceId",
"equals": "[parameters('logAnalytics')]"
}
]
}
The logic I'm using in my DCR rule is:
"variables": {
"dcrResourceType": "Microsoft.Insights/dataCollectionRules",
"workspaceLocale": {
"eastus": {
"dataCollectionRuleId": "/subscriptions/XXXXXX/resourceGroups/XXXXXX/providers/Microsoft.Insights/dataCollectionRules/LinuxCommonEventsEastUS",
"dcrassociationName": "LinuxCommonEventsEastUS"
},
"germanywestcentral": {
"dataCollectionRuleId": "/subscriptions/XXXXXX/resourceGroups/XXXXXX/providers/Microsoft.Insights/dataCollectionRules/LinuxCommonEventsGermany",
"dcrassociationName": "LinuxCommonEventsGermany"
}
}
Was just curious how other people are handling issues like this. I don't feel like MS does a very good job of supporting companies that are multi-region.
Thanks!