Microsoft.Network ApplicationGatewayWebApplicationFirewallPolicies 2023-02-01
Bicep 資源定義
ApplicationGatewayWebApplicationFirewallPolicies 資源類型可以使用目標作業來部署:
- 資源群組 - 請參閱 資源群組部署命令
如需每個 API 版本中已變更屬性的清單,請參閱 變更記錄檔。
資源格式
若要建立 Microsoft.Network/ApplicationGatewayWebApplicationFirewallPolicies 資源,請將下列 Bicep 新增至您的範本。
resource symbolicname 'Microsoft.Network/ApplicationGatewayWebApplicationFirewallPolicies@2023-02-01' = {
name: 'string'
location: 'string'
tags: {
tagName1: 'tagValue1'
tagName2: 'tagValue2'
}
properties: {
customRules: [
{
action: 'string'
groupByUserSession: [
{
groupByVariables: [
{
variableName: 'string'
}
]
}
]
matchConditions: [
{
matchValues: [
'string'
]
matchVariables: [
{
selector: 'string'
variableName: 'string'
}
]
negationConditon: bool
operator: 'string'
transforms: [
'string'
]
}
]
name: 'string'
priority: int
rateLimitDuration: 'string'
rateLimitThreshold: int
ruleType: 'string'
state: 'string'
}
]
managedRules: {
exclusions: [
{
exclusionManagedRuleSets: [
{
ruleGroups: [
{
ruleGroupName: 'string'
rules: [
{
ruleId: 'string'
}
]
}
]
ruleSetType: 'string'
ruleSetVersion: 'string'
}
]
matchVariable: 'string'
selector: 'string'
selectorMatchOperator: 'string'
}
]
managedRuleSets: [
{
ruleGroupOverrides: [
{
ruleGroupName: 'string'
rules: [
{
action: 'string'
ruleId: 'string'
state: 'string'
}
]
}
]
ruleSetType: 'string'
ruleSetVersion: 'string'
}
]
}
policySettings: {
customBlockResponseBody: 'string'
customBlockResponseStatusCode: int
fileUploadEnforcement: bool
fileUploadLimitInMb: int
logScrubbing: {
scrubbingRules: [
{
matchVariable: 'string'
selector: 'string'
selectorMatchOperator: 'string'
state: 'string'
}
]
state: 'string'
}
maxRequestBodySizeInKb: int
mode: 'string'
requestBodyCheck: bool
requestBodyEnforcement: bool
requestBodyInspectLimitInKB: int
state: 'string'
}
}
}
屬性值
ApplicationGatewayWebApplicationFirewallPolicies
名稱 | 描述 | 值 |
---|---|---|
NAME | 資源名稱 | 需要字串 () |
location | 資源位置。 | string |
tags | 資源標籤。 | 標記名稱和值的字典。 請參閱 範本中的標籤 |
properties | Web 應用程式防火牆原則的屬性。 | WebApplicationFirewallPolicyPropertiesFormat |
WebApplicationFirewallPolicyPropertiesFormat
名稱 | 描述 | 值 |
---|---|---|
customRules | 原則內的自訂規則。 | WebApplicationFirewallCustomRule[] |
managedRules | 描述 managedRules 結構。 | ManagedRulesDefinition (必要) |
policySettings | 原則的 PolicySettings。 | PolicySettings |
WebApplicationFirewallCustomRule
名稱 | 描述 | 值 |
---|---|---|
動作 | 動作類型。 | 'Allow' 'Block' 需要 'Log' () |
groupByUserSession | 依子句分組的使用者會話識別碼清單。 | GroupByUserSession[] |
matchConditions | 比對條件的清單。 | MatchCondition[] (必要) |
NAME | 原則內唯一的資源名稱。 此名稱可用來存取資源。 | string |
priority | 規則的優先順序。 在具有較高值的規則之前,會先評估值較低的規則。 | 需要 int () |
rateLimitDuration | 將套用速率限制原則的持續時間。 僅適用于 ruleType 為 RateLimitRule 時。 | 'FiveMins' 'OneMin' |
rateLimitThreshold | 如果 ruleType 為 RateLimitRule,則會套用速率限制閾值。 必須大於或等於 1 | int |
ruleType | 規則類型。 | 'Invalid' 'MatchRule' 'RateLimitRule' (必要) |
State | 描述自訂規則是否處於啟用或停用狀態。 如果未指定,則預設為 Enabled。 | 'Disabled' 'Enabled' |
GroupByUserSession
名稱 | 描述 | 值 |
---|---|---|
groupByVariables | 依子句變數分組的清單。 | GroupByVariable[] (必要) |
GroupByVariable
名稱 | 描述 | 值 |
---|---|---|
variableName | User Session 子句變數。 | 'ClientAddr' 'GeoLocation' 必要) ('None' |
MatchCondition
名稱 | 描述 | 值 |
---|---|---|
matchValues | 比對值。 | string[] (必要) |
matchVariables | 相符變數的清單。 | MatchVariable[] (必要) |
negationConditon | 這是否為否定條件。 | bool |
! 運算子之後 | 要比對的運算子。 | 'Any' 'BeginsWith' 'Contains' 'EndWith' 'Equal' 'GeoMatch' 'GreaterThan' 'GreaterThanOrEqual' 'IPMatch' 'LessThan' 'LessThanOrEqual' 'Regex' (必要) |
轉換 | 轉換清單。 | 包含任何專案的字串陣列: 'HtmlEntityDecode' '小寫' 'RemoveNulls' 'Trim' '大寫' 'UrlDecode' 'UrlEncode' |
MatchVariable
名稱 | 描述 | 值 |
---|---|---|
選取器 | 比對變數的選取器。 | string |
variableName | 比對變數。 | 'PostArgs' 'QueryString' 'RemoteAddr' 'RequestBody' 'RequestCookies' 'RequestHeaders' 'RequestMethod' 'RequestUri' (必要) |
ManagedRulesDefinition
名稱 | 描述 | 值 |
---|---|---|
排除項 | 在原則上套用的排除專案。 | OwaspCrsExclusionEntry[] |
managedRuleSets | 與原則相關聯的受管理規則集。 | ManagedRuleSet[] (必要) |
OwaspCrsExclusionEntry
名稱 | 描述 | 值 |
---|---|---|
exclusionManagedRuleSets | 與排除專案相關聯的 Managed 規則集。 | ExclusionManagedRuleSet[] |
matchVariable | 要排除的變數。 | 'RequestArgKeys' 'RequestArgNames' 'RequestArgValues' 'RequestCookieKeys' 'RequestCookieNames' 'RequestCookieValues' 'RequestHeaderKeys' 'RequestHeaderNames' 'RequestHeaderValues' (必要) |
選取器 | matchVariable 是集合時,運算子會用來指定這個排除範圍套用至集合中的哪些專案。 | 字串 (必要) |
selectorMatchOperator | matchVariable 是集合時,請在選取器上操作,以指定套用此排除專案之集合中的哪些元素。 | 'Contains' 'EndWith' 'Equals' 'EqualsAny' 'StartsWith' (必要) |
ExclusionManagedRuleSet
名稱 | 描述 | 值 |
---|---|---|
ruleGroups | 定義要套用至規則集的規則群組。 | ExclusionManagedRuleGroup[] |
ruleSetType | 定義要使用的規則集類型。 | 字串 (必要) |
ruleSetVersion | 定義要使用的規則集版本。 | 字串 (必要) |
ExclusionManagedRuleGroup
名稱 | 描述 | 值 |
---|---|---|
ruleGroupName | 要排除的 Managed 規則群組。 | 字串 (必要) |
規則 | 將排除的規則清單。 如果未指定任何規則,則會排除群組中的所有規則。 | ExclusionManagedRule[] |
ExclusionManagedRule
名稱 | 描述 | 值 |
---|---|---|
ruleId | Managed 規則的識別碼。 | 字串 (必要) |
ManagedRuleSet
名稱 | 描述 | 值 |
---|---|---|
ruleGroupOverrides | 定義要套用至規則集的規則群組覆寫。 | ManagedRuleGroupOverride[] |
ruleSetType | 定義要使用的規則集類型。 | 字串 (必要) |
ruleSetVersion | 定義要使用的規則集版本。 | 字串 (必要) |
ManagedRuleGroupOverride
名稱 | 描述 | 值 |
---|---|---|
ruleGroupName | 要覆寫的 Managed 規則群組。 | 字串 (必要) |
規則 | 將會停用的規則清單。 如果未指定任何規則,群組中的所有規則都會停用。 | ManagedRuleOverride[] |
ManagedRuleOverride
名稱 | 描述 | 值 |
---|---|---|
動作 | 描述規則相符時要套用的覆寫動作。 | 'Allow' 'AnomalyScoring' 'Block' 'Log' |
ruleId | Managed 規則的識別碼。 | 字串 (必要) |
State | Managed 規則的狀態。 如果未指定,預設為 [已停用]。 | 'Disabled' 'Enabled' |
PolicySettings
名稱 | 描述 | 值 |
---|---|---|
customBlockResponseBody | 如果動作類型為區塊,客戶可以覆寫回應本文。 主體必須在 base64 編碼中指定。 | string |
customBlockResponseStatusCode | 如果動作類型為封鎖,客戶可以覆寫回應狀態碼。 | int |
fileUploadEnforcement | 是否允許 WAF 強制執行檔案上傳限制。 | bool |
fileUploadLimitInMb | WAF 的檔案上傳大小上限為 Mb。 | int |
logScrubbing | 清除敏感性記錄欄位 | PolicySettingsLogScrubbing |
maxRequestBodySizeInKb | WAF 的要求本文大小上限為 Kb。 | int |
mode | 原則的模式。 | 'Detection' 'Prevention' |
requestBodyCheck | 是否允許 WAF 檢查要求本文。 | bool |
requestBodyEnforcement | 是否允許 WAF 強制執行要求本文限制。 | bool |
requestBodyInspectLimitInKB | 針對 WAF 的要求本文檢查,KB 中的檢查限制上限。 | int |
State | 原則的狀態。 | 'Disabled' 'Enabled' |
PolicySettingsLogScrubbing
名稱 | 描述 | 值 |
---|---|---|
scrubbingRules | 套用至記錄以進行清除的規則。 | WebApplicationFirewallScrubbingRules[] |
State | 記錄清除組態的狀態。預設值為 Enabled。 | 'Disabled' 'Enabled' |
WebApplicationFirewallScrubbingRules
名稱 | 描述 | 值 |
---|---|---|
matchVariable | 要從記錄中清除的變數。 | 'RequestArgNames' 'RequestCookieNames' 'RequestHeaderNames' 'RequestIPAddress' 'RequestJSONArgNames' 'RequestPostArgNames' (必要) |
選取器 | 當 matchVariable 是集合時,運算子會用來指定套用此規則之集合中的哪些元素。 | string |
selectorMatchOperator | 當 matchVariable 是集合時,請在選取器上操作,以指定套用此規則之集合中的哪些元素。 | 'Equals' 'EqualsAny' (必要) |
State | 定義記錄清除規則的狀態。 預設值為 Enabled。 | 'Disabled' 'Enabled' |
快速入門範本
下列快速入門範本會部署此資源類型。
[範本] | 描述 |
---|---|
在 Azure 應用程式閘道 上建立 Azure WAF v2 |
此範本會在後端集區中有兩部Windows Server 2016伺服器的 Azure 應用程式閘道 上建立 Azure Web 應用程式防火牆 v2 |
具有 NAT 閘道和應用程式閘道的 AKS 叢集 |
此範例示範如何使用 NAT 閘道部署 AKS 叢集以進行輸出連線,以及輸入連線的應用程式閘道。 |
具有應用程式閘道來源的 Front Door Standard/Premium |
此範本會建立 Front Door Standard/Premium 和 應用程式閘道 實例,並使用 NSG 和 WAF 原則來驗證流量是否通過 Front Door 來源。 |
具有 容器執行個體 和 應用程式閘道 的 Front Door |
此範本會建立具有容器群組和應用程式閘道的 Front Door Standard/Premium。 |
具有 應用程式閘道 輸入控制器的 AKS 叢集 |
此範例示範如何使用 應用程式閘道、應用程式閘道 輸入控制器、Azure Container Registry、Log Analytics 和 金鑰保存庫 部署 AKS 叢集 |
使用 WAF 和防火牆原則應用程式閘道 |
此範本會建立應用程式閘道,並設定 WAF 以及防火牆原則 |
ARM 範本資源定義
ApplicationGatewayWebApplicationFirewallPolicies 資源類型可以使用目標作業來部署:
- 資源群組 - 請參閱 資源群組部署命令
如需每個 API 版本中已變更屬性的清單,請參閱 變更記錄檔。
資源格式
若要建立 Microsoft.Network/ApplicationGatewayWebApplicationFirewallPolicies 資源,請將下列 JSON 新增至範本。
{
"type": "Microsoft.Network/ApplicationGatewayWebApplicationFirewallPolicies",
"apiVersion": "2023-02-01",
"name": "string",
"location": "string",
"tags": {
"tagName1": "tagValue1",
"tagName2": "tagValue2"
},
"properties": {
"customRules": [
{
"action": "string",
"groupByUserSession": [
{
"groupByVariables": [
{
"variableName": "string"
}
]
}
],
"matchConditions": [
{
"matchValues": [ "string" ],
"matchVariables": [
{
"selector": "string",
"variableName": "string"
}
],
"negationConditon": "bool",
"operator": "string",
"transforms": [ "string" ]
}
],
"name": "string",
"priority": "int",
"rateLimitDuration": "string",
"rateLimitThreshold": "int",
"ruleType": "string",
"state": "string"
}
],
"managedRules": {
"exclusions": [
{
"exclusionManagedRuleSets": [
{
"ruleGroups": [
{
"ruleGroupName": "string",
"rules": [
{
"ruleId": "string"
}
]
}
],
"ruleSetType": "string",
"ruleSetVersion": "string"
}
],
"matchVariable": "string",
"selector": "string",
"selectorMatchOperator": "string"
}
],
"managedRuleSets": [
{
"ruleGroupOverrides": [
{
"ruleGroupName": "string",
"rules": [
{
"action": "string",
"ruleId": "string",
"state": "string"
}
]
}
],
"ruleSetType": "string",
"ruleSetVersion": "string"
}
]
},
"policySettings": {
"customBlockResponseBody": "string",
"customBlockResponseStatusCode": "int",
"fileUploadEnforcement": "bool",
"fileUploadLimitInMb": "int",
"logScrubbing": {
"scrubbingRules": [
{
"matchVariable": "string",
"selector": "string",
"selectorMatchOperator": "string",
"state": "string"
}
],
"state": "string"
},
"maxRequestBodySizeInKb": "int",
"mode": "string",
"requestBodyCheck": "bool",
"requestBodyEnforcement": "bool",
"requestBodyInspectLimitInKB": "int",
"state": "string"
}
}
}
屬性值
ApplicationGatewayWebApplicationFirewallPolicies
名稱 | 描述 | 值 |
---|---|---|
類型 | 資源類型 | 'Microsoft.Network/ApplicationGatewayWebApplicationFirewallPolicies' |
apiVersion | 資源 API 版本 | '2023-02-01' |
NAME | 資源名稱 | 需要字串 () |
location | 資源位置。 | string |
tags | 資源標籤。 | 標記名稱和值的字典。 請參閱 範本中的標記 |
properties | Web 應用程式防火牆原則的屬性。 | WebApplicationFirewallPolicyPropertiesFormat |
WebApplicationFirewallPolicyPropertiesFormat
名稱 | 描述 | 值 |
---|---|---|
customRules | 原則內的自訂規則。 | WebApplicationFirewallCustomRule[] |
managedRules | 描述 managedRules 結構。 | ManagedRulesDefinition (必要) |
policySettings | 原則的 PolicySettings。 | PolicySettings |
WebApplicationFirewallCustomRule
名稱 | 描述 | 值 |
---|---|---|
動作 | 動作類型。 | 'Allow' 'Block' 需要 'Log' () |
groupByUserSession | 依 子句分組的使用者會話識別碼清單。 | GroupByUserSession[] |
matchConditions | 比對條件的清單。 | MatchCondition[] (必要) |
NAME | 原則內唯一的資源名稱。 此名稱可用來存取資源。 | string |
priority | 規則的優先順序。 在具有較高值的規則之前,將會先評估值較低的規則。 | int (必要) |
rateLimitDuration | 套用速率限制原則的持續時間。 僅適用于 ruleType 為 RateLimitRule 時。 | 'FiveMins' 'OneMin' |
rateLimitThreshold | 如果 ruleType 為 RateLimitRule,則會套用速率限制臨界值。 必須大於或等於 1 | int |
ruleType | 規則類型。 | 'Invalid' 'MatchRule' 必要 ('RateLimitRule') |
State | 描述自訂規則是否處於啟用或停用狀態。 如果未指定,預設為 Enabled。 | 'Disabled' 'Enabled' |
GroupByUserSession
名稱 | 描述 | 值 |
---|---|---|
groupByVariables | 依子句變數分組的清單。 | GroupByVariable[] (必要) |
GroupByVariable
名稱 | 描述 | 值 |
---|---|---|
variableName | User Session 子句變數。 | 'ClientAddr' 'GeoLocation' 必要) ('None' |
MatchCondition
名稱 | 描述 | 值 |
---|---|---|
matchValues | 比對值。 | string[] (必要) |
matchVariables | 相符變數的清單。 | MatchVariable[] (必要) |
negationConditon | 這是否為否定條件。 | bool |
! 運算子之後 | 要比對的運算子。 | 'Any' 'BeginsWith' 'Contains' 'EndWith' 'Equal' 'GeoMatch' 'GreaterThan' 'GreaterThanOrEqual' 'IPMatch' 'LessThan' 'LessThanOrEqual' 需要 'Regex' () |
轉換 | 轉換清單。 | 包含任何專案的字串陣列: 'HtmlEntityDecode' '小寫' 'RemoveNulls' 'Trim' 'Uppercase' 'UrlDecode' 'UrlEncode' |
MatchVariable
名稱 | 描述 | 值 |
---|---|---|
選取器 | 比對變數的選取器。 | string |
variableName | 比對變數。 | 'PostArgs' 'QueryString' 'RemoteAddr' 'RequestBody' 'RequestCookies' 'RequestHeaders' 'RequestMethod' 需要 'RequestUri' () |
ManagedRulesDefinition
名稱 | 描述 | 值 |
---|---|---|
排除項 | 原則上套用的排除專案。 | OwaspCrsExclusionEntry[] |
managedRuleSets | 與原則相關聯的 Managed 規則集。 | ManagedRuleSet[] (必要) |
OwaspCrsExclusionEntry
名稱 | 描述 | 值 |
---|---|---|
exclusionManagedRuleSets | 與排除專案相關聯的 Managed 規則集。 | ExclusionManagedRuleSet[] |
matchVariable | 要排除的變數。 | 'RequestArgKeys' 'RequestArgNames' 'RequestArgValues' 'RequestCookieKeys' 'RequestCookieNames' 'RequestCookieValues' 'RequestHeaderKeys' 'RequestHeaderNames' 'RequestHeaderValues' (必要) |
選取器 | 當 matchVariable 是集合時,運算子會用來指定這個排除範圍套用至集合中的哪些專案。 | 需要字串 () |
selectorMatchOperator | 當 matchVariable 是集合時,請在選取器上操作,以指定要套用此排除範圍之集合中的哪些元素。 | 'Contains' 'EndsWith' 'Equals' 'EqualsAny' 'StartsWith' (必要) |
ExclusionManagedRuleSet
名稱 | 描述 | 值 |
---|---|---|
ruleGroups | 定義要套用至規則集的規則群組。 | ExclusionManagedRuleGroup[] |
ruleSetType | 定義要使用的規則集類型。 | 需要字串 () |
ruleSetVersion | 定義要使用的規則集版本。 | 需要字串 () |
ExclusionManagedRuleGroup
名稱 | 描述 | 值 |
---|---|---|
ruleGroupName | 要排除的 Managed 規則群組。 | 需要字串 () |
規則 | 將會排除的規則清單。 如果未指定任何規則,則會排除群組中的所有規則。 | ExclusionManagedRule[] |
ExclusionManagedRule
名稱 | 描述 | 值 |
---|---|---|
ruleId | Managed 規則的識別碼。 | 需要字串 () |
ManagedRuleSet
名稱 | 描述 | 值 |
---|---|---|
ruleGroupOverrides | 定義要套用至規則集的規則群組覆寫。 | ManagedRuleGroupOverride[] |
ruleSetType | 定義要使用的規則集類型。 | 需要字串 () |
ruleSetVersion | 定義要使用的規則集版本。 | 需要字串 () |
ManagedRuleGroupOverride
名稱 | 描述 | 值 |
---|---|---|
ruleGroupName | 要覆寫的 Managed 規則群組。 | 需要字串 () |
規則 | 將會停用的規則清單。 如果未指定任何規則,將會停用群組中的所有規則。 | ManagedRuleOverride[] |
ManagedRuleOverride
名稱 | 描述 | 值 |
---|---|---|
動作 | 描述規則相符時要套用的覆寫動作。 | 'Allow' 'AnomalyScoring' 'Block' 'Log' |
ruleId | Managed 規則的識別碼。 | 需要字串 () |
State | Managed 規則的狀態。 如果未指定,則預設為 Disabled。 | 'Disabled' 'Enabled' |
PolicySettings
名稱 | 描述 | 值 |
---|---|---|
customBlockResponseBody | 如果動作類型為封鎖,客戶可以覆寫回應本文。 主體必須在 base64 編碼中指定。 | string |
customBlockResponseStatusCode | 如果動作類型為封鎖,客戶可以覆寫回應狀態碼。 | int |
fileUploadEnforcement | 是否允許 WAF 強制執行檔案上傳限制。 | bool |
fileUploadLimitInMb | WAF 的檔案上傳大小上限為 Mb。 | int |
logScrubbing | 清除敏感性記錄欄位 | PolicySettingsLogScrubbing |
maxRequestBodySizeInKb | WAF 的要求本文大小上限,以 Kb 為單位。 | int |
mode | 原則的模式。 | 'Detection' 'Prevention' |
requestBodyCheck | 是否允許 WAF 檢查要求本文。 | bool |
requestBodyEnforcement | 是否允許 WAF 強制執行要求本文限制。 | bool |
requestBodyInspectLimitInKB | 針對 WAF 的要求本文檢查,KB 中的檢查限制上限。 | int |
State | 原則的狀態。 | 'Disabled' 'Enabled' |
PolicySettingsLogScrubbing
名稱 | 描述 | 值 |
---|---|---|
scrubbingRules | 套用至記錄以進行清除的規則。 | WebApplicationFirewallScrubbingRules[] |
State | 記錄清除組態的狀態。預設值為 Enabled。 | 'Disabled' 'Enabled' |
WebApplicationFirewallScrubbingRules
名稱 | 描述 | 值 |
---|---|---|
matchVariable | 要從記錄中清除的變數。 | 'RequestArgNames' 'RequestCookieNames' 'RequestHeaderNames' 'RequestIPAddress' 'RequestJSONArgNames' 'RequestPostArgNames' (必要) |
選取器 | 當 matchVariable 是集合時,運算子會用來指定套用此規則之集合中的哪些元素。 | string |
selectorMatchOperator | 當 matchVariable 是集合時,請在選取器上操作,以指定套用此規則之集合中的哪些元素。 | 'Equals' 'EqualsAny' (必要) |
State | 定義記錄清除規則的狀態。 預設值為 Enabled。 | 'Disabled' 'Enabled' |
快速入門範本
下列快速入門範本會部署此資源類型。
[範本] | 描述 |
---|---|
在 Azure 應用程式閘道 上建立 Azure WAF v2 |
此範本會在後端集區中有兩部Windows Server 2016伺服器的 Azure 應用程式閘道 上建立 Azure Web 應用程式防火牆 v2 |
具有 NAT 閘道和應用程式閘道的 AKS 叢集 |
此範例示範如何使用 NAT 閘道部署 AKS 叢集以進行輸出連線,以及輸入連線的應用程式閘道。 |
具有應用程式閘道來源的 Front Door Standard/Premium |
此範本會建立 Front Door Standard/Premium 和 應用程式閘道 實例,並使用 NSG 和 WAF 原則來驗證流量是否通過 Front Door 來源。 |
具有 容器執行個體 和 應用程式閘道 的 Front Door |
此範本會建立具有容器群組和應用程式閘道的 Front Door Standard/Premium。 |
具有 應用程式閘道 輸入控制器的 AKS 叢集 |
此範例示範如何使用 應用程式閘道、應用程式閘道 輸入控制器、Azure Container Registry、Log Analytics 和 金鑰保存庫 部署 AKS 叢集 |
使用 WAF 和防火牆原則應用程式閘道 |
此範本會建立應用程式閘道,並設定 WAF 以及防火牆原則 |
Terraform (AzAPI 提供者) 資源定義
ApplicationGatewayWebApplicationFirewallPolicies 資源類型可以使用目標作業來部署:
- 資源群組
如需每個 API 版本中已變更屬性的清單,請參閱 變更記錄檔。
資源格式
若要建立 Microsoft.Network/ApplicationGatewayWebApplicationFirewallPolicies 資源,請將下列 Terraform 新增至您的範本。
resource "azapi_resource" "symbolicname" {
type = "Microsoft.Network/ApplicationGatewayWebApplicationFirewallPolicies@2023-02-01"
name = "string"
location = "string"
parent_id = "string"
tags = {
tagName1 = "tagValue1"
tagName2 = "tagValue2"
}
body = jsonencode({
properties = {
customRules = [
{
action = "string"
groupByUserSession = [
{
groupByVariables = [
{
variableName = "string"
}
]
}
]
matchConditions = [
{
matchValues = [
"string"
]
matchVariables = [
{
selector = "string"
variableName = "string"
}
]
negationConditon = bool
operator = "string"
transforms = [
"string"
]
}
]
name = "string"
priority = int
rateLimitDuration = "string"
rateLimitThreshold = int
ruleType = "string"
state = "string"
}
]
managedRules = {
exclusions = [
{
exclusionManagedRuleSets = [
{
ruleGroups = [
{
ruleGroupName = "string"
rules = [
{
ruleId = "string"
}
]
}
]
ruleSetType = "string"
ruleSetVersion = "string"
}
]
matchVariable = "string"
selector = "string"
selectorMatchOperator = "string"
}
]
managedRuleSets = [
{
ruleGroupOverrides = [
{
ruleGroupName = "string"
rules = [
{
action = "string"
ruleId = "string"
state = "string"
}
]
}
]
ruleSetType = "string"
ruleSetVersion = "string"
}
]
}
policySettings = {
customBlockResponseBody = "string"
customBlockResponseStatusCode = int
fileUploadEnforcement = bool
fileUploadLimitInMb = int
logScrubbing = {
scrubbingRules = [
{
matchVariable = "string"
selector = "string"
selectorMatchOperator = "string"
state = "string"
}
]
state = "string"
}
maxRequestBodySizeInKb = int
mode = "string"
requestBodyCheck = bool
requestBodyEnforcement = bool
requestBodyInspectLimitInKB = int
state = "string"
}
}
})
}
屬性值
ApplicationGatewayWebApplicationFirewallPolicies
名稱 | 描述 | 值 |
---|---|---|
類型 | 資源類型 | 「Microsoft.Network/ApplicationGatewayWebApplicationFirewallPolicies@2023-02-01」 |
NAME | 資源名稱 | 需要字串 () |
location | 資源位置。 | string |
parent_id | 若要部署至資源群組,請使用該資源群組的識別碼。 | 需要字串 () |
tags | 資源標籤。 | 標記名稱和值的字典。 |
properties | Web 應用程式防火牆原則的屬性。 | WebApplicationFirewallPolicyPropertiesFormat |
WebApplicationFirewallPolicyPropertiesFormat
名稱 | 描述 | 值 |
---|---|---|
customRules | 原則內的自訂規則。 | WebApplicationFirewallCustomRule[] |
managedRules | 描述 managedRules 結構。 | ManagedRulesDefinition (必要) |
policySettings | 原則的 PolicySettings。 | PolicySettings |
WebApplicationFirewallCustomRule
名稱 | 描述 | 值 |
---|---|---|
動作 | 動作類型。 | 「允許」 「Block」 「Log」 (必要) |
groupByUserSession | 依子句分組的使用者會話識別碼清單。 | GroupByUserSession[] |
matchConditions | 比對條件的清單。 | MatchCondition[] (必要) |
NAME | 原則內唯一的資源名稱。 此名稱可用來存取資源。 | string |
priority | 規則的優先順序。 在具有較高值的規則之前,會先評估值較低的規則。 | 需要 int () |
rateLimitDuration | 將套用速率限制原則的持續時間。 僅適用于 ruleType 為 RateLimitRule 時。 | 「FiveMins」 「OneMin」 |
rateLimitThreshold | 如果 ruleType 為 RateLimitRule,則會套用速率限制閾值。 必須大於或等於 1 | int |
ruleType | 規則類型。 | 「Invalid」 「MatchRule」 「RateLimitRule」 (必要) |
State | 描述自訂規則是否處於啟用或停用狀態。 如果未指定,則預設為 Enabled。 | 「Disabled」 「Enabled」 |
GroupByUserSession
名稱 | 描述 | 值 |
---|---|---|
groupByVariables | 依子句變數分組的清單。 | GroupByVariable[] (必要) |
GroupByVariable
名稱 | 描述 | 值 |
---|---|---|
variableName | 使用者會話子句變數。 | 「ClientAddr」 「GeoLocation」 「None」 (必要) |
MatchCondition
名稱 | 描述 | 值 |
---|---|---|
matchValues | 比對值。 | string[] (必要) |
matchVariables | 比對變數的清單。 | MatchVariable[] (必要) |
negationConditon | 這是否為否定條件。 | bool |
! 運算子之後 | 要比對的運算子。 | 「Any」 「BeginsWith」 「Contains」 「EndsWith」 「Equal」 「GeoMatch」 「GreaterThan」 「GreaterThanOrEqual」 「IPMatch」 「LessThan」 「LessThanOrEqual」 「Regex」 (必要) |
轉換 | 轉換清單。 | 包含任何專案的字串陣列: 「HtmlEntityDecode」 「小寫」 「RemoveNulls」 「Trim」 「大寫」 「UrlDecode」 「UrlEncode」 |
MatchVariable
名稱 | 描述 | 值 |
---|---|---|
選取器 | 比對變數的選取器。 | string |
variableName | 比對變數。 | 「PostArgs」 「QueryString」 「RemoteAddr」 「RequestBody」 「RequestCookies」 「RequestHeaders」 「RequestMethod」 「RequestUri」 (必要) |
ManagedRulesDefinition
名稱 | 描述 | 值 |
---|---|---|
排除項 | 原則上套用的排除專案。 | OwaspCrsExclusionEntry[] |
managedRuleSets | 與原則相關聯的 Managed 規則集。 | ManagedRuleSet[] (必要) |
OwaspCrsExclusionEntry
名稱 | 描述 | 值 |
---|---|---|
exclusionManagedRuleSets | 與排除專案相關聯的 Managed 規則集。 | ExclusionManagedRuleSet[] |
matchVariable | 要排除的變數。 | 「RequestArgKeys」 「RequestArgNames」 「RequestArgValues」 「RequestCookieKeys」 「RequestCookieNames」 「RequestCookieValues」 「RequestHeaderKeys」 「RequestHeaderNames」 必要 (「RequestHeaderValues」) |
選取器 | matchVariable 是集合時,運算子會用來指定這個排除範圍套用至集合中的哪些專案。 | 字串 (必要) |
selectorMatchOperator | matchVariable 是集合時,請在選取器上操作,以指定套用此排除專案之集合中的哪些元素。 | 「Contains」 「EndWith」 「Equals」 「EqualsAny」 「StartsWith」 (必要) |
ExclusionManagedRuleSet
名稱 | 描述 | 值 |
---|---|---|
ruleGroups | 定義要套用至規則集的規則群組。 | ExclusionManagedRuleGroup[] |
ruleSetType | 定義要使用的規則集類型。 | 字串 (必要) |
ruleSetVersion | 定義要使用的規則集版本。 | 字串 (必要) |
ExclusionManagedRuleGroup
名稱 | 描述 | 值 |
---|---|---|
ruleGroupName | 要排除的 Managed 規則群組。 | 字串 (必要) |
規則 | 將排除的規則清單。 如果未指定任何規則,則會排除群組中的所有規則。 | ExclusionManagedRule[] |
ExclusionManagedRule
名稱 | 描述 | 值 |
---|---|---|
ruleId | Managed 規則的識別碼。 | 字串 (必要) |
ManagedRuleSet
名稱 | 描述 | 值 |
---|---|---|
ruleGroupOverrides | 定義要套用至規則集的規則群組覆寫。 | ManagedRuleGroupOverride[] |
ruleSetType | 定義要使用的規則集類型。 | 字串 (必要) |
ruleSetVersion | 定義要使用的規則集版本。 | 字串 (必要) |
ManagedRuleGroupOverride
名稱 | 描述 | 值 |
---|---|---|
ruleGroupName | 要覆寫的 Managed 規則群組。 | 字串 (必要) |
規則 | 將會停用的規則清單。 如果未指定任何規則,群組中的所有規則都會停用。 | ManagedRuleOverride[] |
ManagedRuleOverride
名稱 | 描述 | 值 |
---|---|---|
動作 | 描述規則相符時要套用的覆寫動作。 | 「Allow」 「AnomalyScoring」 「Block」 「Log」 |
ruleId | Managed 規則的識別碼。 | 字串 (必要) |
State | Managed 規則的狀態。 如果未指定,預設為 [已停用]。 | 「Disabled」 「Enabled」 |
PolicySettings
名稱 | 描述 | 值 |
---|---|---|
customBlockResponseBody | 如果動作類型為區塊,客戶可以覆寫回應本文。 主體必須在 base64 編碼中指定。 | string |
customBlockResponseStatusCode | 如果動作類型為封鎖,客戶可以覆寫回應狀態碼。 | int |
fileUploadEnforcement | 是否允許 WAF 強制執行檔案上傳限制。 | bool |
fileUploadLimitInMb | WAF 的檔案上傳大小上限為 Mb。 | int |
logScrubbing | 清除敏感性記錄欄位 | PolicySettingsLogScrubbing |
maxRequestBodySizeInKb | WAF 的要求本文大小上限為 Kb。 | int |
mode | 原則的模式。 | 「偵測」 「預防」 |
requestBodyCheck | 是否允許 WAF 檢查要求本文。 | bool |
requestBodyEnforcement | 是否允許 WAF 強制執行要求本文限制。 | bool |
requestBodyInspectLimitInKB | WAF 要求本文檢查的 KB 檢查上限。 | int |
State | 原則的狀態。 | 「Disabled」 「Enabled」 |
PolicySettingsLogScrubbing
名稱 | 描述 | 值 |
---|---|---|
scrubbingRules | 套用至記錄以進行清除的規則。 | WebApplicationFirewallScrubbingRules[] |
State | 記錄清除組態的狀態。預設值為 Enabled。 | 「Disabled」 「Enabled」 |
WebApplicationFirewallScrubbingRules
名稱 | 描述 | 值 |
---|---|---|
matchVariable | 要從記錄中清除的變數。 | 「RequestArgNames」 「RequestCookieNames」 「RequestHeaderNames」 「RequestIPAddress」 「RequestJSONArgNames」 必要 (「RequestPostArgNames」) |
選取器 | matchVariable 是集合時,運算子會用來指定這個規則套用至集合中的哪些元素。 | string |
selectorMatchOperator | matchVariable 是集合時,請在選取器上操作,以指定套用此規則的集合中的哪些元素。 | 「Equals」 必要) 「EqualsAny」 ( |
State | 定義記錄清除規則的狀態。 預設值為 Enabled。 | 「Disabled」 「Enabled」 |
意見反應
https://aka.ms/ContentUserFeedback。
即將登場:在 2024 年,我們將逐步淘汰 GitHub 問題作為內容的意見反應機制,並將它取代為新的意見反應系統。 如需詳細資訊,請參閱:提交並檢視相關的意見反應