{
  "properties": {
    "displayName": "Virtual networks should use specified virtual network gateway",
    "policyType": "BuiltIn",
    "mode": "Indexed",
    "description": "This policy audits any virtual network if the default route does not point to the specified virtual network gateway.",
    "metadata": {
      "version": "1.0.0",
      "category": "Network"
    },
    "parameters": {
      "effect": {
        "type": "string",
        "defaultValue": "AuditIfNotExists",
        "allowedValues": [
          "AuditIfNotExists",
          "Disabled"
        ],
        "metadata": {
          "displayName": "Effect",
          "description": "Enable or disable the execution of the policy"
        }
      },
      "virtualNetworkGatewayId": {
        "type": "string",
        "metadata": {
          "displayName": "Virtual network gateway Id",
          "description": "Resource Id of the virtual network gateway. Example: /subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroup/providers/Microsoft.Network/virtualNetworkGateways/Name"
        }
      }
    },
    "policyRule": {
      "if": {
        "field": "type",
        "equals": "Microsoft.Network/virtualNetworks"
      },
      "then": {
        "effect": "[parameters('effect')]",
        "details": {
          "type": "Microsoft.Network/virtualNetworks/subnets",
          "name": "GatewaySubnet",
          "existenceCondition": {
            "not": {
              "field": "Microsoft.Network/virtualNetworks/subnets/ipConfigurations[*].id",
              "notContains": "[concat(parameters('virtualNetworkGatewayId'), '/')]"
            }
          }
        }
      }
    }
  },
  "id": "/providers/Microsoft.Authorization/policyDefinitions/f1776c76-f58c-4245-a8d0-2b207198dc8b",
  "name": "f1776c76-f58c-4245-a8d0-2b207198dc8b"
}