Gallery › Sovereignty › Azure built-in policies
[Preview]: Azure API Management additional gateway locations should use allowed locations
Converted Policy Audit Disabled Mode Indexed Version 1.0.0-preview Preview
Restrict Azure API Management additional gateway locations to approved regions to meet data residency and sovereignty requirements. This policy evaluates secondary multi-region deployments and does not evaluate the service's primary location.
ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.
Azure Policy JSONAPIManagementReplicaLocations_Audit.json · 64 lines
{
"properties": {
"displayName": "[Preview]: Azure API Management additional gateway locations should use allowed locations",
"policyType": "BuiltIn",
"mode": "Indexed",
"description": "Restrict Azure API Management additional gateway locations to approved regions to meet data residency and sovereignty requirements. This policy evaluates secondary multi-region deployments and does not evaluate the service's primary location.",
"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 Azure API Management additional gateways 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.ApiManagement/service"
},
{
"count": {
"field": "Microsoft.ApiManagement/service/additionalLocations[*]",
"where": {
"value": "[replace(toLower(current('Microsoft.ApiManagement/service/additionalLocations[*].location')), ' ', '')]",
"notIn": "[parameters('allowedReplicaLocations')]"
}
},
"greater": 0
}
]
},
"then": {
"effect": "[parameters('effect')]"
}
},
"versions": [
"1.0.0-PREVIEW"
]
},
"id": "/providers/Microsoft.Authorization/policyDefinitions/a2713d30-18dc-48a3-8e2f-0966c2133989",
"name": "a2713d30-18dc-48a3-8e2f-0966c2133989"
}Bylawa2713d30-18dc-48a3-8e2f-0966c2133989.bylaw.ps1 · 37 lines
# Converted from APIManagementReplicaLocations_Audit.json by ConvertTo-Bylaw.
Policy 'a2713d30-18dc-48a3-8e2f-0966c2133989' {
Properties @{
DisplayName = '[Preview]: Azure API Management additional gateway locations should use allowed locations'
Description = 'Restrict Azure API Management additional gateway locations to approved regions to meet data residency and sovereignty requirements. This policy evaluates secondary multi-region deployments and does not evaluate the service''s primary location.'
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 Azure API Management additional gateways 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.ApiManagement/service' {
Require 'additionalLocations is as required' {
Count 'additionalLocations[*]' -Where {
Arm '[replace(toLower(current(''Microsoft.ApiManagement/service/additionalLocations[*].location'')), '' '', '''')]' | Must -Not -BeIn (Param AllowedReplicaLocations)
} | Must -Be 0
}
}
Effect (Param Effect)
}Source: built-in-policies/policyDefinitions/Sovereignty/APIManagementReplicaLocations_Audit.json in Azure/azure-policy, under the MIT licence.
Bylaw