Gallery › API Management › Azure built-in policies
API Management direct management endpoint should not be enabled
Converted Policy Audit Deny Disabled Mode All Version 1.0.2
The direct management REST API in Azure API Management bypasses Azure Resource Manager role-based access control, authorization, and throttling mechanisms, thus increasing the vulnerability of your service.
ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.
Azure Policy JSONDirectManagementAPIEnabled_AuditDeny.json · 50 lines
{
"properties": {
"displayName": "API Management direct management endpoint should not be enabled",
"policyType": "BuiltIn",
"mode": "All",
"description": "The direct management REST API in Azure API Management bypasses Azure Resource Manager role-based access control, authorization, and throttling mechanisms, thus increasing the vulnerability of your service.",
"metadata": {
"version": "1.0.2",
"category": "API Management"
},
"version": "1.0.2",
"policyRule": {
"if": {
"allOf": [
{
"field": "type",
"equals": "Microsoft.ApiManagement/service/tenant"
},
{
"field": "Microsoft.ApiManagement/service/tenant/enabled",
"equals": true
}
]
},
"then": {
"effect": "[parameters('effect')]"
}
},
"parameters": {
"effect": {
"type": "string",
"metadata": {
"displayName": "Effect",
"description": "Enable or disable the execution of the policy"
},
"allowedValues": [
"Audit",
"Disabled",
"Deny"
],
"defaultValue": "Audit"
}
},
"versions": [
"1.0.2"
]
},
"id": "/providers/Microsoft.Authorization/policyDefinitions/b741306c-968e-4b67-b916-5675e5c709f4",
"name": "b741306c-968e-4b67-b916-5675e5c709f4"
}Bylawb741306c-968e-4b67-b916-5675e5c709f4.bylaw.ps1 · 29 lines
# Converted from DirectManagementAPIEnabled_AuditDeny.json by ConvertTo-Bylaw.
Policy 'b741306c-968e-4b67-b916-5675e5c709f4' {
Properties @{
DisplayName = 'API Management direct management endpoint should not be enabled'
Description = 'The direct management REST API in Azure API Management bypasses Azure Resource Manager role-based access control, authorization, and throttling mechanisms, thus increasing the vulnerability of your service.'
Version = '1.0.2'
Category = 'API Management'
PolicyVersion = '1.0.2'
Mode = 'All'
}
Parameter Effect @{
Type = 'string'
AllowedValues = @('Audit', 'Disabled', 'Deny')
Default = 'Audit'
DisplayName = 'Effect'
Description = 'Enable or disable the execution of the policy'
}
Resource 'Microsoft.ApiManagement/service/tenant' {
Require 'enabled is not true' {
Field enabled | Must -Not -Be $true -IfPresent
}
}
Effect (Param Effect)
}Source: built-in-policies/policyDefinitions/API Management/DirectManagementAPIEnabled_AuditDeny.json in Azure/azure-policy, under the MIT licence.
Bylaw