Gallery › Event Hub › Azure Landing Zones Library
Event Hub namespaces should use a valid TLS version
Converted Policy Audit Deny Disabled Mode All Version 1.1.2
Event Hub namespaces should use a valid TLS version.
ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.
Azure Policy JSONDeny-EH-minTLS.alz_policy_definition.json · 68 lines
{
"name": "Deny-EH-minTLS",
"properties": {
"description": "Event Hub namespaces should use a valid TLS version.",
"displayName": "Event Hub namespaces should use a valid TLS version",
"metadata": {
"alzCloudEnvironments": [
"AzureCloud",
"AzureChinaCloud",
"AzureUSGovernment"
],
"category": "Event Hub",
"source": "https://github.com/Azure/Enterprise-Scale/",
"version": "1.1.2"
},
"mode": "All",
"parameters": {
"effect": {
"allowedValues": [
"Audit",
"Deny",
"Disabled"
],
"defaultValue": "Deny",
"metadata": {
"description": "Enable or disable the execution of the policy",
"displayName": "Effect"
},
"type": "String"
},
"minTlsVersion": {
"defaultValue": "1.2",
"metadata": {
"description": "Minimum TLS version to be used by Event Hub",
"displayName": "Minimum TLS Version"
},
"type": "string"
}
},
"policyRule": {
"if": {
"allOf": [
{
"equals": "Microsoft.EventHub/namespaces",
"field": "type"
},
{
"anyOf": [
{
"field": "Microsoft.EventHub/namespaces/minimumTlsVersion",
"less": "[parameters('minTlsVersion')]"
},
{
"exists": "false",
"field": "Microsoft.EventHub/namespaces/minimumTlsVersion"
}
]
}
]
},
"then": {
"effect": "[parameters('effect')]"
}
},
"policyType": "Custom"
},
"type": "Microsoft.Authorization/policyDefinitions"
}BylawDeny-EH-minTLS.bylaw.ps1 · 38 lines
# Converted from Deny-EH-minTLS.alz_policy_definition.json by ConvertTo-Bylaw.
Policy 'Deny-EH-minTLS' {
Properties @{
DisplayName = 'Event Hub namespaces should use a valid TLS version'
Description = 'Event Hub namespaces should use a valid TLS version.'
Category = 'Event Hub'
Version = '1.1.2'
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 MinTlsVersion @{
Type = 'string'
Default = '1.2'
DisplayName = 'Minimum TLS Version'
Description = 'Minimum TLS version to be used by Event Hub'
}
Resource 'Microsoft.EventHub/namespaces' {
Require 'minimumTlsVersion is at least the MinTlsVersion parameter' {
Field minimumTlsVersion | Must -BeGreaterOrEqual (Param MinTlsVersion) -IfPresent
}
Require 'minimumTlsVersion exists' {
Field minimumTlsVersion | Must -Exist
}
}
Effect (Param Effect)
}Source: policy_definitions/Deny-EH-minTLS.alz_policy_definition.json in Azure/Azure-Landing-Zones-Library, under the MIT licence.
Bylaw