Gallery › Logic Apps › Azure Landing Zones Library
Configure Logic apps to use the latest TLS version
Converted Policy DeployIfNotExists Disabled Mode Indexed Version 1.0.0
Periodically, newer versions are released for TLS either due to security flaws, include additional functionality, and enhance speed. Upgrade to the latest TLS version for Function apps to take advantage of security fixes, if any, and/or new functionalities of the latest version.
ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.
Azure Policy JSONDeploy-LogicApp-TLS.alz_policy_definition.json · 93 lines
{
"name": "Deploy-LogicApp-TLS",
"properties": {
"description": "Periodically, newer versions are released for TLS either due to security flaws, include additional functionality, and enhance speed. Upgrade to the latest TLS version for Function apps to take advantage of security fixes, if any, and/or new functionalities of the latest version.",
"displayName": "Configure Logic apps to use the latest TLS version",
"metadata": {
"alzCloudEnvironments": [
"AzureCloud",
"AzureChinaCloud",
"AzureUSGovernment"
],
"category": "Logic Apps",
"source": "https://github.com/Azure/Enterprise-Scale/",
"version": "1.0.0"
},
"mode": "Indexed",
"parameters": {
"effect": {
"allowedValues": [
"DeployIfNotExists",
"Disabled"
],
"defaultValue": "DeployIfNotExists",
"metadata": {
"description": "Enable or disable the execution of the policy",
"displayName": "Effect"
},
"type": "String"
}
},
"policyRule": {
"if": {
"allOf": [
{
"equals": "Microsoft.Web/sites",
"field": "type"
},
{
"contains": "workflowapp",
"field": "kind"
}
]
},
"then": {
"details": {
"deployment": {
"properties": {
"mode": "incremental",
"parameters": {
"siteName": {
"value": "[field('name')]"
}
},
"template": {
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"outputs": {},
"parameters": {
"siteName": {
"type": "string"
}
},
"resources": [
{
"apiVersion": "2021-02-01",
"name": "[concat(parameters('siteName'), '/web')]",
"properties": {
"minTlsVersion": "1.2"
},
"type": "Microsoft.Web/sites/config"
}
],
"variables": {}
}
}
},
"existenceCondition": {
"equals": "1.2",
"field": "Microsoft.Web/sites/config/minTlsVersion"
},
"name": "web",
"roleDefinitionIds": [
"/providers/microsoft.authorization/roleDefinitions/de139f84-1756-47ae-9be6-808fbbe84772"
],
"type": "Microsoft.Web/sites/config"
},
"effect": "[parameters('effect')]"
}
},
"policyType": "Custom"
},
"type": "Microsoft.Authorization/policyDefinitions"
}BylawDeploy-LogicApp-TLS.bylaw.ps1 · 35 lines
# Converted from Deploy-LogicApp-TLS.alz_policy_definition.json by ConvertTo-Bylaw.
Policy 'Deploy-LogicApp-TLS' {
Properties @{
DisplayName = 'Configure Logic apps to use the latest TLS version'
Description = 'Periodically, newer versions are released for TLS either due to security flaws, include additional functionality, and enhance speed. Upgrade to the latest TLS version for Function apps to take advantage of security fixes, if any, and/or new functionalities of the latest version.'
Category = 'Logic Apps'
Version = '1.0.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'
Description = 'Enable or disable the execution of the policy'
}
Resource 'Microsoft.Web/sites' {
Require 'kind does not contain workflowapp' {
Field kind | Must -Not -ContainText 'workflowapp' -IfPresent
}
}
DeployIfNotExists 'Microsoft.Web/sites/config' -Role 'Website Contributor' -Name 'web' -Effect (Param Effect) {
Require 'minTlsVersion is 1.2' {
Field minTlsVersion | Must -Be '1.2'
}
Deployment -TemplateFile './templates/Deploy-LogicApp-TLS.json' -Parameters ([ordered]@{
siteName = (Arm '[field(''name'')]')
})
}
}Its deployment templates are written beside it:
templates/Deploy-LogicApp-TLS.json
Source: policy_definitions/Deploy-LogicApp-TLS.alz_policy_definition.json in Azure/Azure-Landing-Zones-Library, under the MIT licence.
Bylaw