Bylaw

Gallery › App Service › Azure built-in policies

App Service Environment should have TLS 1.0 and 1.1 disabled

Converted Policy Audit Deny Disabled Mode Indexed Version 2.0.1

TLS 1.0 and 1.1 are out-of-date protocols that do not support modern cryptographic algorithms. Disabling inbound TLS 1.0 and 1.1 traffic helps secure apps in an App Service Environment.

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

Azure Policy JSONHostingEnvironment_DisableTls_Audit.json · 68 lines
{
  "properties": {
    "displayName": "App Service Environment should have TLS 1.0 and 1.1 disabled",
    "policyType": "BuiltIn",
    "mode": "Indexed",
    "description": "TLS 1.0 and 1.1 are out-of-date protocols that do not support modern cryptographic algorithms. Disabling inbound TLS 1.0 and 1.1 traffic helps secure apps in an App Service Environment.",
    "metadata": {
      "version": "2.0.1",
      "category": "App Service"
    },
    "version": "2.0.1",
    "parameters": {
      "effect": {
        "type": "string",
        "defaultValue": "Audit",
        "allowedValues": [
          "Audit",
          "Deny",
          "Disabled"
        ],
        "metadata": {
          "displayName": "Effect",
          "description": "Enable or disable the execution of the policy"
        }
      }
    },
    "policyRule": {
      "if": {
        "allOf": [
          {
            "field": "type",
            "equals": "Microsoft.Web/hostingEnvironments"
          },
          {
            "field": "kind",
            "like": "ASE*"
          },
          {
            "count": {
              "field": "Microsoft.Web/HostingEnvironments/clusterSettings[*]",
              "where": {
                "allOf": [
                  {
                    "field": "Microsoft.Web/HostingEnvironments/clusterSettings[*].name",
                    "equals": "DisableTls1.0"
                  },
                  {
                    "field": "Microsoft.Web/HostingEnvironments/clusterSettings[*].value",
                    "equals": "1"
                  }
                ]
              }
            },
            "less": 1
          }
        ]
      },
      "then": {
        "effect": "[parameters('effect')]"
      }
    },
    "versions": [
      "2.0.1"
    ]
  },
  "id": "/providers/Microsoft.Authorization/policyDefinitions/d6545c6b-dd9d-4265-91e6-0b451e2f1c50",
  "name": "d6545c6b-dd9d-4265-91e6-0b451e2f1c50"
}
Bylawd6545c6b-dd9d-4265-91e6-0b451e2f1c50.bylaw.ps1 · 36 lines
# Converted from HostingEnvironment_DisableTls_Audit.json by ConvertTo-Bylaw.
Policy 'd6545c6b-dd9d-4265-91e6-0b451e2f1c50' {

    Properties @{
        DisplayName   = 'App Service Environment should have TLS 1.0 and 1.1 disabled'
        Description   = 'TLS 1.0 and 1.1 are out-of-date protocols that do not support modern cryptographic algorithms. Disabling inbound TLS 1.0 and 1.1 traffic helps secure apps in an App Service Environment.'
        Version       = '2.0.1'
        Category      = 'App Service'
        PolicyVersion = '2.0.1'
        Mode          = 'Indexed'
    }

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

    Resource 'Microsoft.Web/hostingEnvironments' {

        When {
            Field kind | Must -BeLike 'ASE*'
        }

        Require 'clusterSettings, name and value are as required' {
            Count 'clusterSettings[*]' -Where {
                Field name | Must -Be 'DisableTls1.0'
                Field value | Must -Be '1'
            } | Must -BeGreaterOrEqual 1
        }
    }

    Effect (Param Effect)
}

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