Microsoft.Network ApplicationGatewayWebApplicationFirewallPolicies 2020-11-01

Bicep 資源定義

ApplicationGatewayWebApplicationFirewallPolicies 資源類型可以使用目標作業來部署:

如需每個 API 版本中已變更屬性的清單,請參閱 變更記錄

資源格式

若要建立 Microsoft.Network/ApplicationGatewayWebApplicationFirewallPolicies 資源,請將下列 Bicep 新增至您的範本。

resource symbolicname 'Microsoft.Network/ApplicationGatewayWebApplicationFirewallPolicies@2020-11-01' = {
  name: 'string'
  location: 'string'
  tags: {
    tagName1: 'tagValue1'
    tagName2: 'tagValue2'
  }
  properties: {
    customRules: [
      {
        action: 'string'
        matchConditions: [
          {
            matchValues: [
              'string'
            ]
            matchVariables: [
              {
                selector: 'string'
                variableName: 'string'
              }
            ]
            negationConditon: bool
            operator: 'string'
            transforms: [
              'string'
            ]
          }
        ]
        name: 'string'
        priority: int
        ruleType: 'string'
      }
    ]
    managedRules: {
      exclusions: [
        {
          matchVariable: 'string'
          selector: 'string'
          selectorMatchOperator: 'string'
        }
      ]
      managedRuleSets: [
        {
          ruleGroupOverrides: [
            {
              ruleGroupName: 'string'
              rules: [
                {
                  ruleId: 'string'
                  state: 'Disabled'
                }
              ]
            }
          ]
          ruleSetType: 'string'
          ruleSetVersion: 'string'
        }
      ]
    }
    policySettings: {
      fileUploadLimitInMb: int
      maxRequestBodySizeInKb: int
      mode: 'string'
      requestBodyCheck: bool
      state: 'string'
    }
  }
}

屬性值

ApplicationGatewayWebApplicationFirewallPolicies

名稱 描述
NAME 資源名稱 字串 (必要)
location 資源位置。 字串
tags 資源標籤。 標記名稱和值的字典。 請參閱 範本中的標記
properties Web 應用程式防火牆原則的屬性。 WebApplicationFirewallPolicyPropertiesFormat

WebApplicationFirewallPolicyPropertiesFormat

名稱 描述
customRules 原則內的自定義規則。 WebApplicationFirewallCustomRule[]
managedRules 描述managedRules結構。 ManagedRulesDefinition (必要)
policySettings 原則的 PolicySettings。 PolicySettings

WebApplicationFirewallCustomRule

名稱 描述
動作 動作類型。 'Allow'
'Block'
需要 『Log』 ()
matchConditions 比對條件的清單。 MatchCondition[] (必要)
NAME 原則內唯一的資源名稱。 此名稱可用來存取資源。 字串

