Gallery › Network › Azure Landing Zones Library
Application Gateway should be deployed with predefined Microsoft policy that is using TLS version 1.2
Converted Policy Audit Deny Disabled Mode All Version 1.0.0
This policy enables you to restrict that Application Gateways is always deployed with predefined Microsoft policy that is using TLS version 1.2
ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.
Azure Policy JSONDeny-AppGw-Without-Tls.alz_policy_definition.json · 76 lines
{
"name": "Deny-AppGw-Without-Tls",
"properties": {
"description": "This policy enables you to restrict that Application Gateways is always deployed with predefined Microsoft policy that is using TLS version 1.2",
"displayName": "Application Gateway should be deployed with predefined Microsoft policy that is using TLS version 1.2",
"metadata": {
"alzCloudEnvironments": [
"AzureCloud",
"AzureChinaCloud",
"AzureUSGovernment"
],
"category": "Network",
"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"
},
"predefinedPolicyName": {
"defaultValue": [
"AppGwSslPolicy20220101",
"AppGwSslPolicy20170401S",
"AppGwSslPolicy20220101S"
],
"metadata": {
"description": "Predefined policy name",
"displayName": "Predefined policy name"
},
"type": "array"
}
},
"policyRule": {
"if": {
"allOf": [
{
"equals": "Microsoft.Network/applicationGateways",
"field": "type"
},
{
"anyOf": [
{
"field": "Microsoft.Network/applicationGateways/sslPolicy.policyType",
"notEquals": "Predefined"
},
{
"exists": "false",
"field": "Microsoft.Network/applicationGateways/sslPolicy.policyType"
},
{
"field": "Microsoft.Network/applicationGateways/sslPolicy.policyName",
"notIn": "[parameters('predefinedPolicyName')]"
}
]
}
]
},
"then": {
"effect": "[parameters('effect')]"
}
},
"policyType": "Custom"
},
"type": "Microsoft.Authorization/policyDefinitions"
}BylawDeny-AppGw-Without-Tls.bylaw.ps1 · 42 lines
# Converted from Deny-AppGw-Without-Tls.alz_policy_definition.json by ConvertTo-Bylaw.
Policy 'Deny-AppGw-Without-Tls' {
Properties @{
DisplayName = 'Application Gateway should be deployed with predefined Microsoft policy that is using TLS version 1.2'
Description = 'This policy enables you to restrict that Application Gateways is always deployed with predefined Microsoft policy that is using TLS version 1.2'
Category = 'Network'
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'
}
Parameter PredefinedPolicyName @{
Type = 'array'
Default = @('AppGwSslPolicy20220101', 'AppGwSslPolicy20170401S', 'AppGwSslPolicy20220101S')
DisplayName = 'Predefined policy name'
Description = 'Predefined policy name'
}
Resource 'Microsoft.Network/applicationGateways' {
Require 'sslPolicy.policyType is Predefined' {
Field sslPolicy.policyType | Must -Be 'Predefined'
}
Require 'sslPolicy.policyType exists' {
Field sslPolicy.policyType | Must -Exist
}
Require 'sslPolicy.policyName is one of the PredefinedPolicyName parameter' {
Field sslPolicy.policyName | Must -BeIn (Param PredefinedPolicyName)
}
}
Effect (Param Effect)
}Source: policy_definitions/Deny-AppGw-Without-Tls.alz_policy_definition.json in Azure/Azure-Landing-Zones-Library, under the MIT licence.
Bylaw