Gallery › Resilience › Azure built-in policies
[Preview]: API Management Service should be Zone Redundant
Converted Policy Audit Deny Disabled Mode Indexed Version 1.0.1-preview Preview
API Management Service can be configured to be Zone Redundant or not. An API Management Service is Zone Redundant if its sku name is 'Premium' and it has at least two entries in it's zones array. This policy identifies API Management Services lacking the redundancy needed to withstand a zone outage.
ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.
Azure Policy JSONApimanagement_Service_ZoneRedundant_Audit.json · 64 lines
{
"properties": {
"displayName": "[Preview]: API Management Service should be Zone Redundant",
"policyType": "BuiltIn",
"mode": "Indexed",
"description": "API Management Service can be configured to be Zone Redundant or not. An API Management Service is Zone Redundant if its sku name is 'Premium' and it has at least two entries in it's zones array. This policy identifies API Management Services lacking the redundancy needed to withstand a zone outage.",
"metadata": {
"category": "Resilience",
"version": "1.0.1-preview",
"preview": true
},
"version": "1.0.1-preview",
"parameters": {
"effect": {
"type": "String",
"metadata": {
"displayName": "Effect",
"description": "This parameter lets you choose the effect of the policy. If you choose Audit (default), the policy will only audit resources for compliance. If you choose Deny, the policy will deny the creation of non-compliant resources. If you choose Disabled, the policy will not enforce compliance (useful, for example, as a second assignment to ignore a subset of non-compliant resources in a single resource group)."
},
"allowedValues": [
"Audit",
"Deny",
"Disabled"
],
"defaultValue": "Audit"
}
},
"policyRule": {
"if": {
"allOf": [
{
"field": "type",
"equals": "Microsoft.ApiManagement/service"
},
{
"anyOf": [
{
"not": {
"field": "Microsoft.ApiManagement/service/sku.name",
"like": "Premium"
}
},
{
"count": {
"field": "Microsoft.ApiManagement/service/zones[*]"
},
"less": 2
}
]
}
]
},
"then": {
"effect": "[parameters('effect')]"
}
},
"versions": [
"1.0.1-PREVIEW",
"1.0.0-PREVIEW"
]
},
"id": "/providers/Microsoft.Authorization/policyDefinitions/42daa904-5969-47ef-92cb-b75df946195a",
"name": "42daa904-5969-47ef-92cb-b75df946195a"
}Bylaw42daa904-5969-47ef-92cb-b75df946195a.bylaw.ps1 · 33 lines
# Converted from Apimanagement_Service_ZoneRedundant_Audit.json by ConvertTo-Bylaw.
Policy '42daa904-5969-47ef-92cb-b75df946195a' {
Properties @{
DisplayName = '[Preview]: API Management Service should be Zone Redundant'
Description = 'API Management Service can be configured to be Zone Redundant or not. An API Management Service is Zone Redundant if its sku name is ''Premium'' and it has at least two entries in it''s zones array. This policy identifies API Management Services lacking the redundancy needed to withstand a zone outage.'
Category = 'Resilience'
Version = '1.0.1-preview'
Preview = $true
PolicyVersion = '1.0.1-preview'
Mode = 'Indexed'
}
Parameter Effect @{
AllowedValues = @('Audit', 'Deny', 'Disabled')
Default = 'Audit'
DisplayName = 'Effect'
Description = 'This parameter lets you choose the effect of the policy. If you choose Audit (default), the policy will only audit resources for compliance. If you choose Deny, the policy will deny the creation of non-compliant resources. If you choose Disabled, the policy will not enforce compliance (useful, for example, as a second assignment to ignore a subset of non-compliant resources in a single resource group).'
}
Resource 'Microsoft.ApiManagement/service' {
Require 'sku.name is like Premium' {
Field sku.name | Must -BeLike 'Premium'
}
Require 'zones is as required' {
Count 'zones[*]' | Must -BeGreaterOrEqual 2
}
}
Effect (Param Effect)
}Source: built-in-policies/policyDefinitions/Resilience/Apimanagement_Service_ZoneRedundant_Audit.json in Azure/azure-policy, under the MIT licence.
Bylaw