你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn。
Bicep 资源定义
可以使用目标操作部署配置文件/securityPolicies 资源类型:
- 资源组 - 请参阅 资源组部署命令
有关每个 API 版本中已更改属性的列表,请参阅 更改日志。
用法示例
Bicep 示例
部署 Front Door(标准/高级)安全策略的基本示例。
param resourceName string = 'acctest0001'
param location string = 'westeurope'
resource profile 'Microsoft.Cdn/profiles@2021-06-01' = {
name: resourceName
location: 'global'
sku: {
name: 'Premium_AzureFrontDoor'
}
properties: {
originResponseTimeoutSeconds: 120
}
}
resource securityPolicy 'Microsoft.Cdn/profiles/securityPolicies@2021-06-01' = {
name: resourceName
parent: profile
properties: {
parameters: {
associations: [
{
domains: [
{
id: customDomain.id
}
]
patternsToMatch: [
'/*'
]
}
]
type: 'WebApplicationFirewall'
wafPolicy: {
id: frontDoorWebApplicationFirewallPolicy.id
}
}
}
}
resource frontDoorWebApplicationFirewallPolicy 'Microsoft.Network/FrontDoorWebApplicationFirewallPolicies@2020-11-01' = {
name: resourceName
location: 'global'
sku: {
name: 'Premium_AzureFrontDoor'
}
properties: {
customRules: {
rules: [
{
action: 'Block'
enabledState: 'Enabled'
matchConditions: [
{
matchValue: [
'192.168.1.0/24'
'10.0.0.0/24'
]
matchVariable: 'RemoteAddr'
negateCondition: false
operator: 'IPMatch'
}
]
name: 'Rule1'
priority: 1
rateLimitDurationInMinutes: 1
rateLimitThreshold: 10
ruleType: 'MatchRule'
}
]
}
managedRules: {
managedRuleSets: [
{
ruleGroupOverrides: [
{
ruleGroupName: 'PHP'
rules: [
{
action: 'Block'
enabledState: 'Disabled'
ruleId: '933111'
}
]
}
]
ruleSetAction: 'Block'
ruleSetType: 'DefaultRuleSet'
ruleSetVersion: 'preview-0.1'
}
{
ruleSetAction: 'Block'
ruleSetType: 'BotProtection'
ruleSetVersion: 'preview-0.1'
}
]
}
policySettings: {
customBlockResponseBody: 'PGh0bWw+CjxoZWFkZXI+PHRpdGxlPkhlbGxvPC90aXRsZT48L2hlYWRlcj4KPGJvZHk+CkhlbGxvIHdvcmxkCjwvYm9keT4KPC9odG1sPg=='
customBlockResponseStatusCode: 403
enabledState: 'Enabled'
mode: 'Prevention'
redirectUrl: 'https://www.fabrikam.com'
}
}
}
resource dnsZone 'Microsoft.Network/dnsZones@2018-05-01' = {
name: '${resourceName}.com'
location: 'global'
}
resource customDomain 'Microsoft.Cdn/profiles/customDomains@2021-06-01' = {
name: resourceName
parent: profile
properties: {
azureDnsZone: {
id: dnsZone.id
}
hostName: 'fabrikam.${resourceName}.com'
tlsSettings: {
certificateType: 'ManagedCertificate'
minimumTlsVersion: 'TLS12'
}
}
}
Azure 验证模块
以下 Azure 验证模块 可用于部署此资源类型。
| 模块 | Description |
|---|---|
| CDN配置文件 - 安全政策 | 用于 CDN 配置文件的 AVM 子模块 - 安全策略 |
Azure 快速入门示例
以下 Azure 快速入门模板 包含用于部署此资源类型的 Bicep 示例。
| Bicep 文件 | Description |
|---|---|
| 使用 blob 源和专用链接 |
此模板创建 Front Door Premium 和 Azure 存储 Blob 容器,并使用 Front Door 的专用终结点将流量发送到存储帐户。 |
| 使用 WAF 和Microsoft托管的规则集 |
此模板创建一个 Front Door Premium,其中包括具有Microsoft托管的默认和机器人保护规则集的 Web 应用程序防火墙。 |
| 使用异地筛选 |
此模板创建 Front Door 标准版/高级版,包括具有地理筛选规则的 Web 应用程序防火墙。 |
| Front Door 标准版/高级版,速率限制为 | 此模板创建 Front Door 标准版/高级版,包括具有速率限制规则的 Web 应用程序防火墙。 |
| 使用 WAF 和自定义规则 |
此模板创建 Front Door 标准版/高级版,包括具有自定义规则的 Web 应用程序防火墙。 |
| 用于上传 blob 的 Blob 源的 Front Door | 此模板创建一个 Front Door,其中包含源、路由和 ruleSet,以及一个包含 Blob 容器的 Azure 存储帐户。 Front Door 在上传文件时向存储帐户发送流量。 |
| 使用 WAF、域和日志将 FrontDoor CDN EventHub | 此模板创建新的 Azure FrontDoor cdn 配置文件。 使用自定义和托管规则、cdn 路由、源和组与 WAF 和路由关联创建 WAF,配置自定义域,创建事件中心和诊断设置,以便使用事件中心发送 CDN 访问日志。 |
| 受 Azure Frontdoor 保护的 |
此模板允许部署受 Azure Frontdoor 高级版保护并发布的 Azure 高级函数。 Azure Frontdoor 和 Azure Functions 之间的连接受 Azure 专用链接的保护。 |
资源格式
若要创建 Microsoft.Cdn/profiles/securityPolicies 资源,请将以下 Bicep 添加到模板。
resource symbolicname 'Microsoft.Cdn/profiles/securityPolicies@2025-09-01-preview' = {
parent: resourceSymbolicName
name: 'string'
properties: {
parameters: {
type: 'string'
// For remaining properties, see SecurityPolicyPropertiesParameters objects
}
}
}
SecurityPolicyPropertiesParameters 对象
设置 type 属性以指定对象的类型。
对于 WebApplicationFirewall,请使用:
{
associations: [
{
domains: [
{
id: 'string'
}
]
patternsToMatch: [
'string'
]
}
]
type: 'WebApplicationFirewall'
wafPolicy: {
id: 'string'
}
}
对于 WebApplicationFirewallEmbedded,请使用:
{
associations: [
{
domains: [
{
id: 'string'
}
]
patternsToMatch: [
'string'
]
}
]
type: 'WebApplicationFirewallEmbedded'
wafPolicy: {
etag: 'string'
properties: {
customRules: {
rules: [
{
action: 'string'
enabledState: 'string'
groupBy: [
{
variableName: 'string'
}
]
matchConditions: [
{
matchValue: [
'string'
]
matchVariable: 'string'
negateCondition: bool
operator: 'string'
selector: 'string'
transforms: [
'string'
]
}
]
name: 'string'
priority: int
rateLimitDurationInMinutes: int
rateLimitThreshold: int
ruleType: 'string'
}
]
}
managedRules: {
managedRuleSets: [
{
exclusions: [
{
matchVariable: 'string'
selector: 'string'
selectorMatchOperator: 'string'
}
]
ruleGroupOverrides: [
{
exclusions: [
{
matchVariable: 'string'
selector: 'string'
selectorMatchOperator: 'string'
}
]
ruleGroupName: 'string'
rules: [
{
action: 'string'
enabledState: 'string'
exclusions: [
{
matchVariable: 'string'
selector: 'string'
selectorMatchOperator: 'string'
}
]
ruleId: 'string'
}
]
}
]
ruleSetAction: 'string'
ruleSetType: 'string'
ruleSetVersion: 'string'
}
]
}
policySettings: {
captchaExpirationInMinutes: int
customBlockResponseBody: 'string'
customBlockResponseStatusCode: int
enabledState: 'string'
javascriptChallengeExpirationInMinutes: int
logScrubbing: {
scrubbingRules: [
{
matchVariable: 'string'
selector: 'string'
selectorMatchOperator: 'string'
state: 'string'
}
]
state: 'string'
}
mode: 'string'
redirectUrl: 'string'
requestBodyCheck: 'string'
}
}
sku: {
name: 'string'
}
}
}
属性值
Microsoft.Cdn/profiles/securityPolicies
| Name | Description | 价值 |
|---|---|---|
| 姓名 | 资源名称 | string (必需) |
| 父级 | 在 Bicep 中,可以为子资源指定父资源。 仅当子资源在父资源外部声明时,才需要添加此属性。 有关详细信息,请参阅 父资源外部的子资源。 |
类型资源的符号名称: 配置文件 |
| 属性 | 包含创建安全策略所需的属性的 json 对象 | SecurityPolicyProperties |
ActivatedResourceReference
| Name | Description | 价值 |
|---|---|---|
| id | 资源 ID。 | 字符串 |
自定义规则Afd
| Name | Description | 价值 |
|---|---|---|
| 操作 | 描述规则匹配时要应用的作。 | “允许” “AnomalyScoring” “Block” “验证码” “JSChallenge” 'Log' “重定向”(必需) |
| enabledState | 描述自定义规则是否处于启用或禁用状态。 如果未指定,则默认为 Enabled。 | 'Disabled' 'Enabled' |
| 按组分组 | 描述用于对速率限制请求进行分组的变量列表 | 分组变量[] |
| matchConditions | 匹配条件列表。 | MatchConditionAfd[](必需) |
| 姓名 | 描述规则的名称。 | string Constraints: 最大长度 = 128 |
| priority | 描述规则的优先级。 在具有较高值的规则之前,将评估具有较低值的规则。 | int (必需) |
| rateLimitDuration(分钟) | 重置速率限制计数的时间窗口。 默认值为 1 分钟。 | int Constraints: 最小值 = 0 最大值 = 5 |
| rateLimitThreshold | 时间范围内每个客户端允许的请求数。 | int Constraints: 最小值 = 0 |
| ruleType | 描述规则的类型。 | “MatchRule” “RateLimitRule”(必需) |
自定义规则列表Afd
| Name | Description | 价值 |
|---|---|---|
| 规则 | 规则列表 | CustomRuleAfd[] |
按变量分组
| Name | Description | 价值 |
|---|---|---|
| variableName | 介绍组依据的受支持变量 | “GeoLocation” 'None' 'SocketAddr'(必需) |
ManagedRuleExclusion
| Name | Description | 价值 |
|---|---|---|
| matchVariable 的 | 要排除的变量类型。 | “QueryStringArgNames” 'RequestBodyJsonArgNames' “请求BodyPostArgNames” “RequestCookieNames” “RequestHeaderNames”(必需) |
| 选择器 | 此排除项适用于集合中哪些元素的选择器值。 | string (必需) |
| selectorMatchOperator | 在指定此排除项适用于集合中的哪些元素时应用于选择器的比较运算符。 | 'Contains' 'EndsWith' 'Equals' “EqualsAny” “StartsWith”(必需) |
ManagedRuleGroupOverrideAfd
| Name | Description | 价值 |
|---|---|---|
| 排除 | 描述应用于组中所有规则的排除项。 | ManagedRuleExclusion[] |
| ruleGroupName (规则组名称) | 描述要重写的托管规则组。 | string (必需) |
| 规则 | 将禁用的规则列表。 如果未指定任何规则,将禁用组中的所有规则。 | ManagedRuleOverrideAfd[] |
ManagedRuleOverrideAfd
| Name | Description | 价值 |
|---|---|---|
| 操作 | 描述规则匹配时要应用的替代操作。 | “允许” “AnomalyScoring” “Block” “验证码” “JSChallenge” 'Log' “Redirect” |
| enabledState | 描述托管规则是否处于启用或禁用状态。 如果未指定,则默认为 Disabled。 | 'Disabled' 'Enabled' |
| 排除 | 描述应用于此特定规则的排除项。 | ManagedRuleExclusion[] |
| 规则 ID | 托管规则的标识符。 | string (必需) |
托管规则集Afd
| Name | Description | 价值 |
|---|---|---|
| 排除 | 描述应用于集中所有规则的排除项。 | ManagedRuleExclusion[] |
| ruleGroup覆盖 | 定义要应用于规则集的规则组替代。 | ManagedRuleGroupOverrideAfd[] |
| 规则设置作 | 定义规则集作。 | “Block” 'Log' “Redirect” |
| 规则集类型 | 定义要使用的规则集类型。 | string (必需) |
| ruleSetVersion | 定义要使用的规则集的版本。 | string (必需) |
ManagedRuleSetListAfd
| Name | Description | 价值 |
|---|---|---|
| managedRuleSets | 规则集列表。 | ManagedRuleSetAfd[] |
匹配条件Afd
| Name | Description | 价值 |
|---|---|---|
| matchValue 匹配值 | 可能的匹配值列表。 | string[] (必需) |
| matchVariable 的 | 请求变量进行比较。 | 'ClientPort' 'Cookies' 'HostName' 'HttpVersion' 'IsDevice' “PostArgs” “QueryString” 'RemoteAddress' “RequestBody” “RequestHeader” “RequestMethod” 'RequestScheme' 'RequestUri' 'ServerPort' 'SocketAddr' 'SslProtocol' 'UrlFileExtension' 'UrlFileName' 'UrlPath'(必填) |
| negateCondition | 描述是否应否定此条件的结果。 | 布尔 |
| 操作员 | 用于与变量值匹配的比较类型。 | “Any” “BeginsWith” 'Contains' 'EndsWith' “Equal” “GeoMatch” “GreaterThan” “GreaterThanOrEqual” “IPMatch” “LessThan” “LessThanOrEqual” 'RegEx'(必填) |
| 选择器 | 与 QueryString、PostArgs、RequestHeader 或 Cookies 变量中的特定键进行匹配。 默认值为 null。 | 字符串 |
| 变换 | 转换列表。 | 包含任一项的字符串数组: “小写” “RemoveNulls” “Trim” “大写” “UrlDecode” “UrlEncode” |
策略设置Afd
| Name | Description | 价值 |
|---|---|---|
| 验证码过期在分钟 | 定义验证码 cookie 有效期(以分钟为单位)。 此设置仅适用于Premium_AzureFrontDoor。 值必须是介于 5 和 1440 之间的整数,默认值为 30。 | int Constraints: 最小值 = 5 最大值 = 1440 |
| customBlockResponseBody | 如果操作类型为块,客户可以替代响应正文。 必须在 base64 编码中指定正文。 | string Constraints: 图案 = ^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{4})$ |
| customBlockResponseStatusCode | 如果操作类型为块,客户可以替代响应状态代码。 | int |
| enabledState | 描述策略是处于启用状态还是禁用状态。 如果未指定,则默认为 Enabled。 | 'Disabled' 'Enabled' |
| javascriptChallengeExpirationInMinutes | 定义 JavaScript 质询 Cookie 有效期(以分钟为单位)。 此设置仅适用于Premium_AzureFrontDoor。 值必须是介于 5 和 1440 之间的整数,默认值为 30。 | int Constraints: 最小值 = 5 最大值 = 1440 |
| logScrubbing (日志清理) | 定义用于清理 Web 应用程序防火墙日志中敏感字段的规则。 | PolicySettingsLogScrubbing |
| mode | 描述它在策略级别是否处于检测模式或预防模式。 | “检测” “预防” |
| 重定向网址 | 如果作类型为重定向,则此字段表示客户端的重定向 URL。 | 字符串 |
| 请求正文检查 | 描述策略托管规则是否将检查请求正文内容。 | 'Disabled' 'Enabled' |
PolicySettingsLogScrubbing
| Name | Description | 价值 |
|---|---|---|
| scrubbing规则 | 应用于 Web 应用程序防火墙日志的日志清理规则列表。 | WebApplicationFirewallScrubbingRules[] |
| 状态 | 日志清理配置的状态。默认值为“已启用”。 | 'Disabled' 'Enabled' |
ResourceReference
| Name | Description | 价值 |
|---|---|---|
| id | 资源 ID。 | 字符串 |
SecurityPolicyProperties
| Name | Description | 价值 |
|---|---|---|
| parameters | 包含安全策略参数的对象 | SecurityPolicyProperties参数 |
SecurityPolicyProperties参数
| Name | Description | 价值 |
|---|---|---|
| 类型 | 对于 SecurityPolicyWebApplicationFirewallParameters类型,设置为“WebApplicationFirewall”。 对于 类型 SecurityPolicyWebApplicationFirewallParametersWithEmbeddedWafPolicy,设置为“WebApplicationFirewallEmbedded”。 | “Web应用程序防火墙” “WebApplicationFirewallEmbedded”(必需) |
SecurityPolicyWebApplicationFirewallAssociation
| Name | Description | 价值 |
|---|---|---|
| domains | 域列表。 | ActivatedResourceReference[] |
| patternsToMatch | 路径列表 | 字符串[] |
SecurityPolicyWebApplicationFirewallParameters
| Name | Description | 价值 |
|---|---|---|
| associations | Waf 关联 | SecurityPolicyWebApplicationFirewallAssociation[] |
| 类型 | 要创建的安全策略的类型。 | “WebApplicationFirewall”(必需) |
| wafPolicy | 资源 ID。 | ResourceReference |
SecurityPolicyWebApplicationFirewallParametersWithEmbeddedWafPolicy
| Name | Description | 价值 |
|---|---|---|
| associations | Waf 关联 | SecurityPolicyWebApplicationFirewallAssociation[] |
| 类型 | 要创建的安全策略的类型。 | “WebApplicationFirewallEmbedded”(必需) |
| wafPolicy | Web 应用程序防火墙策略的属性。 | Web应用程序防火墙策略 |
Sku
| Name | Description | 价值 |
|---|---|---|
| 姓名 | 定价层的名称。 | “Classic_AzureFrontDoor” “Custom_Verizon” “Premium_AzureFrontDoor” “Premium_Verizon” “StandardPlus_955BandWidth_ChinaCdn” “StandardPlus_AvgBandWidth_ChinaCdn” “StandardPlus_ChinaCdn” “Standard_955BandWidth_ChinaCdn” “Standard_Akamai” “Standard_AvgBandWidth_ChinaCdn” “Standard_AzureFrontDoor” “Standard_ChinaCdn” “Standard_Microsoft” “Standard_Verizon” |
Web应用程序防火墙策略
| Name | Description | 价值 |
|---|---|---|
| etag | 获取在更新资源时更改的唯一只读字符串。 | 字符串 |
| 属性 | Web 应用程序防火墙策略的属性。 | WebApplication防火墙策略属性 |
| sku | Web 应用程序防火墙策略的定价层。 如果未指定,则默认为 Classic_AzureFrontDoor。 | Sku |
WebApplication防火墙策略属性
| Name | Description | 价值 |
|---|---|---|
| 自定义规则 | 描述策略中的自定义规则。 | 自定义规则列表Afd |
| managedRules | 描述策略中的托管规则。 | ManagedRuleSetListAfd |
| policySettings | 描述策略的设置。 | 策略设置Afd |
WebApplicationFirewallScrubbing规则
| Name | Description | 价值 |
|---|---|---|
| matchVariable 的 | 要从日志中清理的变量。 | “QueryStringArgNames” 'RequestBodyJsonArgNames' “请求BodyPostArgNames” “RequestCookieNames” “RequestHeaderNames” “请求 IPAddress” “RequestUri”(必需) |
| 选择器 | matchVariable 是集合时,运算符用于指定此规则应用于的集合中的哪些元素。 | 字符串 |
| selectorMatchOperator | 如果 matchVariable 是集合,请对选择器进行操作,以指定此规则应用于的集合中的哪些元素。 | 'Equals' “EqualsAny”(必需) |
| 状态 | 定义日志清理规则的状态。 默认值处于启用状态。 | 'Disabled' 'Enabled' |
ARM 模板资源定义
可以使用目标操作部署配置文件/securityPolicies 资源类型:
用法示例
Azure 快速入门模板
以下 Azure 快速入门模板 部署此资源类型。
| Template | Description |
|---|---|
| 使用 blob 源和专用链接 |
此模板创建 Front Door Premium 和 Azure 存储 Blob 容器,并使用 Front Door 的专用终结点将流量发送到存储帐户。 |
| 使用 WAF 和Microsoft托管的规则集 |
此模板创建一个 Front Door Premium,其中包括具有Microsoft托管的默认和机器人保护规则集的 Web 应用程序防火墙。 |
| 使用异地筛选 |
此模板创建 Front Door 标准版/高级版,包括具有地理筛选规则的 Web 应用程序防火墙。 |
|
Front Door 标准版/高级版,速率限制为 |
此模板创建 Front Door 标准版/高级版,包括具有速率限制规则的 Web 应用程序防火墙。 |
| 使用 WAF 和自定义规则 |
此模板创建 Front Door 标准版/高级版,包括具有自定义规则的 Web 应用程序防火墙。 |
|
用于上传 blob 的 Blob 源的 Front Door |
此模板创建一个 Front Door,其中包含源、路由和 ruleSet,以及一个包含 Blob 容器的 Azure 存储帐户。 Front Door 在上传文件时向存储帐户发送流量。 |
| 使用 WAF、域和日志将 FrontDoor CDN EventHub |
此模板创建新的 Azure FrontDoor cdn 配置文件。 使用自定义和托管规则、cdn 路由、源和组与 WAF 和路由关联创建 WAF,配置自定义域,创建事件中心和诊断设置,以便使用事件中心发送 CDN 访问日志。 |
| 受 Azure Frontdoor 保护的 |
此模板允许部署受 Azure Frontdoor 高级版保护并发布的 Azure 高级函数。 Azure Frontdoor 和 Azure Functions 之间的连接受 Azure 专用链接的保护。 |
资源格式
若要创建 Microsoft.Cdn/profiles/securityPolicies 资源,请将以下 JSON 添加到模板。
{
"type": "Microsoft.Cdn/profiles/securityPolicies",
"apiVersion": "2025-09-01-preview",
"name": "string",
"properties": {
"parameters": {
"type": "string"
// For remaining properties, see SecurityPolicyPropertiesParameters objects
}
}
}
SecurityPolicyPropertiesParameters 对象
设置 type 属性以指定对象的类型。
对于 WebApplicationFirewall,请使用:
{
"associations": [
{
"domains": [
{
"id": "string"
}
],
"patternsToMatch": [ "string" ]
}
],
"type": "WebApplicationFirewall",
"wafPolicy": {
"id": "string"
}
}
对于 WebApplicationFirewallEmbedded,请使用:
{
"associations": [
{
"domains": [
{
"id": "string"
}
],
"patternsToMatch": [ "string" ]
}
],
"type": "WebApplicationFirewallEmbedded",
"wafPolicy": {
"etag": "string",
"properties": {
"customRules": {
"rules": [
{
"action": "string",
"enabledState": "string",
"groupBy": [
{
"variableName": "string"
}
],
"matchConditions": [
{
"matchValue": [ "string" ],
"matchVariable": "string",
"negateCondition": "bool",
"operator": "string",
"selector": "string",
"transforms": [ "string" ]
}
],
"name": "string",
"priority": "int",
"rateLimitDurationInMinutes": "int",
"rateLimitThreshold": "int",
"ruleType": "string"
}
]
},
"managedRules": {
"managedRuleSets": [
{
"exclusions": [
{
"matchVariable": "string",
"selector": "string",
"selectorMatchOperator": "string"
}
],
"ruleGroupOverrides": [
{
"exclusions": [
{
"matchVariable": "string",
"selector": "string",
"selectorMatchOperator": "string"
}
],
"ruleGroupName": "string",
"rules": [
{
"action": "string",
"enabledState": "string",
"exclusions": [
{
"matchVariable": "string",
"selector": "string",
"selectorMatchOperator": "string"
}
],
"ruleId": "string"
}
]
}
],
"ruleSetAction": "string",
"ruleSetType": "string",
"ruleSetVersion": "string"
}
]
},
"policySettings": {
"captchaExpirationInMinutes": "int",
"customBlockResponseBody": "string",
"customBlockResponseStatusCode": "int",
"enabledState": "string",
"javascriptChallengeExpirationInMinutes": "int",
"logScrubbing": {
"scrubbingRules": [
{
"matchVariable": "string",
"selector": "string",
"selectorMatchOperator": "string",
"state": "string"
}
],
"state": "string"
},
"mode": "string",
"redirectUrl": "string",
"requestBodyCheck": "string"
}
},
"sku": {
"name": "string"
}
}
}
属性值
Microsoft.Cdn/profiles/securityPolicies
| Name | Description | 价值 |
|---|---|---|
| apiVersion | API 版本 | “2025-09-01-预览” |
| 姓名 | 资源名称 | string (必需) |
| 属性 | 包含创建安全策略所需的属性的 json 对象 | SecurityPolicyProperties |
| 类型 | 资源类型 | “Microsoft.Cdn/profiles/securityPolicies” |
ActivatedResourceReference
| Name | Description | 价值 |
|---|---|---|
| id | 资源 ID。 | 字符串 |
自定义规则Afd
| Name | Description | 价值 |
|---|---|---|
| 操作 | 描述规则匹配时要应用的作。 | “允许” “AnomalyScoring” “Block” “验证码” “JSChallenge” 'Log' “重定向”(必需) |
| enabledState | 描述自定义规则是否处于启用或禁用状态。 如果未指定,则默认为 Enabled。 | 'Disabled' 'Enabled' |
| 按组分组 | 描述用于对速率限制请求进行分组的变量列表 | 分组变量[] |
| matchConditions | 匹配条件列表。 | MatchConditionAfd[](必需) |
| 姓名 | 描述规则的名称。 | string Constraints: 最大长度 = 128 |
| priority | 描述规则的优先级。 在具有较高值的规则之前,将评估具有较低值的规则。 | int (必需) |
| rateLimitDuration(分钟) | 重置速率限制计数的时间窗口。 默认值为 1 分钟。 | int Constraints: 最小值 = 0 最大值 = 5 |
| rateLimitThreshold | 时间范围内每个客户端允许的请求数。 | int Constraints: 最小值 = 0 |
| ruleType | 描述规则的类型。 | “MatchRule” “RateLimitRule”(必需) |
自定义规则列表Afd
| Name | Description | 价值 |
|---|---|---|
| 规则 | 规则列表 | CustomRuleAfd[] |
按变量分组
| Name | Description | 价值 |
|---|---|---|
| variableName | 介绍组依据的受支持变量 | “GeoLocation” 'None' 'SocketAddr'(必需) |
ManagedRuleExclusion
| Name | Description | 价值 |
|---|---|---|
| matchVariable 的 | 要排除的变量类型。 | “QueryStringArgNames” 'RequestBodyJsonArgNames' “请求BodyPostArgNames” “RequestCookieNames” “RequestHeaderNames”(必需) |
| 选择器 | 此排除项适用于集合中哪些元素的选择器值。 | string (必需) |
| selectorMatchOperator | 在指定此排除项适用于集合中的哪些元素时应用于选择器的比较运算符。 | 'Contains' 'EndsWith' 'Equals' “EqualsAny” “StartsWith”(必需) |
ManagedRuleGroupOverrideAfd
| Name | Description | 价值 |
|---|---|---|
| 排除 | 描述应用于组中所有规则的排除项。 | ManagedRuleExclusion[] |
| ruleGroupName (规则组名称) | 描述要重写的托管规则组。 | string (必需) |
| 规则 | 将禁用的规则列表。 如果未指定任何规则,将禁用组中的所有规则。 | ManagedRuleOverrideAfd[] |
ManagedRuleOverrideAfd
| Name | Description | 价值 |
|---|---|---|
| 操作 | 描述规则匹配时要应用的替代操作。 | “允许” “AnomalyScoring” “Block” “验证码” “JSChallenge” 'Log' “Redirect” |
| enabledState | 描述托管规则是否处于启用或禁用状态。 如果未指定,则默认为 Disabled。 | 'Disabled' 'Enabled' |
| 排除 | 描述应用于此特定规则的排除项。 | ManagedRuleExclusion[] |
| 规则 ID | 托管规则的标识符。 | string (必需) |
托管规则集Afd
| Name | Description | 价值 |
|---|---|---|
| 排除 | 描述应用于集中所有规则的排除项。 | ManagedRuleExclusion[] |
| ruleGroup覆盖 | 定义要应用于规则集的规则组替代。 | ManagedRuleGroupOverrideAfd[] |
| 规则设置作 | 定义规则集作。 | “Block” 'Log' “Redirect” |
| 规则集类型 | 定义要使用的规则集类型。 | string (必需) |
| ruleSetVersion | 定义要使用的规则集的版本。 | string (必需) |
ManagedRuleSetListAfd
| Name | Description | 价值 |
|---|---|---|
| managedRuleSets | 规则集列表。 | ManagedRuleSetAfd[] |
匹配条件Afd
| Name | Description | 价值 |
|---|---|---|
| matchValue 匹配值 | 可能的匹配值列表。 | string[] (必需) |
| matchVariable 的 | 请求变量进行比较。 | 'ClientPort' 'Cookies' 'HostName' 'HttpVersion' 'IsDevice' “PostArgs” “QueryString” 'RemoteAddress' “RequestBody” “RequestHeader” “RequestMethod” 'RequestScheme' 'RequestUri' 'ServerPort' 'SocketAddr' 'SslProtocol' 'UrlFileExtension' 'UrlFileName' 'UrlPath'(必填) |
| negateCondition | 描述是否应否定此条件的结果。 | 布尔 |
| 操作员 | 用于与变量值匹配的比较类型。 | “Any” “BeginsWith” 'Contains' 'EndsWith' “Equal” “GeoMatch” “GreaterThan” “GreaterThanOrEqual” “IPMatch” “LessThan” “LessThanOrEqual” 'RegEx'(必填) |
| 选择器 | 与 QueryString、PostArgs、RequestHeader 或 Cookies 变量中的特定键进行匹配。 默认值为 null。 | 字符串 |
| 变换 | 转换列表。 | 包含任一项的字符串数组: “小写” “RemoveNulls” “Trim” “大写” “UrlDecode” “UrlEncode” |
策略设置Afd
| Name | Description | 价值 |
|---|---|---|
| 验证码过期在分钟 | 定义验证码 cookie 有效期(以分钟为单位)。 此设置仅适用于Premium_AzureFrontDoor。 值必须是介于 5 和 1440 之间的整数,默认值为 30。 | int Constraints: 最小值 = 5 最大值 = 1440 |
| customBlockResponseBody | 如果操作类型为块,客户可以替代响应正文。 必须在 base64 编码中指定正文。 | string Constraints: 图案 = ^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{4})$ |
| customBlockResponseStatusCode | 如果操作类型为块,客户可以替代响应状态代码。 | int |
| enabledState | 描述策略是处于启用状态还是禁用状态。 如果未指定,则默认为 Enabled。 | 'Disabled' 'Enabled' |
| javascriptChallengeExpirationInMinutes | 定义 JavaScript 质询 Cookie 有效期(以分钟为单位)。 此设置仅适用于Premium_AzureFrontDoor。 值必须是介于 5 和 1440 之间的整数,默认值为 30。 | int Constraints: 最小值 = 5 最大值 = 1440 |
| logScrubbing (日志清理) | 定义用于清理 Web 应用程序防火墙日志中敏感字段的规则。 | PolicySettingsLogScrubbing |
| mode | 描述它在策略级别是否处于检测模式或预防模式。 | “检测” “预防” |
| 重定向网址 | 如果作类型为重定向,则此字段表示客户端的重定向 URL。 | 字符串 |
| 请求正文检查 | 描述策略托管规则是否将检查请求正文内容。 | 'Disabled' 'Enabled' |
PolicySettingsLogScrubbing
| Name | Description | 价值 |
|---|---|---|
| scrubbing规则 | 应用于 Web 应用程序防火墙日志的日志清理规则列表。 | WebApplicationFirewallScrubbingRules[] |
| 状态 | 日志清理配置的状态。默认值为“已启用”。 | 'Disabled' 'Enabled' |
ResourceReference
| Name | Description | 价值 |
|---|---|---|
| id | 资源 ID。 | 字符串 |
SecurityPolicyProperties
| Name | Description | 价值 |
|---|---|---|
| parameters | 包含安全策略参数的对象 | SecurityPolicyProperties参数 |
SecurityPolicyProperties参数
| Name | Description | 价值 |
|---|---|---|
| 类型 | 对于 SecurityPolicyWebApplicationFirewallParameters类型,设置为“WebApplicationFirewall”。 对于 类型 SecurityPolicyWebApplicationFirewallParametersWithEmbeddedWafPolicy,设置为“WebApplicationFirewallEmbedded”。 | “Web应用程序防火墙” “WebApplicationFirewallEmbedded”(必需) |
SecurityPolicyWebApplicationFirewallAssociation
| Name | Description | 价值 |
|---|---|---|
| domains | 域列表。 | ActivatedResourceReference[] |
| patternsToMatch | 路径列表 | 字符串[] |
SecurityPolicyWebApplicationFirewallParameters
| Name | Description | 价值 |
|---|---|---|
| associations | Waf 关联 | SecurityPolicyWebApplicationFirewallAssociation[] |
| 类型 | 要创建的安全策略的类型。 | “WebApplicationFirewall”(必需) |
| wafPolicy | 资源 ID。 | ResourceReference |
SecurityPolicyWebApplicationFirewallParametersWithEmbeddedWafPolicy
| Name | Description | 价值 |
|---|---|---|
| associations | Waf 关联 | SecurityPolicyWebApplicationFirewallAssociation[] |
| 类型 | 要创建的安全策略的类型。 | “WebApplicationFirewallEmbedded”(必需) |
| wafPolicy | Web 应用程序防火墙策略的属性。 | Web应用程序防火墙策略 |
Sku
| Name | Description | 价值 |
|---|---|---|
| 姓名 | 定价层的名称。 | “Classic_AzureFrontDoor” “Custom_Verizon” “Premium_AzureFrontDoor” “Premium_Verizon” “StandardPlus_955BandWidth_ChinaCdn” “StandardPlus_AvgBandWidth_ChinaCdn” “StandardPlus_ChinaCdn” “Standard_955BandWidth_ChinaCdn” “Standard_Akamai” “Standard_AvgBandWidth_ChinaCdn” “Standard_AzureFrontDoor” “Standard_ChinaCdn” “Standard_Microsoft” “Standard_Verizon” |
Web应用程序防火墙策略
| Name | Description | 价值 |
|---|---|---|
| etag | 获取在更新资源时更改的唯一只读字符串。 | 字符串 |
| 属性 | Web 应用程序防火墙策略的属性。 | WebApplication防火墙策略属性 |
| sku | Web 应用程序防火墙策略的定价层。 如果未指定,则默认为 Classic_AzureFrontDoor。 | Sku |
WebApplication防火墙策略属性
| Name | Description | 价值 |
|---|---|---|
| 自定义规则 | 描述策略中的自定义规则。 | 自定义规则列表Afd |
| managedRules | 描述策略中的托管规则。 | ManagedRuleSetListAfd |
| policySettings | 描述策略的设置。 | 策略设置Afd |
WebApplicationFirewallScrubbing规则
| Name | Description | 价值 |
|---|---|---|
| matchVariable 的 | 要从日志中清理的变量。 | “QueryStringArgNames” 'RequestBodyJsonArgNames' “请求BodyPostArgNames” “RequestCookieNames” “RequestHeaderNames” “请求 IPAddress” “RequestUri”(必需) |
| 选择器 | matchVariable 是集合时,运算符用于指定此规则应用于的集合中的哪些元素。 | 字符串 |
| selectorMatchOperator | 如果 matchVariable 是集合,请对选择器进行操作,以指定此规则应用于的集合中的哪些元素。 | 'Equals' “EqualsAny”(必需) |
| 状态 | 定义日志清理规则的状态。 默认值处于启用状态。 | 'Disabled' 'Enabled' |
Terraform (AzAPI 提供程序)资源定义
可以使用目标操作部署配置文件/securityPolicies 资源类型:
- 资源组 关于每个API版本中变更属性的列表,请参见 更改日志。
用法示例
Terraform 示例
部署 Front Door(标准/高级)安全策略的基本示例。
terraform {
required_providers {
azapi = {
source = "Azure/azapi"
}
}
}
provider "azapi" {
skip_provider_registration = false
}
variable "resource_name" {
type = string
default = "acctest0001"
}
variable "location" {
type = string
default = "westeurope"
}
resource "azapi_resource" "resourceGroup" {
type = "Microsoft.Resources/resourceGroups@2020-06-01"
name = var.resource_name
location = var.location
}
resource "azapi_resource" "dnsZone" {
type = "Microsoft.Network/dnsZones@2018-05-01"
parent_id = azapi_resource.resourceGroup.id
name = "${var.resource_name}.com"
location = "global"
schema_validation_enabled = false
response_export_values = ["*"]
}
resource "azapi_resource" "profile" {
type = "Microsoft.Cdn/profiles@2021-06-01"
parent_id = azapi_resource.resourceGroup.id
name = var.resource_name
location = "global"
body = {
properties = {
originResponseTimeoutSeconds = 120
}
sku = {
name = "Premium_AzureFrontDoor"
}
}
schema_validation_enabled = false
response_export_values = ["*"]
}
resource "azapi_resource" "FrontDoorWebApplicationFirewallPolicy" {
type = "Microsoft.Network/FrontDoorWebApplicationFirewallPolicies@2020-11-01"
parent_id = azapi_resource.resourceGroup.id
name = var.resource_name
location = "global"
body = {
properties = {
customRules = {
rules = [
{
action = "Block"
enabledState = "Enabled"
matchConditions = [
{
matchValue = [
"192.168.1.0/24",
"10.0.0.0/24",
]
matchVariable = "RemoteAddr"
negateCondition = false
operator = "IPMatch"
},
]
name = "Rule1"
priority = 1
rateLimitDurationInMinutes = 1
rateLimitThreshold = 10
ruleType = "MatchRule"
},
]
}
managedRules = {
managedRuleSets = [
{
ruleGroupOverrides = [
{
ruleGroupName = "PHP"
rules = [
{
action = "Block"
enabledState = "Disabled"
ruleId = "933111"
},
]
},
]
ruleSetAction = "Block"
ruleSetType = "DefaultRuleSet"
ruleSetVersion = "preview-0.1"
},
{
ruleSetAction = "Block"
ruleSetType = "BotProtection"
ruleSetVersion = "preview-0.1"
},
]
}
policySettings = {
customBlockResponseBody = "PGh0bWw+CjxoZWFkZXI+PHRpdGxlPkhlbGxvPC90aXRsZT48L2hlYWRlcj4KPGJvZHk+CkhlbGxvIHdvcmxkCjwvYm9keT4KPC9odG1sPg=="
customBlockResponseStatusCode = 403
enabledState = "Enabled"
mode = "Prevention"
redirectUrl = "https://www.fabrikam.com"
}
}
sku = {
name = "Premium_AzureFrontDoor"
}
}
schema_validation_enabled = false
response_export_values = ["*"]
}
resource "azapi_resource" "customDomain" {
type = "Microsoft.Cdn/profiles/customDomains@2021-06-01"
parent_id = azapi_resource.profile.id
name = var.resource_name
body = {
properties = {
azureDnsZone = {
id = azapi_resource.dnsZone.id
}
hostName = "fabrikam.${var.resource_name}.com"
tlsSettings = {
certificateType = "ManagedCertificate"
minimumTlsVersion = "TLS12"
}
}
}
schema_validation_enabled = false
response_export_values = ["*"]
}
resource "azapi_resource" "securityPolicy" {
type = "Microsoft.Cdn/profiles/securityPolicies@2021-06-01"
parent_id = azapi_resource.profile.id
name = var.resource_name
body = {
properties = {
parameters = {
associations = [
{
domains = [
{
id = azapi_resource.customDomain.id
},
]
patternsToMatch = [
"/*",
]
},
]
type = "WebApplicationFirewall"
wafPolicy = {
id = azapi_resource.FrontDoorWebApplicationFirewallPolicy.id
}
}
}
}
schema_validation_enabled = false
response_export_values = ["*"]
}
资源格式
若要创建 Microsoft.Cdn/profiles/securityPolicies 资源,请将以下 Terraform 添加到模板。
resource "azapi_resource" "symbolicname" {
type = "Microsoft.Cdn/profiles/securityPolicies@2025-09-01-preview"
name = "string"
parent_id = "string"
body = {
properties = {
parameters = {
type = "string"
// For remaining properties, see SecurityPolicyPropertiesParameters objects
}
}
}
}
SecurityPolicyPropertiesParameters 对象
设置 type 属性以指定对象的类型。
对于 WebApplicationFirewall,请使用:
{
associations = [
{
domains = [
{
id = "string"
}
]
patternsToMatch = [
"string"
]
}
]
type = "WebApplicationFirewall"
wafPolicy = {
id = "string"
}
}
对于 WebApplicationFirewallEmbedded,请使用:
{
associations = [
{
domains = [
{
id = "string"
}
]
patternsToMatch = [
"string"
]
}
]
type = "WebApplicationFirewallEmbedded"
wafPolicy = {
etag = "string"
properties = {
customRules = {
rules = [
{
action = "string"
enabledState = "string"
groupBy = [
{
variableName = "string"
}
]
matchConditions = [
{
matchValue = [
"string"
]
matchVariable = "string"
negateCondition = bool
operator = "string"
selector = "string"
transforms = [
"string"
]
}
]
name = "string"
priority = int
rateLimitDurationInMinutes = int
rateLimitThreshold = int
ruleType = "string"
}
]
}
managedRules = {
managedRuleSets = [
{
exclusions = [
{
matchVariable = "string"
selector = "string"
selectorMatchOperator = "string"
}
]
ruleGroupOverrides = [
{
exclusions = [
{
matchVariable = "string"
selector = "string"
selectorMatchOperator = "string"
}
]
ruleGroupName = "string"
rules = [
{
action = "string"
enabledState = "string"
exclusions = [
{
matchVariable = "string"
selector = "string"
selectorMatchOperator = "string"
}
]
ruleId = "string"
}
]
}
]
ruleSetAction = "string"
ruleSetType = "string"
ruleSetVersion = "string"
}
]
}
policySettings = {
captchaExpirationInMinutes = int
customBlockResponseBody = "string"
customBlockResponseStatusCode = int
enabledState = "string"
javascriptChallengeExpirationInMinutes = int
logScrubbing = {
scrubbingRules = [
{
matchVariable = "string"
selector = "string"
selectorMatchOperator = "string"
state = "string"
}
]
state = "string"
}
mode = "string"
redirectUrl = "string"
requestBodyCheck = "string"
}
}
sku = {
name = "string"
}
}
}
属性值
Microsoft.Cdn/profiles/securityPolicies
| Name | Description | 价值 |
|---|---|---|
| 姓名 | 资源名称 | string (必需) |
| parent_id | 此资源的父资源的 ID。 | 类型资源的 ID: 配置文件 |
| 属性 | 包含创建安全策略所需的属性的 json 对象 | SecurityPolicyProperties |
| 类型 | 资源类型 | “Microsoft.Cdn/profiles/securityPolicies@2025-09-01-preview” |
ActivatedResourceReference
| Name | Description | 价值 |
|---|---|---|
| id | 资源 ID。 | 字符串 |
自定义规则Afd
| Name | Description | 价值 |
|---|---|---|
| 操作 | 描述规则匹配时要应用的作。 | “允许” “AnomalyScoring” “Block” “验证码” “JSChallenge” 'Log' “重定向”(必需) |
| enabledState | 描述自定义规则是否处于启用或禁用状态。 如果未指定,则默认为 Enabled。 | 'Disabled' 'Enabled' |
| 按组分组 | 描述用于对速率限制请求进行分组的变量列表 | 分组变量[] |
| matchConditions | 匹配条件列表。 | MatchConditionAfd[](必需) |
| 姓名 | 描述规则的名称。 | string Constraints: 最大长度 = 128 |
| priority | 描述规则的优先级。 在具有较高值的规则之前,将评估具有较低值的规则。 | int (必需) |
| rateLimitDuration(分钟) | 重置速率限制计数的时间窗口。 默认值为 1 分钟。 | int Constraints: 最小值 = 0 最大值 = 5 |
| rateLimitThreshold | 时间范围内每个客户端允许的请求数。 | int Constraints: 最小值 = 0 |
| ruleType | 描述规则的类型。 | “MatchRule” “RateLimitRule”(必需) |
自定义规则列表Afd
| Name | Description | 价值 |
|---|---|---|
| 规则 | 规则列表 | CustomRuleAfd[] |
按变量分组
| Name | Description | 价值 |
|---|---|---|
| variableName | 介绍组依据的受支持变量 | “GeoLocation” 'None' 'SocketAddr'(必需) |
ManagedRuleExclusion
| Name | Description | 价值 |
|---|---|---|
| matchVariable 的 | 要排除的变量类型。 | “QueryStringArgNames” 'RequestBodyJsonArgNames' “请求BodyPostArgNames” “RequestCookieNames” “RequestHeaderNames”(必需) |
| 选择器 | 此排除项适用于集合中哪些元素的选择器值。 | string (必需) |
| selectorMatchOperator | 在指定此排除项适用于集合中的哪些元素时应用于选择器的比较运算符。 | 'Contains' 'EndsWith' 'Equals' “EqualsAny” “StartsWith”(必需) |
ManagedRuleGroupOverrideAfd
| Name | Description | 价值 |
|---|---|---|
| 排除 | 描述应用于组中所有规则的排除项。 | ManagedRuleExclusion[] |
| ruleGroupName (规则组名称) | 描述要重写的托管规则组。 | string (必需) |
| 规则 | 将禁用的规则列表。 如果未指定任何规则,将禁用组中的所有规则。 | ManagedRuleOverrideAfd[] |
ManagedRuleOverrideAfd
| Name | Description | 价值 |
|---|---|---|
| 操作 | 描述规则匹配时要应用的替代操作。 | “允许” “AnomalyScoring” “Block” “验证码” “JSChallenge” 'Log' “Redirect” |
| enabledState | 描述托管规则是否处于启用或禁用状态。 如果未指定,则默认为 Disabled。 | 'Disabled' 'Enabled' |
| 排除 | 描述应用于此特定规则的排除项。 | ManagedRuleExclusion[] |
| 规则 ID | 托管规则的标识符。 | string (必需) |
托管规则集Afd
| Name | Description | 价值 |
|---|---|---|
| 排除 | 描述应用于集中所有规则的排除项。 | ManagedRuleExclusion[] |
| ruleGroup覆盖 | 定义要应用于规则集的规则组替代。 | ManagedRuleGroupOverrideAfd[] |
| 规则设置作 | 定义规则集作。 | “Block” 'Log' “Redirect” |
| 规则集类型 | 定义要使用的规则集类型。 | string (必需) |
| ruleSetVersion | 定义要使用的规则集的版本。 | string (必需) |
ManagedRuleSetListAfd
| Name | Description | 价值 |
|---|---|---|
| managedRuleSets | 规则集列表。 | ManagedRuleSetAfd[] |
匹配条件Afd
| Name | Description | 价值 |
|---|---|---|
| matchValue 匹配值 | 可能的匹配值列表。 | string[] (必需) |
| matchVariable 的 | 请求变量进行比较。 | 'ClientPort' 'Cookies' 'HostName' 'HttpVersion' 'IsDevice' “PostArgs” “QueryString” 'RemoteAddress' “RequestBody” “RequestHeader” “RequestMethod” 'RequestScheme' 'RequestUri' 'ServerPort' 'SocketAddr' 'SslProtocol' 'UrlFileExtension' 'UrlFileName' 'UrlPath'(必填) |
| negateCondition | 描述是否应否定此条件的结果。 | 布尔 |
| 操作员 | 用于与变量值匹配的比较类型。 | “Any” “BeginsWith” 'Contains' 'EndsWith' “Equal” “GeoMatch” “GreaterThan” “GreaterThanOrEqual” “IPMatch” “LessThan” “LessThanOrEqual” 'RegEx'(必填) |
| 选择器 | 与 QueryString、PostArgs、RequestHeader 或 Cookies 变量中的特定键进行匹配。 默认值为 null。 | 字符串 |
| 变换 | 转换列表。 | 包含任一项的字符串数组: “小写” “RemoveNulls” “Trim” “大写” “UrlDecode” “UrlEncode” |
策略设置Afd
| Name | Description | 价值 |
|---|---|---|
| 验证码过期在分钟 | 定义验证码 cookie 有效期(以分钟为单位)。 此设置仅适用于Premium_AzureFrontDoor。 值必须是介于 5 和 1440 之间的整数,默认值为 30。 | int Constraints: 最小值 = 5 最大值 = 1440 |
| customBlockResponseBody | 如果操作类型为块,客户可以替代响应正文。 必须在 base64 编码中指定正文。 | string Constraints: 图案 = ^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{4})$ |
| customBlockResponseStatusCode | 如果操作类型为块,客户可以替代响应状态代码。 | int |
| enabledState | 描述策略是处于启用状态还是禁用状态。 如果未指定,则默认为 Enabled。 | 'Disabled' 'Enabled' |
| javascriptChallengeExpirationInMinutes | 定义 JavaScript 质询 Cookie 有效期(以分钟为单位)。 此设置仅适用于Premium_AzureFrontDoor。 值必须是介于 5 和 1440 之间的整数,默认值为 30。 | int Constraints: 最小值 = 5 最大值 = 1440 |
| logScrubbing (日志清理) | 定义用于清理 Web 应用程序防火墙日志中敏感字段的规则。 | PolicySettingsLogScrubbing |
| mode | 描述它在策略级别是否处于检测模式或预防模式。 | “检测” “预防” |
| 重定向网址 | 如果作类型为重定向,则此字段表示客户端的重定向 URL。 | 字符串 |
| 请求正文检查 | 描述策略托管规则是否将检查请求正文内容。 | 'Disabled' 'Enabled' |
PolicySettingsLogScrubbing
| Name | Description | 价值 |
|---|---|---|
| scrubbing规则 | 应用于 Web 应用程序防火墙日志的日志清理规则列表。 | WebApplicationFirewallScrubbingRules[] |
| 状态 | 日志清理配置的状态。默认值为“已启用”。 | 'Disabled' 'Enabled' |
ResourceReference
| Name | Description | 价值 |
|---|---|---|
| id | 资源 ID。 | 字符串 |
SecurityPolicyProperties
| Name | Description | 价值 |
|---|---|---|
| parameters | 包含安全策略参数的对象 | SecurityPolicyProperties参数 |
SecurityPolicyProperties参数
| Name | Description | 价值 |
|---|---|---|
| 类型 | 对于 SecurityPolicyWebApplicationFirewallParameters类型,设置为“WebApplicationFirewall”。 对于 类型 SecurityPolicyWebApplicationFirewallParametersWithEmbeddedWafPolicy,设置为“WebApplicationFirewallEmbedded”。 | “Web应用程序防火墙” “WebApplicationFirewallEmbedded”(必需) |
SecurityPolicyWebApplicationFirewallAssociation
| Name | Description | 价值 |
|---|---|---|
| domains | 域列表。 | ActivatedResourceReference[] |
| patternsToMatch | 路径列表 | 字符串[] |
SecurityPolicyWebApplicationFirewallParameters
| Name | Description | 价值 |
|---|---|---|
| associations | Waf 关联 | SecurityPolicyWebApplicationFirewallAssociation[] |
| 类型 | 要创建的安全策略的类型。 | “WebApplicationFirewall”(必需) |
| wafPolicy | 资源 ID。 | ResourceReference |
SecurityPolicyWebApplicationFirewallParametersWithEmbeddedWafPolicy
| Name | Description | 价值 |
|---|---|---|
| associations | Waf 关联 | SecurityPolicyWebApplicationFirewallAssociation[] |
| 类型 | 要创建的安全策略的类型。 | “WebApplicationFirewallEmbedded”(必需) |
| wafPolicy | Web 应用程序防火墙策略的属性。 | Web应用程序防火墙策略 |
Sku
| Name | Description | 价值 |
|---|---|---|
| 姓名 | 定价层的名称。 | “Classic_AzureFrontDoor” “Custom_Verizon” “Premium_AzureFrontDoor” “Premium_Verizon” “StandardPlus_955BandWidth_ChinaCdn” “StandardPlus_AvgBandWidth_ChinaCdn” “StandardPlus_ChinaCdn” “Standard_955BandWidth_ChinaCdn” “Standard_Akamai” “Standard_AvgBandWidth_ChinaCdn” “Standard_AzureFrontDoor” “Standard_ChinaCdn” “Standard_Microsoft” “Standard_Verizon” |
Web应用程序防火墙策略
| Name | Description | 价值 |
|---|---|---|
| etag | 获取在更新资源时更改的唯一只读字符串。 | 字符串 |
| 属性 | Web 应用程序防火墙策略的属性。 | WebApplication防火墙策略属性 |
| sku | Web 应用程序防火墙策略的定价层。 如果未指定,则默认为 Classic_AzureFrontDoor。 | Sku |
WebApplication防火墙策略属性
| Name | Description | 价值 |
|---|---|---|
| 自定义规则 | 描述策略中的自定义规则。 | 自定义规则列表Afd |
| managedRules | 描述策略中的托管规则。 | ManagedRuleSetListAfd |
| policySettings | 描述策略的设置。 | 策略设置Afd |
WebApplicationFirewallScrubbing规则
| Name | Description | 价值 |
|---|---|---|
| matchVariable 的 | 要从日志中清理的变量。 | “QueryStringArgNames” 'RequestBodyJsonArgNames' “请求BodyPostArgNames” “RequestCookieNames” “RequestHeaderNames” “请求 IPAddress” “RequestUri”(必需) |
| 选择器 | matchVariable 是集合时,运算符用于指定此规则应用于的集合中的哪些元素。 | 字符串 |
| selectorMatchOperator | 如果 matchVariable 是集合,请对选择器进行操作,以指定此规则应用于的集合中的哪些元素。 | 'Equals' “EqualsAny”(必需) |
| 状态 | 定义日志清理规则的状态。 默认值处于启用状态。 | 'Disabled' 'Enabled' |