Bylaw

Gallery › Mission › Azure built-in policies

App Service app slot configs should restrict default network access in Mission Platform products and services

Converted Policy Audit Deny Disabled Mode All Version 1.1.0

This policy applies exclusively to Mission Platform products and services; usage outside of these scopes is not supported. Configure App Service App Slot Configs to restrict default network access by setting IP Security Restrictions Default Action and SCM IP Security Restrictions Default Action to Deny.

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

Azure Policy JSONAppConfigSlotNetAccess_Audit.json · 59 lines
{
  "properties": {
    "displayName": "App Service app slot configs should restrict default network access in Mission Platform products and services",
    "policyType": "BuiltIn",
    "mode": "All",
    "description": "This policy applies exclusively to Mission Platform products and services; usage outside of these scopes is not supported. Configure App Service App Slot Configs to restrict default network access by setting IP Security Restrictions Default Action and SCM IP Security Restrictions Default Action to Deny.",
    "metadata": {
      "version": "1.1.0",
      "category": "Mission"
    },
    "version": "1.1.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/sites/slots/config"
          },
          {
            "anyOf": [
              {
                "field": "Microsoft.Web/sites/slots/config/ipSecurityRestrictionsDefaultAction",
                "equals": "Allow"
              },
              {
                "field": "Microsoft.Web/sites/slots/config/scmIpSecurityRestrictionsDefaultAction",
                "equals": "Allow"
              }
            ]
          }
        ]
      },
      "then": {
        "effect": "[parameters('effect')]"
      }
    },
    "versions": [
      "1.1.0",
      "1.0.0"
    ]
  },
  "id": "/providers/Microsoft.Authorization/policyDefinitions/21c2b371-0891-40a0-82e6-629defc1f36a",
  "name": "21c2b371-0891-40a0-82e6-629defc1f36a"
}
Bylaw21c2b371-0891-40a0-82e6-629defc1f36a.bylaw.ps1 · 32 lines
# Converted from AppConfigSlotNetAccess_Audit.json by ConvertTo-Bylaw.
Policy '21c2b371-0891-40a0-82e6-629defc1f36a' {

    Properties @{
        DisplayName   = 'App Service app slot configs should restrict default network access in Mission Platform products and services'
        Description   = 'This policy applies exclusively to Mission Platform products and services; usage outside of these scopes is not supported. Configure App Service App Slot Configs to restrict default network access by setting IP Security Restrictions Default Action and SCM IP Security Restrictions Default Action to Deny.'
        Version       = '1.1.0'
        Category      = 'Mission'
        PolicyVersion = '1.1.0'
        Mode          = 'All'
    }

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

    Resource 'Microsoft.Web/sites/slots/config' {

        Require 'ipSecurityRestrictionsDefaultAction is not Allow' {
            Field ipSecurityRestrictionsDefaultAction | Must -Not -Be 'Allow' -IfPresent
        }

        Require 'scmIpSecurityRestrictionsDefaultAction is not Allow' {
            Field scmIpSecurityRestrictionsDefaultAction | Must -Not -Be 'Allow' -IfPresent
        }
    }

    Effect (Param Effect)
}

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