Gallery › Sovereignty › Azure built-in policies
[Preview]: Azure Event Hubs geo-replication locations should use allowed regions
Converted Policy Audit Disabled Mode Indexed Version 1.0.0-preview Preview
Restrict all Azure Event Hubs geo-replication locations, including primary and secondary regions, to approved regions to meet data residency and sovereignty requirements.
ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.
Azure Policy JSONEventHubsReplicaLocations_Audit.json · 64 lines
{
"properties": {
"displayName": "[Preview]: Azure Event Hubs geo-replication locations should use allowed regions",
"policyType": "BuiltIn",
"mode": "Indexed",
"description": "Restrict all Azure Event Hubs geo-replication locations, including primary and secondary regions, to approved regions to meet data residency and sovereignty requirements.",
"metadata": {
"version": "1.0.0-preview",
"category": "Sovereignty",
"preview": true
},
"version": "1.0.0-preview",
"parameters": {
"allowedGeoReplicationLocations": {
"type": "Array",
"metadata": {
"displayName": "Allowed geo-replication locations",
"description": "The list of locations where Azure Event Hubs data may be actively replicated.",
"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.EventHub/namespaces"
},
{
"count": {
"field": "Microsoft.EventHub/namespaces/geoDataReplication.locations[*]",
"where": {
"value": "[replace(toLower(current('Microsoft.EventHub/namespaces/geoDataReplication.locations[*].locationName')), ' ', '')]",
"notIn": "[parameters('allowedGeoReplicationLocations')]"
}
},
"greater": 0
}
]
},
"then": {
"effect": "[parameters('effect')]"
}
},
"versions": [
"1.0.0-PREVIEW"
]
},
"id": "/providers/Microsoft.Authorization/policyDefinitions/28db9b68-6637-453e-afc5-1dbb3b16df1b",
"name": "28db9b68-6637-453e-afc5-1dbb3b16df1b"
}Bylaw28db9b68-6637-453e-afc5-1dbb3b16df1b.bylaw.ps1 · 37 lines
# Converted from EventHubsReplicaLocations_Audit.json by ConvertTo-Bylaw.
Policy '28db9b68-6637-453e-afc5-1dbb3b16df1b' {
Properties @{
DisplayName = '[Preview]: Azure Event Hubs geo-replication locations should use allowed regions'
Description = 'Restrict all Azure Event Hubs geo-replication locations, including primary and secondary regions, to approved regions to meet data residency and sovereignty requirements.'
Version = '1.0.0-preview'
Category = 'Sovereignty'
Preview = $true
PolicyVersion = '1.0.0-preview'
Mode = 'Indexed'
}
Parameter AllowedGeoReplicationLocations @{
Type = 'Array'
DisplayName = 'Allowed geo-replication locations'
Description = 'The list of locations where Azure Event Hubs data may be actively replicated.'
Metadata = [ordered]@{ strongType = 'location' }
}
Parameter Effect @{
AllowedValues = @('Audit', 'Disabled')
Default = 'Audit'
DisplayName = 'Effect'
Description = 'Enable or disable the execution of the policy'
}
Resource 'Microsoft.EventHub/namespaces' {
Require 'geoDataReplication.locations is as required' {
Count 'geoDataReplication.locations[*]' -Where {
Arm '[replace(toLower(current(''Microsoft.EventHub/namespaces/geoDataReplication.locations[*].locationName'')), '' '', '''')]' | Must -Not -BeIn (Param AllowedGeoReplicationLocations)
} | Must -Be 0
}
}
Effect (Param Effect)
}Source: built-in-policies/policyDefinitions/Sovereignty/EventHubsReplicaLocations_Audit.json in Azure/azure-policy, under the MIT licence.
Bylaw