Bylaw

Gallery › Event Grid › Azure built-in policies

Azure Event Grid domains 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 Event Grid domain 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 JSONDomains-TLS_Audit.json · 58 lines
{
  "properties": {
    "displayName": "Azure Event Grid domains 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 Event Grid domain 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": "Event Grid"
    },
    "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.EventGrid/domains"
          },
          {
            "anyOf": [
              {
                "field": "Microsoft.EventGrid/domains/minimumTlsVersionAllowed",
                "exists": "false"
              },
              {
                "field": "Microsoft.EventGrid/domains/minimumTlsVersionAllowed",
                "less": "1.2"
              }
            ]
          }
        ]
      },
      "then": {
        "effect": "[parameters('effect')]"
      }
    },
    "versions": [
      "1.0.0-PREVIEW"
    ]
  },
  "id": "/providers/Microsoft.Authorization/policyDefinitions/c089a722-0fbf-4a16-ab4f-1f5065291844",
  "name": "c089a722-0fbf-4a16-ab4f-1f5065291844"
}
Bylawc089a722-0fbf-4a16-ab4f-1f5065291844.bylaw.ps1 · 32 lines
# Converted from Domains-TLS_Audit.json by ConvertTo-Bylaw.
Policy 'c089a722-0fbf-4a16-ab4f-1f5065291844' {

    Properties @{
        DisplayName   = 'Azure Event Grid domains 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 Event Grid domain 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      = 'Event Grid'
        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.EventGrid/domains' {

        Require 'minimumTlsVersionAllowed exists' {
            Field minimumTlsVersionAllowed | Must -Exist
        }

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

    Effect (Param Effect)
}

Source: built-in-policies/policyDefinitions/Event Grid/Domains-TLS_Audit.json in Azure/azure-policy, under the MIT licence.