約束:
最大長度 = 128
priority 規則的優先順序。 在具有較高值的規則之前,將會先評估值較低的規則。 int (必要)
ruleType 規則類型。 'Invalid'
必要) 'MatchRule' (

MatchCondition

名稱 描述
matchValues 比對值。 string[] (必要)
matchVariables 相符變數的清單。 MatchVariable[] (必要)
negationConditon 這是否為否定條件。 bool
! 運算子之後 要比對的運算符。 'BeginsWith'
'Contains'
'EndWith'
'Equal'
'GeoMatch'
'GreaterThan'
'GreaterThanOrEqual'
'IPMatch'
'LessThan'
'LessThanOrEqual'
'Regex' (必要)
轉換 轉換清單。 包含任何項目的字串數組:
'HtmlEntityDecode'
'小寫'
'RemoveNulls'
'Trim'
'UrlDecode'
'UrlEncode'

MatchVariable

名稱 描述
選取器 比對變數的選取器。 字串
variableName 比對變數。 'PostArgs'
'QueryString'
'RemoteAddr'
'RequestBody'
'RequestCookies'
'RequestHeaders'
'RequestMethod'
'RequestUri' (必要)

ManagedRulesDefinition

名稱 描述
排除項 在原則上套用的排除專案。 OwaspCrsExclusionEntry[]
managedRuleSets 與原則相關聯的受管理規則集。 ManagedRuleSet[] (必要)

OwaspCrsExclusionEntry

名稱 描述
matchVariable 要排除的變數。 'RequestArgNames'
'RequestCookieNames'
'RequestHeaderNames' (必要)
選取器 matchVariable 是集合時,運算子會用來指定這個排除範圍套用至集合中的哪些專案。 字串 (必要)
selectorMatchOperator matchVariable 是集合時,請在選取器上操作,以指定套用此排除專案之集合中的哪些元素。 'Contains'
'EndWith'
'Equals'
'EqualsAny'
'StartsWith' (必要)

ManagedRuleSet

名稱 描述
ruleGroupOverrides 定義要套用至規則集的規則群組覆寫。 ManagedRuleGroupOverride[]
ruleSetType 定義要使用的規則集類型。 字串 (必要)
ruleSetVersion 定義要使用的規則集版本。 字串 (必要)

ManagedRuleGroupOverride

名稱 描述
ruleGroupName 要覆寫的Managed規則群組。 字串 (必要)
規則 將會停用的規則清單。 如果未指定任何規則,群組中的所有規則都會停用。 ManagedRuleOverride[]

ManagedRuleOverride

名稱 描述
ruleId Managed 規則的標識碼。 字串 (必要)
狀態 Managed 規則的狀態。 如果未指定,預設為 [已停用]。 'Disabled'

PolicySettings

名稱 描述
fileUploadLimitInMb WAF 的檔案上傳大小上限為 Mb。 int

約束:
最小值 = 0
maxRequestBodySizeInKb WAF 的要求本文大小上限為 Kb。 int

約束:
最小值 = 8
最大值 = 128
mode 原則的模式。 'Detection'
「預防」
requestBodyCheck 是否允許 WAF 檢查要求本文。 bool
狀態 原則的狀態。 'Disabled'
'Enabled'

快速入門範本

下列快速入門範本會部署此資源類型。

範本 描述
在 Azure 應用程式閘道 上 Create Azure WAF v2

部署至 Azure
此範本會在後端集區中有兩部 Windows Server 2016 伺服器,在 Azure 應用程式閘道 上建立 Azure Web 應用程式防火牆 v2
具有 NAT 閘道和 應用程式閘道 的 AKS 叢集

部署至 Azure
此範例示範如何使用 NAT 閘道部署 AKS 叢集以進行輸出連線,以及輸入連線的 應用程式閘道。
具有 應用程式閘道 來源的 Front Door Standard/Premium

部署至 Azure
此範本會建立 Front Door Standard/Premium 和 應用程式閘道 實例,並使用 NSG 和 WAF 原則來驗證流量是否已通過 Front Door 來源。
具有 容器執行個體 和 應用程式閘道 的 Front Door

部署至 Azure
此範本會建立具有容器群組和 應用程式閘道 的 Front Door Standard/Premium。
具有 應用程式閘道 輸入控制器的 AKS 叢集

部署至 Azure
此範例示範如何使用 應用程式閘道、應用程式閘道 輸入控制器、Azure Container Registry、Log Analytics 和 金鑰保存庫 部署 AKS 叢集
使用 WAF 和防火牆原則 應用程式閘道

部署至 Azure
此範本會建立 應用程式閘道,並設定WAF以及防火牆原則

ARM 範本資源定義

ApplicationGatewayWebApplicationFirewallPolicies 資源類型可以使用目標作業來部署:

如需每個 API 版本中已變更屬性的清單,請參閱 變更記錄

資源格式

若要建立 Microsoft.Network/ApplicationGatewayWebApplicationFirewallPolicies 資源,請將下列 JSON 新增至您的範本。

{
  "type": "Microsoft.Network/ApplicationGatewayWebApplicationFirewallPolicies",
  "apiVersion": "2020-11-01",
  "name": "string",
  "location": "string",
  "tags": {
    "tagName1": "tagValue1",
    "tagName2": "tagValue2"
  },
  "properties": {
    "customRules": [
      {
        "action": "string",
        "matchConditions": [
          {
            "matchValues": [ "string" ],
            "matchVariables": [
              {
                "selector": "string",
                "variableName": "string"
              }
            ],
            "negationConditon": "bool",
            "operator": "string",
            "transforms": [ "string" ]
          }
        ],
        "name": "string",
        "priority": "int",
        "ruleType": "string"
      }
    ],
    "managedRules": {
      "exclusions": [
        {
          "matchVariable": "string",
          "selector": "string",
          "selectorMatchOperator": "string"
        }
      ],
      "managedRuleSets": [
        {
          "ruleGroupOverrides": [
            {
              "ruleGroupName": "string",
              "rules": [
                {
                  "ruleId": "string",
                  "state": "Disabled"
                }
              ]
            }
          ],
          "ruleSetType": "string",
          "ruleSetVersion": "string"
        }
      ]
    },
    "policySettings": {
      "fileUploadLimitInMb": "int",
      "maxRequestBodySizeInKb": "int",
      "mode": "string",
      "requestBodyCheck": "bool",
      "state": "string"
    }
  }
}

屬性值

ApplicationGatewayWebApplicationFirewallPolicies

名稱 描述
類型 資源類型 'Microsoft.Network/ApplicationGatewayWebApplicationFirewallPolicies'
apiVersion 資源 API 版本 '2020-11-01'
NAME 資源名稱 字串 (必要)
location 資源位置。 字串
tags 資源標籤。 標記名稱和值的字典。 請參閱 範本中的標記
properties Web 應用程式防火牆原則的屬性。 WebApplicationFirewallPolicyPropertiesFormat

WebApplicationFirewallPolicyPropertiesFormat

名稱 描述
customRules 原則內的自定義規則。 WebApplicationFirewallCustomRule[]
managedRules 描述managedRules結構。 ManagedRulesDefinition (必要)
policySettings 原則的 PolicySettings。 PolicySettings

WebApplicationFirewallCustomRule

名稱 描述
動作 動作類型。 'Allow'
'Block'
需要 『Log』 ()
matchConditions 比對條件的清單。 MatchCondition[] (必要)
NAME 原則內唯一的資源名稱。 此名稱可用來存取資源。 字串

約束:
最大長度 = 128
priority 規則的優先順序。 在具有較高值的規則之前,會先評估值較低的規則。 需要 int ()
ruleType 規則類型。 'Invalid'
'MatchRule' (必要)

MatchCondition

名稱 描述
matchValues 比對值。 string[] (必要)
matchVariables 比對變數的清單。 MatchVariable[] (必要)
negationConditon 這是否為否定條件。 bool
! 運算子之後 要比對的運算符。 'BeginsWith'
'Contains'
'EndsWith'
'Equal'
'GeoMatch'
'GreaterThan'
'GreaterThanOrEqual'
'IPMatch'
'LessThan'
'LessThanOrEqual'
需要 『Regex』 ()
轉換 轉換清單。 包含任何項目的字串數組:
'HtmlEntityDecode'
'小寫'
'RemoveNulls'
'Trim'
'UrlDecode'
'UrlEncode'

MatchVariable

名稱 描述
選取器 比對變數的選取器。 字串
variableName 比對變數。 'PostArgs'
'QueryString'
'RemoteAddr'
'RequestBody'
'RequestCookies'
'RequestHeaders'
'RequestMethod'
需要 『RequestUri』 ()

ManagedRulesDefinition

名稱 描述
排除項 原則上套用的排除專案。 OwaspCrsExclusionEntry[]
managedRuleSets 與原則相關聯的Managed規則集。 ManagedRuleSet[] (必要)

OwaspCrsExclusionEntry

名稱 描述
matchVariable 要排除的變數。 'RequestArgNames'
'RequestCookieNames'
'RequestHeaderNames' (必要)
選取器 當 matchVariable 是集合時,運算符會用來指定這個排除範圍套用至集合中的哪些專案。 需要字串 ()
selectorMatchOperator 當 matchVariable 是集合時,請在選取器上操作,以指定要套用此排除範圍之集合中的哪些元素。 'Contains'
'EndsWith'
'Equals'
'EqualsAny'
'StartsWith' (必要)

ManagedRuleSet

名稱 描述
ruleGroupOverrides 定義要套用至規則集的規則群組覆寫。 ManagedRuleGroupOverride[]
ruleSetType 定義要使用的規則集類型。 需要字串 ()
ruleSetVersion 定義要使用的規則集版本。 需要字串 ()

ManagedRuleGroupOverride

名稱 描述
ruleGroupName 要覆寫的Managed規則群組。 需要字串 ()
規則 將會停用的規則清單。 如果未指定任何規則,將會停用群組中的所有規則。 ManagedRuleOverride[]

ManagedRuleOverride

名稱 描述
ruleId Managed 規則的標識碼。 需要字串 ()
狀態 Managed 規則的狀態。 如果未指定,則預設為 Disabled。 'Disabled'

PolicySettings

名稱 描述
fileUploadLimitInMb WAF 的檔案上傳大小上限為 Mb。 int

約束:
最小值 = 0
maxRequestBodySizeInKb WAF 的要求本文大小上限,以 Kb 為單位。 int

約束:
最小值 = 8
最大值 = 128
mode 原則的模式。 'Detection'
'Prevention'
requestBodyCheck 是否允許 WAF 檢查要求本文。 bool
狀態 原則的狀態。 'Disabled'
'Enabled'

快速入門範本

下列快速入門範本會部署此資源類型。

範本 描述
在 Azure 應用程式閘道 上 Create Azure WAF v2

部署至 Azure
此範本會在後端集區中有兩部 Windows Server 2016 伺服器的 Azure 應用程式閘道 上建立 Azure Web 應用程式防火牆 v2
具有 NAT 閘道和 應用程式閘道 的 AKS 叢集

部署至 Azure
此範例示範如何使用 NAT 閘道部署 AKS 叢集以進行輸出連線,以及輸入連線的 應用程式閘道。
具有 應用程式閘道 原點的 Front Door Standard/Premium

部署至 Azure
此範本會建立 Front Door Standard/Premium 和 應用程式閘道 實例,並使用 NSG 和 WAF 原則來驗證流量是否通過 Front Door 來源。
具有 容器執行個體 和 應用程式閘道 的 Front Door

部署至 Azure
此範本會建立具有容器群組和 應用程式閘道 的 Front Door Standard/Premium。
具有 應用程式閘道 輸入控制器的 AKS 叢集

部署至 Azure
此範例示範如何使用 應用程式閘道、應用程式閘道 輸入控制器、Azure Container Registry、Log Analytics 和 金鑰保存庫 部署 AKS 叢集
使用 WAF 和防火牆原則 應用程式閘道

部署至 Azure
此範本會建立 應用程式閘道,並設定WAF以及防火牆原則

Terraform (AzAPI 提供者) 資源定義

ApplicationGatewayWebApplicationFirewallPolicies 資源類型可以使用目標作業來部署:

  • 資源群組

如需每個 API 版本中已變更屬性的清單,請參閱 變更記錄檔。

資源格式

若要建立 Microsoft.Network/ApplicationGatewayWebApplicationFirewallPolicies 資源,請將下列 Terraform 新增至您的範本。

resource "azapi_resource" "symbolicname" {
  type = "Microsoft.Network/ApplicationGatewayWebApplicationFirewallPolicies@2020-11-01"
  name = "string"
  location = "string"
  parent_id = "string"
  tags = {
    tagName1 = "tagValue1"
    tagName2 = "tagValue2"
  }
  body = jsonencode({
    properties = {
      customRules = [
        {
          action = "string"
          matchConditions = [
            {
              matchValues = [
                "string"
              ]
              matchVariables = [
                {
                  selector = "string"
                  variableName = "string"
                }
              ]
              negationConditon = bool
              operator = "string"
              transforms = [
                "string"
              ]
            }
          ]
          name = "string"
          priority = int
          ruleType = "string"
        }
      ]
      managedRules = {
        exclusions = [
          {
            matchVariable = "string"
            selector = "string"
            selectorMatchOperator = "string"
          }
        ]
        managedRuleSets = [
          {
            ruleGroupOverrides = [
              {
                ruleGroupName = "string"
                rules = [
                  {
                    ruleId = "string"
                    state = "Disabled"
                  }
                ]
              }
            ]
            ruleSetType = "string"
            ruleSetVersion = "string"
          }
        ]
      }
      policySettings = {
        fileUploadLimitInMb = int
        maxRequestBodySizeInKb = int
        mode = "string"
        requestBodyCheck = bool
        state = "string"
      }
    }
  })
}

屬性值

ApplicationGatewayWebApplicationFirewallPolicies

名稱 描述
類型 資源類型 “Microsoft.Network/ApplicationGatewayWebApplicationFirewallPolicies@2020-11-01”
NAME 資源名稱 需要字串 ()
location 資源位置。 字串
parent_id 若要部署至資源群組,請使用該資源群組的標識碼。 字串 (必要)
tags 資源標籤。 標記名稱和值的字典。
properties Web 應用程式防火牆原則的屬性。 WebApplicationFirewallPolicyPropertiesFormat

WebApplicationFirewallPolicyPropertiesFormat

名稱 描述
customRules 原則內的自定義規則。 WebApplicationFirewallCustomRule[]
managedRules 描述managedRules結構。 ManagedRulesDefinition (必要)
policySettings 原則的 PolicySettings。 PolicySettings

WebApplicationFirewallCustomRule

名稱 描述
動作 動作類型。 “Allow”
“Block”
「記錄」 (必要)
matchConditions 比對條件的清單。 MatchCondition[] (必要)
NAME 原則內唯一的資源名稱。 此名稱可用來存取資源。 字串

約束:
最大長度 = 128
priority 規則的優先順序。 在具有較高值的規則之前,將會先評估值較低的規則。 int (必要)
ruleType 規則類型。 “Invalid”
“MatchRule” (必要)

MatchCondition

名稱 描述
matchValues 比對值。 string[] (必要)
matchVariables 相符變數的清單。 MatchVariable[] (必要)
negationConditon 這是否為否定條件。 bool
! 運算子之後 要比對的運算符。 “BeginsWith”
“Contains”
“EndWith”
“Equal”
“GeoMatch”
“GreaterThan”
“GreaterThanOrEqual”
“IPMatch”
“LessThan”
“LessThanOrEqual”
必要) (“Regex”
轉換 轉換清單。 包含任何項目的字串數組:
“HtmlEntityDecode”
“小寫”
“RemoveNulls”
“Trim”
“UrlDecode”
“UrlEncode”

MatchVariable

名稱 描述
選取器 比對變數的選取器。 字串
variableName 比對變數。 “PostArgs”
“QueryString”
“RemoteAddr”
“RequestBody”
“RequestCookies”
“RequestHeaders”
“RequestMethod”
“RequestUri” (必要)

ManagedRulesDefinition

名稱 描述
排除項 原則上套用的排除專案。 OwaspCrsExclusionEntry[]
managedRuleSets 與原則相關聯的Managed規則集。 ManagedRuleSet[] (必要)

OwaspCrsExclusionEntry

名稱 描述
matchVariable 要排除的變數。 “RequestArgNames”
“RequestCookieNames”
“RequestHeaderNames” (必要)
選取器 當 matchVariable 是集合時,運算符會用來指定這個排除範圍套用至集合中的哪些專案。 需要字串 ()
selectorMatchOperator 當 matchVariable 是集合時,請在選取器上操作,以指定要套用此排除範圍之集合中的哪些元素。 “Contains”
“EndsWith”
“Equals”
“EqualsAny”
“StartsWith” (必要)

ManagedRuleSet

名稱 描述
ruleGroupOverrides 定義要套用至規則集的規則群組覆寫。 ManagedRuleGroupOverride[]
ruleSetType 定義要使用的規則集類型。 需要字串 ()
ruleSetVersion 定義要使用的規則集版本。 需要字串 ()

ManagedRuleGroupOverride

名稱 描述
ruleGroupName 要覆寫的Managed規則群組。 需要字串 ()
規則 將會停用的規則清單。 如果未指定任何規則,將會停用群組中的所有規則。 ManagedRuleOverride[]

ManagedRuleOverride

名稱 描述
ruleId Managed 規則的標識碼。 需要字串 ()
狀態 Managed 規則的狀態。 如果未指定,則預設為 Disabled。 “Disabled”

PolicySettings

名稱 描述
fileUploadLimitInMb WAF 的檔案上傳大小上限為 Mb。 int

約束:
最小值 = 0
maxRequestBodySizeInKb WAF 的要求本文大小上限,以 Kb 為單位。 int

約束:
最小值 = 8
最大值 = 128
mode 原則的模式。 “偵測”
「預防」
requestBodyCheck 是否允許 WAF 檢查要求本文。 bool
狀態 原則的狀態。 “Disabled”
“Enabled”