Gallery › API Management › Azure Landing Zones Library
API Management services should use TLS version 1.2
Converted Policy Audit Deny Disabled Mode All Version 1.0.0
Azure API Management service should use TLS version 1.2
ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.
Azure Policy JSONDeny-APIM-TLS.alz_policy_definition.json · 68 lines
{
"name": "Deny-APIM-TLS",
"properties": {
"description": "Azure API Management service should use TLS version 1.2",
"displayName": "API Management services should use TLS version 1.2",
"metadata": {
"alzCloudEnvironments": [
"AzureCloud",
"AzureChinaCloud",
"AzureUSGovernment"
],
"category": "API Management",
"source": "https://github.com/Azure/Enterprise-Scale/",
"version": "1.0.0"
},
"mode": "All",
"parameters": {
"effect": {
"allowedValues": [
"Audit",
"Deny",
"Disabled"
],
"defaultValue": "Deny",
"metadata": {
"description": "Enable or disable the execution of the policy",
"displayName": "Effect"
},
"type": "String"
}
},
"policyRule": {
"if": {
"allOf": [
{
"equals": "Microsoft.ApiManagement/service",
"field": "type"
},
{
"anyOf": [
{
"greater": 0,
"value": "[indexof(toLower(string(field('Microsoft.ApiManagement/service/customProperties'))), '\"microsoft.windowsazure.apimanagement.gateway.security.protocols.tls10\":\"true\"')]"
},
{
"greater": 0,
"value": "[indexof(toLower(string(field('Microsoft.ApiManagement/service/customProperties'))), '\"microsoft.windowsazure.apimanagement.gateway.security.protocols.tls10\":true')]"
},
{
"greater": 0,
"value": "[indexof(toLower(string(field('Microsoft.ApiManagement/service/customProperties'))), '\"microsoft.windowsazure.apimanagement.gateway.security.protocols.tls11\":\"true\"')]"
},
{
"greater": 0,
"value": "[indexof(toLower(string(field('Microsoft.ApiManagement/service/customProperties'))), '\"microsoft.windowsazure.apimanagement.gateway.security.protocols.tls11\":true')]"
}
]
}
]
},
"then": {
"effect": "[parameters('effect')]"
}
},
"policyType": "Custom"
},
"type": "Microsoft.Authorization/policyDefinitions"
}BylawDeny-APIM-TLS.bylaw.ps1 · 40 lines
# Converted from Deny-APIM-TLS.alz_policy_definition.json by ConvertTo-Bylaw.
Policy 'Deny-APIM-TLS' {
Properties @{
DisplayName = 'API Management services should use TLS version 1.2'
Description = 'Azure API Management service should use TLS version 1.2'
Category = 'API Management'
Version = '1.0.0'
Mode = 'All'
Metadata = [ordered]@{ alzCloudEnvironments = @('AzureCloud', 'AzureChinaCloud', 'AzureUSGovernment'); source = 'https://github.com/Azure/Enterprise-Scale/' }
}
Parameter Effect @{
AllowedValues = @('Audit', 'Deny', 'Disabled')
Default = 'Deny'
DisplayName = 'Effect'
Description = 'Enable or disable the execution of the policy'
}
Resource 'Microsoft.ApiManagement/service' {
Require 'customProperties is as required' {
Arm '[indexof(toLower(string(field(''Microsoft.ApiManagement/service/customProperties''))), ''"microsoft.windowsazure.apimanagement.gateway.security.protocols.tls10":"true"'')]' | Must -BeLessOrEqual 0
}
Require 'customProperties is as required' {
Arm '[indexof(toLower(string(field(''Microsoft.ApiManagement/service/customProperties''))), ''"microsoft.windowsazure.apimanagement.gateway.security.protocols.tls10":true'')]' | Must -BeLessOrEqual 0
}
Require 'customProperties is as required' {
Arm '[indexof(toLower(string(field(''Microsoft.ApiManagement/service/customProperties''))), ''"microsoft.windowsazure.apimanagement.gateway.security.protocols.tls11":"true"'')]' | Must -BeLessOrEqual 0
}
Require 'customProperties is as required' {
Arm '[indexof(toLower(string(field(''Microsoft.ApiManagement/service/customProperties''))), ''"microsoft.windowsazure.apimanagement.gateway.security.protocols.tls11":true'')]' | Must -BeLessOrEqual 0
}
}
Effect (Param Effect)
}Source: policy_definitions/Deny-APIM-TLS.alz_policy_definition.json in Azure/Azure-Landing-Zones-Library, under the MIT licence.
Bylaw