Bylaw

Gallery › Network › Azure built-in policies

Azure Cache for Redis should be running TLS version 1.2 or newer

Converted Policy Audit Deny Disabled Mode Indexed Version 1.0.0-preview

Setting the minimum TLS version to 1.2 or newer improves security by ensuring your Azure Cache for Redis can only be accessed from clients using TLS 1.2 or newer. Using versions of TLS less than 1.2 is not recommended since they have well documented security vulnerabilities.

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

Azure Policy JSONRedis-TLS_Audit.json · 54 lines
{
  "properties": {
    "displayName": "Azure Cache for Redis should be running TLS version 1.2 or newer",
    "policyType": "BuiltIn",
    "mode": "Indexed",
    "description": "Setting the minimum TLS version to 1.2 or newer improves security by ensuring your Azure Cache for Redis can only be accessed from clients using TLS 1.2 or newer. Using versions of TLS less than 1.2 is not recommended since they have well documented security vulnerabilities.",
    "metadata": {
      "version": "1.0.0-preview",
      "category": "Network"
    },
    "version": "1.0.0-preview",
    "parameters": {
      "effect": {
        "type": "String",
        "metadata": {
          "displayName": "Effect",
          "description": "The effect determines what happens when the policy rule is evaluated to match"
        },
        "allowedValues": [
          "Audit",
          "Deny",
          "Disabled"
        ],
        "defaultValue": "Audit"
      }
    },
    "policyRule": {
      "if": {
        "allOf": [
          {
            "field": "type",
            "equals": "Microsoft.Cache/redis"
          },
          {
            "field": "Microsoft.Cache/redis/minimumTlsVersion",
            "exists": "true"
          },
          {
            "field": "Microsoft.Cache/redis/minimumTlsVersion",
            "less": "1.2"
          }
        ]
      },
      "then": {
        "effect": "[parameters('effect')]"
      }
    },
    "versions": [
      "1.0.0-PREVIEW"
    ]
  },
  "id": "/providers/Microsoft.Authorization/policyDefinitions/f38646be-b908-491a-bc9b-fd507154f709",
  "name": "f38646be-b908-491a-bc9b-fd507154f709"
}
Bylawf38646be-b908-491a-bc9b-fd507154f709.bylaw.ps1 · 32 lines
# Converted from Redis-TLS_Audit.json by ConvertTo-Bylaw.
Policy 'f38646be-b908-491a-bc9b-fd507154f709' {

    Properties @{
        DisplayName   = 'Azure Cache for Redis should be running TLS version 1.2 or newer'
        Description   = 'Setting the minimum TLS version to 1.2 or newer improves security by ensuring your Azure Cache for Redis can only be accessed from clients using TLS 1.2 or newer. Using versions of TLS less than 1.2 is not recommended since they have well documented security vulnerabilities.'
        Version       = '1.0.0-preview'
        Category      = 'Network'
        PolicyVersion = '1.0.0-preview'
        Mode          = 'Indexed'
    }

    Parameter Effect @{
        AllowedValues = @('Audit', 'Deny', 'Disabled')
        Default       = 'Audit'
        DisplayName   = 'Effect'
        Description   = 'The effect determines what happens when the policy rule is evaluated to match'
    }

    Resource 'Microsoft.Cache/redis' {

        When {
            Field minimumTlsVersion | Must -Exist
        }

        Require 'minimumTlsVersion is at least 1.2' {
            Field minimumTlsVersion | Must -BeGreaterOrEqual '1.2' -IfPresent
        }
    }

    Effect (Param Effect)
}

Source: built-in-policies/policyDefinitions/Network/Redis-TLS_Audit.json in Azure/azure-policy, under the MIT licence.