Gallery › SQL › Azure Landing Zones Library
SQL Managed Instance should have the minimal TLS version set to the highest version
Converted Policy Audit Deny Disabled Mode Indexed Version 1.1.0
Setting minimal TLS version to 1.2 improves security by ensuring your SQL Managed Instance can only be accessed from clients using TLS 1.2. Using versions of TLS less than 1.2 is not recommended since they have well documented security vulnerabilities.
ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.
Azure Policy JSONDeny-SqlMi-minTLS.alz_policy_definition.json · 73 lines
{
"name": "Deny-SqlMi-minTLS",
"properties": {
"description": "Setting minimal TLS version to 1.2 improves security by ensuring your SQL Managed Instance can only be accessed from clients using TLS 1.2. Using versions of TLS less than 1.2 is not recommended since they have well documented security vulnerabilities.",
"displayName": "SQL Managed Instance should have the minimal TLS version set to the highest version",
"metadata": {
"alzCloudEnvironments": [
"AzureCloud",
"AzureChinaCloud",
"AzureUSGovernment"
],
"category": "SQL",
"source": "https://github.com/Azure/Enterprise-Scale/",
"version": "1.1.0"
},
"mode": "Indexed",
"parameters": {
"effect": {
"allowedValues": [
"Audit",
"Disabled",
"Deny"
],
"defaultValue": "Audit",
"metadata": {
"description": "Enable or disable the execution of the policy",
"displayName": "Effect"
},
"type": "String"
},
"minimalTlsVersion": {
"allowedValues": [
"1.2",
"1.1",
"1.0"
],
"defaultValue": "1.2",
"metadata": {
"description": "Select version minimum TLS version SQL servers to enforce",
"displayName": "Select version for SQL server"
},
"type": "String"
}
},
"policyRule": {
"if": {
"allOf": [
{
"equals": "Microsoft.Sql/managedInstances",
"field": "type"
},
{
"anyOf": [
{
"exists": "false",
"field": "Microsoft.Sql/managedInstances/minimalTlsVersion"
},
{
"field": "Microsoft.Sql/managedInstances/minimalTlsVersion",
"less": "[parameters('minimalTlsVersion')]"
}
]
}
]
},
"then": {
"effect": "[parameters('effect')]"
}
},
"policyType": "Custom"
},
"type": "Microsoft.Authorization/policyDefinitions"
}BylawDeny-SqlMi-minTLS.bylaw.ps1 · 38 lines
# Converted from Deny-SqlMi-minTLS.alz_policy_definition.json by ConvertTo-Bylaw.
Policy 'Deny-SqlMi-minTLS' {
Properties @{
DisplayName = 'SQL Managed Instance should have the minimal TLS version set to the highest version'
Description = 'Setting minimal TLS version to 1.2 improves security by ensuring your SQL Managed Instance can only be accessed from clients using TLS 1.2. Using versions of TLS less than 1.2 is not recommended since they have well documented security vulnerabilities.'
Category = 'SQL'
Version = '1.1.0'
Mode = 'Indexed'
Metadata = [ordered]@{ alzCloudEnvironments = @('AzureCloud', 'AzureChinaCloud', 'AzureUSGovernment'); source = 'https://github.com/Azure/Enterprise-Scale/' }
}
Parameter Effect @{
AllowedValues = @('Audit', 'Disabled', 'Deny')
Default = 'Audit'
DisplayName = 'Effect'
Description = 'Enable or disable the execution of the policy'
}
Parameter MinimalTlsVersion @{
AllowedValues = @('1.2', '1.1', '1.0')
Default = '1.2'
DisplayName = 'Select version for SQL server'
Description = 'Select version minimum TLS version SQL servers to enforce'
}
Resource 'Microsoft.Sql/managedInstances' {
Require 'minimalTlsVersion exists' {
Field minimalTlsVersion | Must -Exist
}
Require 'minimalTlsVersion is at least the MinimalTlsVersion parameter' {
Field minimalTlsVersion | Must -BeGreaterOrEqual (Param MinimalTlsVersion) -IfPresent
}
}
Effect (Param Effect)
}Source: policy_definitions/Deny-SqlMi-minTLS.alz_policy_definition.json in Azure/Azure-Landing-Zones-Library, under the MIT licence.
Bylaw