Bylaw

Gallery › App Service › Azure built-in policies

[Deprecated]: Ensure WEB app is using the latest version of TLS encryption

Converted Policy AuditIfNotExists Disabled Mode Indexed Version 1.0.0-deprecated Deprecated

Please use /providers/Microsoft.Authorization/policyDefinitions/f0e6e85b-9b9f-4a4b-b67b-f730d42f1b0b instead. The TLS(Transport Layer Security) protocol secures transmission of data over the internet using standard encryption technology. Encryption should be set with the latest version of TLS. App service allows TLS 1.2 by default, which is the recommended TLS level by industry standards, such as PCI DSS.

ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.

Azure Policy JSONWebapp_Audit_Tls_Ver.json · 58 lines
{
  "properties": {
    "displayName": "[Deprecated]: Ensure WEB app is using the latest version of TLS encryption ",
    "policyType": "BuiltIn",
    "mode": "Indexed",
    "description": "Please use /providers/Microsoft.Authorization/policyDefinitions/f0e6e85b-9b9f-4a4b-b67b-f730d42f1b0b instead. The TLS(Transport Layer Security) protocol secures transmission of data over the internet using standard encryption technology. Encryption should be set with the latest version of TLS. App service allows TLS 1.2 by default, which is the recommended TLS level by industry standards, such as PCI DSS.",
    "metadata": {
      "version": "1.0.0-deprecated",
      "category": "App Service",
      "deprecated": true
    },
    "version": "1.0.0",
    "parameters": {
      "effect": {
        "type": "string",
        "defaultValue": "AuditIfNotExists",
        "allowedValues": [
          "AuditIfNotExists",
          "Disabled"
        ],
        "metadata": {
          "displayName": "Effect",
          "description": "Enable or disable the execution of the policy"
        }
      }
    },
    "policyRule": {
      "if": {
        "allOf": [
          {
            "field": "type",
            "equals": "Microsoft.Web/sites"
          },
          {
            "field": "kind",
            "like": "app*"
          }
        ]
      },
      "then": {
        "effect": "[parameters('effect')]",
        "details": {
          "type": "Microsoft.Web/sites/config",
          "name": "web",
          "existenceCondition": {
            "field": "Microsoft.Web/sites/config/web.minTlsVersion",
            "equals": "1.2"
          }
        }
      }
    },
    "versions": [
      "1.0.0"
    ]
  },
  "id": "/providers/Microsoft.Authorization/policyDefinitions/6ad61431-88ce-4357-a0e1-6da43f292bd7",
  "name": "6ad61431-88ce-4357-a0e1-6da43f292bd7"
}
Bylaw6ad61431-88ce-4357-a0e1-6da43f292bd7.bylaw.ps1 · 34 lines
# Converted from Webapp_Audit_Tls_Ver.json by ConvertTo-Bylaw.
Policy '6ad61431-88ce-4357-a0e1-6da43f292bd7' {

    Properties @{
        DisplayName   = '[Deprecated]: Ensure WEB app is using the latest version of TLS encryption '
        Description   = 'Please use /providers/Microsoft.Authorization/policyDefinitions/f0e6e85b-9b9f-4a4b-b67b-f730d42f1b0b instead. The TLS(Transport Layer Security) protocol secures transmission of data over the internet using standard encryption technology. Encryption should be set with the latest version of TLS. App service allows TLS 1.2 by default, which is the recommended TLS level by industry standards, such as PCI DSS.'
        Version       = '1.0.0-deprecated'
        Category      = 'App Service'
        Deprecated    = $true
        PolicyVersion = '1.0.0'
        Mode          = 'Indexed'
    }

    Parameter Effect @{
        Type          = 'string'
        AllowedValues = @('AuditIfNotExists', 'Disabled')
        Default       = 'AuditIfNotExists'
        DisplayName   = 'Effect'
        Description   = 'Enable or disable the execution of the policy'
    }

    Resource 'Microsoft.Web/sites' {

        Require 'kind is not like app*' {
            Field kind | Must -Not -BeLike 'app*' -IfPresent
        }
    }

    AuditIfNotExists 'Microsoft.Web/sites/config' -Name 'web' -Effect (Param Effect) {
        Require 'web.minTlsVersion is 1.2' {
            Field web.minTlsVersion | Must -Be '1.2'
        }
    }
}

Source: built-in-policies/policyDefinitions/App Service/Webapp_Audit_Tls_Ver.json in Azure/azure-policy, under the MIT licence.