Gallery › Sovereignty › Azure built-in policies
[Preview]: Log Analytics workspace replicas should use allowed locations
Converted Policy Audit Disabled Mode Indexed Version 1.0.0-preview Preview
Restrict the locations of Log Analytics workspace replicas to meet data residency and sovereignty requirements. A workspace with replication enabled is non-compliant when its replication location is missing or outside the allowed replica locations. Workspaces without replication enabled are compliant. The workspace's primary location is not evaluated.
ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.
Azure Policy JSONLogAnalyticsWorkspaceReplicaLocations_Audit.json · 62 lines
{
"properties": {
"displayName": "[Preview]: Log Analytics workspace replicas should use allowed locations",
"policyType": "BuiltIn",
"mode": "Indexed",
"description": "Restrict the locations of Log Analytics workspace replicas to meet data residency and sovereignty requirements. A workspace with replication enabled is non-compliant when its replication location is missing or outside the allowed replica locations. Workspaces without replication enabled are compliant. The workspace's primary location is not evaluated.",
"metadata": {
"version": "1.0.0-preview",
"category": "Sovereignty",
"preview": true
},
"version": "1.0.0-preview",
"parameters": {
"allowedReplicaLocations": {
"type": "Array",
"metadata": {
"displayName": "Allowed replica locations",
"description": "The list of locations where Log Analytics workspace replicas are allowed.",
"strongType": "location"
}
},
"effect": {
"type": "String",
"metadata": {
"displayName": "Effect",
"description": "Enable or disable the execution of the policy"
},
"allowedValues": [
"Audit",
"Disabled"
],
"defaultValue": "Audit"
}
},
"policyRule": {
"if": {
"allOf": [
{
"field": "type",
"equals": "Microsoft.OperationalInsights/workspaces"
},
{
"field": "Microsoft.OperationalInsights/workspaces/replication.enabled",
"equals": "true"
},
{
"value": "[if(empty(field('Microsoft.OperationalInsights/workspaces/replication.location')), '', replace(toLower(field('Microsoft.OperationalInsights/workspaces/replication.location')), ' ', ''))]",
"notIn": "[parameters('allowedReplicaLocations')]"
}
]
},
"then": {
"effect": "[parameters('effect')]"
}
},
"versions": [
"1.0.0-PREVIEW"
]
},
"id": "/providers/Microsoft.Authorization/policyDefinitions/1ab7fa8d-5574-4983-97ed-2a184ca9526e",
"name": "1ab7fa8d-5574-4983-97ed-2a184ca9526e"
}Bylaw1ab7fa8d-5574-4983-97ed-2a184ca9526e.bylaw.ps1 · 39 lines
# Converted from LogAnalyticsWorkspaceReplicaLocations_Audit.json by ConvertTo-Bylaw.
Policy '1ab7fa8d-5574-4983-97ed-2a184ca9526e' {
Properties @{
DisplayName = '[Preview]: Log Analytics workspace replicas should use allowed locations'
Description = 'Restrict the locations of Log Analytics workspace replicas to meet data residency and sovereignty requirements. A workspace with replication enabled is non-compliant when its replication location is missing or outside the allowed replica locations. Workspaces without replication enabled are compliant. The workspace''s primary location is not evaluated.'
Version = '1.0.0-preview'
Category = 'Sovereignty'
Preview = $true
PolicyVersion = '1.0.0-preview'
Mode = 'Indexed'
}
Parameter AllowedReplicaLocations @{
Type = 'Array'
DisplayName = 'Allowed replica locations'
Description = 'The list of locations where Log Analytics workspace replicas are allowed.'
Metadata = [ordered]@{ strongType = 'location' }
}
Parameter Effect @{
AllowedValues = @('Audit', 'Disabled')
Default = 'Audit'
DisplayName = 'Effect'
Description = 'Enable or disable the execution of the policy'
}
Resource 'Microsoft.OperationalInsights/workspaces' {
When {
Field replication.enabled | Must -Be 'true'
}
Require 'replication.location is as required' {
Arm '[if(empty(field(''Microsoft.OperationalInsights/workspaces/replication.location'')), '''', replace(toLower(field(''Microsoft.OperationalInsights/workspaces/replication.location'')), '' '', ''''))]' | Must -BeIn (Param AllowedReplicaLocations)
}
}
Effect (Param Effect)
}Source: built-in-policies/policyDefinitions/Sovereignty/LogAnalyticsWorkspaceReplicaLocations_Audit.json in Azure/azure-policy, under the MIT licence.
Bylaw