last sync: 2020-Jul-10 14:05:01 UTC

Azure Policy

[Preview]: All Internet traffic should be routed via your deployed Azure Firewall

Policy DisplayName [Preview]: All Internet traffic should be routed via your deployed Azure Firewall
Policy Id fc5e4038-4584-4632-8c85-c0448d374b2c
Policy Category Network
Policy Description Azure Security Center has identified that some of your subnets aren't protected with a next generation firewall. Protect your subnets from potential threats by restricting access to them with Azure Firewall or a supported next generation firewall
Policy Mode All
Policy Type BuiltIn
Policy in Preview True
Policy Deprecated FALSE
Policy Effect Default: AuditIfNotExists
Allowed: (AuditIfNotExists,Disabled)
Roles used none
Policy Changes
Date/Time (UTC ymd) (i) Change Change detail
2020-03-17 09:22:59 add: Policy fc5e4038-4584-4632-8c85-c0448d374b2c
Used in Policy Initiative(s)
Initiative DisplayName Initiative Id
Enable Monitoring in Azure Security Center 1f3afdf9-d0c9-4c3d-847f-89da613e70a8
[Preview]: Azure Security Benchmark 42a694ed-f65e-42b2-aa9e-8052e9740a92
Policy Rule
{
  "properties": {
  "displayName": "[Preview]: All Internet traffic should be routed via your deployed Azure Firewall",
    "policyType": "BuiltIn",
    "mode": "All",
    "description": "Azure Security Center has identified that some of your subnets aren't protected with a next generation firewall. Protect your subnets from potential threats by restricting access to them with Azure Firewall or a supported next generation firewall",
    "metadata": {
      "version": "2.0.0-preview",
      "category": "Network",
      "preview": true
    },
    "parameters": {
      "effect": {
        "type": "String",
        "metadata": {
        "displayName": "[Preview]: Effect",
          "description": "Enable or disable All Internet traffic should be routed via your deployed Azure Firewall"
        },
        "allowedValues": [
          "AuditIfNotExists",
          "Disabled"
        ],
        "defaultValue": "AuditIfNotExists"
      }
    },
    "policyRule": {
      "if": {
        "allOf": [
          {
            "field": "type",
            "equals": "Microsoft.Network/virtualNetworks/subnets"
          },
          {
            "field": "Microsoft.Network/virtualNetworks/subnets/routeTable",
            "exists": false
          },
          {
            "count": {
            "field": "Microsoft.Network/virtualNetworks/subnets/ipConfigurations[*]"
            },
            "greaterOrEquals": 2
          },
          {
            "field": "name",
            "notIn": [
              "AzureFirewallSubnet",
              "GatewaySubnet",
              "AzureBastionSubnet"
            ]
          }
        ]
      },
      "then": {
      "effect": "[parameters('effect')]",
        "details": {
          "type": "Microsoft.Network/networkSecurityGroups",
        "name": "[string(last(split(field('Microsoft.Network/virtualNetworks/subnets/networkSecurityGroup.id'), '/')))]",
        "resourceGroupName": "[string(take(skip(split(field('Microsoft.Network/virtualNetworks/subnets/networkSecurityGroup.id'), '/'), 4), 1))]",
          "existenceCondition": {
            "allOf": [
              {
                "count": {
                "field": "Microsoft.Network/networkSecurityGroups/subnets[*]",
                  "where": {
                  "field": "Microsoft.Network/networkSecurityGroups/subnets[*].id",
                  "like": "[concat('/subscriptions/', subscription().subscriptionId, '/resourceGroups/*/providers/Microsoft.Network/virtualNetworks/', first(split(field('fullName'), '/')), '/subnets/', field('name'))]"
                  }
                },
                "equals": 1
              },
              {
                "count": {
                "field": "Microsoft.Network/networkSecurityGroups/securityRules[*]",
                  "where": {
                    "allOf": [
                      {
                      "field": "Microsoft.Network/networkSecurityGroups/securityRules[*].direction",
                        "equals": "Outbound"
                      },
                      {
                      "field": "Microsoft.Network/networkSecurityGroups/securityRules[*].access",
                        "equals": "Deny"
                      },
                      {
                      "field": "Microsoft.Network/networkSecurityGroups/securityRules[*].destinationAddressPrefix",
                        "in": [
                          "*",
                          "Internet"
                        ]
                      },
                      {
                        "anyOf": [
                          {
                          "field": "Microsoft.Network/networkSecurityGroups/securityRules[*].destinationPortRange",
                            "in": [
                              "*",
                              "0-65535"
                            ]
                          },
                          {
                            "not": {
                            "field": "Microsoft.Network/networkSecurityGroups/securityRules[*].destinationPortRanges",
                              "notEquals": "0-65535"
                            }
                          }
                        ]
                      }
                    ]
                  }
                },
                "greater": 0
              },
              {
                "count": {
                "field": "Microsoft.Network/networkSecurityGroups/securityRules[*]",
                  "where": {
                    "allOf": [
                      {
                      "field": "Microsoft.Network/networkSecurityGroups/securityRules[*].direction",
                        "equals": "Outbound"
                      },
                      {
                      "field": "Microsoft.Network/networkSecurityGroups/securityRules[*].access",
                        "equals": "Allow"
                      },
                      {
                      "field": "Microsoft.Network/networkSecurityGroups/securityRules[*].destinationAddressPrefix",
                        "in": [
                          "*",
                          "Internet"
                        ]
                      }
                    ]
                  }
                },
                "equals": 0
              }
            ]
          }
        }
      }
    }
  },
  "id": "/providers/Microsoft.Authorization/policyDefinitions/fc5e4038-4584-4632-8c85-c0448d374b2c",
  "type": "Microsoft.Authorization/policyDefinitions",
  "name": "fc5e4038-4584-4632-8c85-c0448d374b2c"
}