Bylaw

Gallery › App Service › Azure built-in policies

[Deprecated]: App Service app slots should enable outbound non-RFC 1918 traffic to Azure Virtual Network

Converted Policy AuditIfNotExists Disabled Mode Indexed Version 1.0.0-deprecated Deprecated

By default, if one uses regional Azure Virtual Network (VNET) integration, the app only routes RFC1918 traffic into that respective virtual network. Using the API to set 'vnetRouteAllEnabled' to true enables all outbound traffic into the Azure Virtual Network. This setting allows features like network security groups and user defined routes to be used for all outbound traffic from the App Service app.

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

Azure Policy JSONSlot_VnetRouteAllEnabled_Audit.json · 50 lines
{
  "properties": {
    "displayName": "[Deprecated]: App Service app slots should enable outbound non-RFC 1918 traffic to Azure Virtual Network",
    "policyType": "BuiltIn",
    "mode": "Indexed",
    "description": "By default, if one uses regional Azure Virtual Network (VNET) integration, the app only routes RFC1918 traffic into that respective virtual network. Using the API to set 'vnetRouteAllEnabled' to true enables all outbound traffic into the Azure Virtual Network. This setting allows features like network security groups and user defined routes to be used for all outbound traffic from the App Service app.",
    "metadata": {
      "version": "1.0.0-deprecated",
      "category": "App Service",
      "deprecated": true
    },
    "version": "1.0.0",
    "parameters": {
      "effect": {
        "type": "string",
        "defaultValue": "AuditIfNotExists",
        "allowedValues": [
          "AuditIfNotExists",
          "Disabled"
        ],
        "metadata": {
          "displayName": "Effect",
          "description": "Enable or disable the execution of the policy"
        }
      }
    },
    "policyRule": {
      "if": {
        "field": "type",
        "equals": "Microsoft.Web/sites/slots"
      },
      "then": {
        "effect": "[parameters('effect')]",
        "details": {
          "type": "Microsoft.Web/sites/slots/config",
          "name": "web",
          "existenceCondition": {
            "field": "Microsoft.Web/sites/slots/config/vnetRouteAllEnabled",
            "equals": "true"
          }
        }
      }
    },
    "versions": [
      "1.0.0"
    ]
  },
  "id": "/providers/Microsoft.Authorization/policyDefinitions/ab9ca4fc-5d29-4c62-bbad-018df1f5f0dd",
  "name": "ab9ca4fc-5d29-4c62-bbad-018df1f5f0dd"
}
Bylawab9ca4fc-5d29-4c62-bbad-018df1f5f0dd.bylaw.ps1 · 29 lines
# Converted from Slot_VnetRouteAllEnabled_Audit.json by ConvertTo-Bylaw.
Policy 'ab9ca4fc-5d29-4c62-bbad-018df1f5f0dd' {

    Properties @{
        DisplayName   = '[Deprecated]: App Service app slots should enable outbound non-RFC 1918 traffic to Azure Virtual Network'
        Description   = 'By default, if one uses regional Azure Virtual Network (VNET) integration, the app only routes RFC1918 traffic into that respective virtual network. Using the API to set ''vnetRouteAllEnabled'' to true enables all outbound traffic into the Azure Virtual Network. This setting allows features like network security groups and user defined routes to be used for all outbound traffic from the App Service app.'
        Version       = '1.0.0-deprecated'
        Category      = 'App Service'
        Deprecated    = $true
        PolicyVersion = '1.0.0'
        Mode          = 'Indexed'
    }

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

    Resource 'Microsoft.Web/sites/slots'

    AuditIfNotExists 'Microsoft.Web/sites/slots/config' -Name 'web' -Effect (Param Effect) {
        Require 'vnetRouteAllEnabled is true' {
            Field vnetRouteAllEnabled | Must -Be 'true'
        }
    }
}

Source: built-in-policies/policyDefinitions/App Service/Slot_VnetRouteAllEnabled_Audit.json in Azure/azure-policy, under the MIT licence.