Gallery › SQL › Azure Landing Zones Library
SQL servers deploys a specific min TLS version requirement.
Converted Policy DeployIfNotExists Disabled Mode Indexed Version 1.2.0
Deploys a specific min TLS version requirement and enforce SSL on SQL servers. Enables secure server to client by enforce minimal Tls Version to secure the connection between your database server and your client applications helps protect against 'man in the middle' attacks by encrypting the data stream between the server and your application. This configuration enforces that SSL is always enabled for accessing your database server.
ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.
{
"name": "Deploy-SQL-minTLS",
"properties": {
"description": "Deploys a specific min TLS version requirement and enforce SSL on SQL servers. Enables secure server to client by enforce minimal Tls Version to secure the connection between your database server and your client applications helps protect against 'man in the middle' attacks by encrypting the data stream between the server and your application. This configuration enforces that SSL is always enabled for accessing your database server.",
"displayName": "SQL servers deploys a specific min TLS version requirement.",
"metadata": {
"alzCloudEnvironments": [
"AzureCloud",
"AzureChinaCloud",
"AzureUSGovernment"
],
"category": "SQL",
"source": "https://github.com/Azure/Enterprise-Scale/",
"version": "1.2.0"
},
"mode": "Indexed",
"parameters": {
"effect": {
"allowedValues": [
"DeployIfNotExists",
"Disabled"
],
"defaultValue": "DeployIfNotExists",
"metadata": {
"description": "Enable or disable the execution of the policy minimum TLS version SQL servers",
"displayName": "Effect SQL servers"
},
"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/servers",
"field": "type"
},
{
"field": "Microsoft.Sql/servers/minimalTlsVersion",
"less": "[parameters('minimalTlsVersion')]"
}
]
},
"then": {
"details": {
"deployment": {
"properties": {
"mode": "Incremental",
"parameters": {
"location": {
"value": "[field('location')]"
},
"minimalTlsVersion": {
"value": "[parameters('minimalTlsVersion')]"
},
"resourceName": {
"value": "[field('name')]"
}
},
"template": {
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"outputs": {},
"parameters": {
"location": {
"type": "String"
},
"minimalTlsVersion": {
"type": "String"
},
"resourceName": {
"type": "String"
}
},
"resources": [
{
"apiVersion": "2019-06-01-preview",
"location": "[parameters('location')]",
"name": "[concat(parameters('resourceName'))]",
"properties": {
"minimalTlsVersion": "[parameters('minimalTlsVersion')]"
},
"type": "Microsoft.Sql/servers"
}
],
"variables": {}
}
}
},
"existenceCondition": {
"allOf": [
{
"equals": "[parameters('minimalTlsVersion')]",
"field": "Microsoft.Sql/servers/minimalTlsVersion"
}
]
},
"name": "current",
"roleDefinitionIds": [
"/providers/microsoft.authorization/roleDefinitions/6d8ee4ec-f05a-4a1d-8b00-a9b17e38b437"
],
"type": "Microsoft.Sql/servers"
},
"effect": "[parameters('effect')]"
}
},
"policyType": "Custom"
},
"type": "Microsoft.Authorization/policyDefinitions"
}# Converted from Deploy-SQL-minTLS.alz_policy_definition.json by ConvertTo-Bylaw.
Policy 'Deploy-SQL-minTLS' {
Properties @{
DisplayName = 'SQL servers deploys a specific min TLS version requirement.'
Description = 'Deploys a specific min TLS version requirement and enforce SSL on SQL servers. Enables secure server to client by enforce minimal Tls Version to secure the connection between your database server and your client applications helps protect against ''man in the middle'' attacks by encrypting the data stream between the server and your application. This configuration enforces that SSL is always enabled for accessing your database server.'
Category = 'SQL'
Version = '1.2.0'
Mode = 'Indexed'
Metadata = [ordered]@{ alzCloudEnvironments = @('AzureCloud', 'AzureChinaCloud', 'AzureUSGovernment'); source = 'https://github.com/Azure/Enterprise-Scale/' }
}
Parameter Effect @{
AllowedValues = @('DeployIfNotExists', 'Disabled')
Default = 'DeployIfNotExists'
DisplayName = 'Effect SQL servers'
Description = 'Enable or disable the execution of the policy minimum TLS version SQL servers'
}
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/servers' {
Require 'minimalTlsVersion is at least the MinimalTlsVersion parameter' {
Field minimalTlsVersion | Must -BeGreaterOrEqual (Param MinimalTlsVersion) -IfPresent
}
}
DeployIfNotExists 'Microsoft.Sql/servers' -Role 'SQL Server Contributor' -Name 'current' -Effect (Param Effect) {
Require 'minimalTlsVersion is the MinimalTlsVersion parameter' {
Field minimalTlsVersion | Must -Be (Param MinimalTlsVersion)
}
Deployment -TemplateFile './templates/Deploy-SQL-minTLS.json' -Parameters ([ordered]@{
location = (Arm '[field(''location'')]')
minimalTlsVersion = (Param MinimalTlsVersion)
resourceName = (Arm '[field(''name'')]')
})
}
}Its deployment templates are written beside it:
templates/Deploy-SQL-minTLS.json
Source: policy_definitions/Deploy-SQL-minTLS.alz_policy_definition.json in Azure/Azure-Landing-Zones-Library, under the MIT licence.
Bylaw