Bylaw

Gallery › Durable Task › Azure built-in policies

Durable Task schedulers should not allow open IP allowlists

Converted Policy Audit Deny Disabled Mode Indexed Version 1.0.0

Deny Durable Task schedulers that include 0.0.0.0/0 in their IP allowlist to prevent exposure to the public internet. Remove the open entry so that only trusted networks can reach the scheduler.

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

Azure Policy JSONDurableTaskSchedulerOpenIpAllowlist_AuditDeny.json · 56 lines
{
  "properties": {
    "displayName": "Durable Task schedulers should not allow open IP allowlists",
    "description": "Deny Durable Task schedulers that include 0.0.0.0/0 in their IP allowlist to prevent exposure to the public internet. Remove the open entry so that only trusted networks can reach the scheduler.",
    "policyType": "BuiltIn",
    "mode": "Indexed",
    "metadata": {
      "version": "1.0.0",
      "category": "Durable Task"
    },
    "version": "1.0.0",
    "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.DurableTask/schedulers"
          },
          {
            "count": {
              "field": "Microsoft.DurableTask/schedulers/ipAllowlist[*]",
              "where": {
                "field": "Microsoft.DurableTask/schedulers/ipAllowlist[*]",
                "equals": "0.0.0.0/0"
              }
            },
            "greater": 0
          }
        ]
      },
      "then": {
        "effect": "[parameters('effect')]"
      }
    },
    "versions": [
      "1.0.0"
    ]
  },
  "id": "/providers/Microsoft.Authorization/policyDefinitions/d82527a7-91cd-409f-b96e-049600b16b9e",
  "name": "d82527a7-91cd-409f-b96e-049600b16b9e"
}
Bylawd82527a7-91cd-409f-b96e-049600b16b9e.bylaw.ps1 · 30 lines
# Converted from DurableTaskSchedulerOpenIpAllowlist_AuditDeny.json by ConvertTo-Bylaw.
Policy 'd82527a7-91cd-409f-b96e-049600b16b9e' {

    Properties @{
        DisplayName   = 'Durable Task schedulers should not allow open IP allowlists'
        Description   = 'Deny Durable Task schedulers that include 0.0.0.0/0 in their IP allowlist to prevent exposure to the public internet. Remove the open entry so that only trusted networks can reach the scheduler.'
        Version       = '1.0.0'
        Category      = 'Durable Task'
        PolicyVersion = '1.0.0'
        Mode          = 'Indexed'
    }

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

    Resource 'Microsoft.DurableTask/schedulers' {

        Require 'ipAllowlist is as required' {
            Each 'ipAllowlist[*]' {
                Element | Must -Not -Be '0.0.0.0/0'
            }
        }
    }

    Effect (Param Effect)
}

Source: built-in-policies/policyDefinitions/Durable Task/DurableTaskSchedulerOpenIpAllowlist_AuditDeny.json in Azure/azure-policy, under the MIT licence.