Bylaw

Gallery › Mission › Azure built-in policies

App Service Environment should have Control and Data Ports bound to ILB

Converted Policy Audit Deny Disabled Mode Indexed Version 1.0.0

This policy applies exclusively to Mission Platform products and services; usage outside of these scopes is not supported. Setting Internal Load Balancing Mode (ilbMode) to 'Web, Publishing' binds HTTP/HTTPS traffic on ports 80/443 and control/data channel ports for FTP to an ILB allocated Virtual Network Address.

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

Azure Policy JSONASERestrictILBMode_Audit.json · 50 lines
{
  "properties": {
    "displayName": "App Service Environment should have Control and Data Ports bound to ILB",
    "policyType": "BuiltIn",
    "mode": "Indexed",
    "description": "This policy applies exclusively to Mission Platform products and services; usage outside of these scopes is not supported. Setting Internal Load Balancing Mode (ilbMode) to 'Web, Publishing' binds HTTP/HTTPS traffic on ports 80/443 and control/data channel ports for FTP to an ILB allocated Virtual Network Address.",
    "metadata": {
      "version": "1.0.0",
      "category": "Mission"
    },
    "version": "1.0.0",
    "parameters": {
      "effect": {
        "type": "String",
        "metadata": {
          "displayName": "Effect",
          "description": "Enable or disable the execution of the policy"
        },
        "allowedValues": [
          "Audit",
          "Deny",
          "Disabled"
        ],
        "defaultValue": "Audit"
      }
    },
    "policyRule": {
      "if": {
        "allOf": [
          {
            "field": "type",
            "equals": "Microsoft.Web/hostingEnvironments"
          },
          {
            "field": "Microsoft.Web/hostingEnvironments/internalLoadBalancingMode",
            "notEquals": "Web, Publishing"
          }
        ]
      },
      "then": {
        "effect": "[parameters('effect')]"
      }
    },
    "versions": [
      "1.0.0"
    ]
  },
  "id": "/providers/Microsoft.Authorization/policyDefinitions/50d7880f-06c8-402f-9236-0417e5b1559c",
  "name": "50d7880f-06c8-402f-9236-0417e5b1559c"
}
Bylaw50d7880f-06c8-402f-9236-0417e5b1559c.bylaw.ps1 · 28 lines
# Converted from ASERestrictILBMode_Audit.json by ConvertTo-Bylaw.
Policy '50d7880f-06c8-402f-9236-0417e5b1559c' {

    Properties @{
        DisplayName   = 'App Service Environment should have Control and Data Ports bound to ILB'
        Description   = 'This policy applies exclusively to Mission Platform products and services; usage outside of these scopes is not supported. Setting Internal Load Balancing Mode (ilbMode) to ''Web, Publishing'' binds HTTP/HTTPS traffic on ports 80/443 and control/data channel ports for FTP to an ILB allocated Virtual Network Address.'
        Version       = '1.0.0'
        Category      = 'Mission'
        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.Web/hostingEnvironments' {

        Require 'internalLoadBalancingMode is Web, Publishing' {
            Field internalLoadBalancingMode | Must -Be 'Web, Publishing'
        }
    }

    Effect (Param Effect)
}

Source: built-in-policies/policyDefinitions/Mission/ASERestrictILBMode_Audit.json in Azure/azure-policy, under the MIT licence.