Bylaw

Gallery › App Service › Azure built-in policies

App Service Environment should be configured with strongest TLS Cipher suites

Converted Policy Audit Disabled Mode Indexed Version 1.0.0

The two most minimal and strongest cipher suites required for App Service Environment to function correctly are : TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 and TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256.

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

Azure Policy JSONHostingEnvironment_StrongestTLSCipher_Audit.json · 75 lines
{
  "properties": {
    "displayName": "App Service Environment should be configured with strongest TLS Cipher suites",
    "policyType": "BuiltIn",
    "mode": "Indexed",
    "description": "The two most minimal and strongest cipher suites required for App Service Environment to function correctly are : TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 and TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256.",
    "metadata": {
      "version": "1.0.0",
      "category": "App Service"
    },
    "version": "1.0.0",
    "parameters": {
      "effect": {
        "type": "string",
        "defaultValue": "Audit",
        "allowedValues": [
          "Audit",
          "Disabled"
        ],
        "metadata": {
          "displayName": "Effect",
          "description": "Enable or disable the execution of the policy"
        }
      }
    },
    "policyRule": {
      "if": {
        "allOf": [
          {
            "field": "kind",
            "like": "ASE*"
          },
          {
            "field": "type",
            "equals": "Microsoft.Web/hostingEnvironments"
          },
          {
            "count": {
              "field": "Microsoft.Web/HostingEnvironments/clusterSettings[*]",
              "where": {
                "allOf": [
                  {
                    "field": "Microsoft.Web/HostingEnvironments/clusterSettings[*].name",
                    "contains": "FrontEndSSLCipherSuiteOrder"
                  },
                  {
                    "field": "Microsoft.Web/HostingEnvironments/clusterSettings[*].value",
                    "contains": "TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384"
                  },
                  {
                    "field": "Microsoft.Web/HostingEnvironments/clusterSettings[*].value",
                    "contains": "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256"
                  },
                  {
                    "value": "[less(length(field('Microsoft.Web/HostingEnvironments/clusterSettings[*].value')), 80)]",
                    "equals": "true"
                  }
                ]
              }
            },
            "less": 1
          }
        ]
      },
      "then": {
        "effect": "[parameters('effect')]"
      }
    },
    "versions": [
      "1.0.0"
    ]
  },
  "id": "/providers/Microsoft.Authorization/policyDefinitions/817dcf37-e83d-4999-a472-644eada2ea1e",
  "name": "817dcf37-e83d-4999-a472-644eada2ea1e"
}
Bylaw817dcf37-e83d-4999-a472-644eada2ea1e.bylaw.ps1 · 38 lines
# Converted from HostingEnvironment_StrongestTLSCipher_Audit.json by ConvertTo-Bylaw.
Policy '817dcf37-e83d-4999-a472-644eada2ea1e' {

    Properties @{
        DisplayName   = 'App Service Environment should be configured with strongest TLS Cipher suites'
        Description   = 'The two most minimal and strongest cipher suites required for App Service Environment to function correctly are : TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 and TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256.'
        Version       = '1.0.0'
        Category      = 'App Service'
        PolicyVersion = '1.0.0'
        Mode          = 'Indexed'
    }

    Parameter Effect @{
        Type          = 'string'
        AllowedValues = @('Audit', '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, value and 1 more are as required' {
            Count 'clusterSettings[*]' -Where {
                Field name | Must -ContainText 'FrontEndSSLCipherSuiteOrder'
                Field value | Must -ContainText 'TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384'
                Field value | Must -ContainText 'TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256'
                Arm '[less(length(field(''Microsoft.Web/HostingEnvironments/clusterSettings[*].value'')), 80)]' | Must -Be 'true'
            } | Must -BeGreaterOrEqual 1
        }
    }

    Effect (Param Effect)
}

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