你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

az network front-door routing-rule

注意

此参考是 Azure CLI(版本 2.57.0 或更高版本)的前门扩展的一部分。 该扩展将在首次运行 az network front-door routing-rule 命令时自动安装。 详细了解扩展。

管理 Front Door 路由规则。

命令

名称 说明 类型 状态
az network front-door routing-rule create

创建 Front Door 路由规则。

扩展 GA
az network front-door routing-rule delete

删除 Front Door 路由规则。

扩展 GA
az network front-door routing-rule list

列出 Front Door 路由规则。

扩展 GA
az network front-door routing-rule show

获取 Front Door 路由规则的详细信息。

扩展 GA
az network front-door routing-rule update

更新 Front Door 路由规则。

扩展 GA

az network front-door routing-rule create

创建 Front Door 路由规则。

创建 Front Door 路由规则,将请求转发到后端或将用户重定向到其他 URL。

示例 1:az network front-door routing-rule create -f frontdoor1 -g rg1 --frontend-endpoints DefaultFrontendEndpoint --route-type Forward --backend-pool DefaultBackendPool -n forwardRoutingrule1 --patterns /forward1

示例 2:az network front-door routing-rule create -f frontdoor1 -g rg1 --frontend-endpoints DefaultFrontendEndpoint --route-type Redirect --custom-host redirecthost.com -n redirectRouteRule1 --patterns /redirect1 --custom-query-string querystring。

az network front-door routing-rule create --front-door-name
                                          --frontend-endpoints
                                          --name
                                          --resource-group
                                          --route-type {Forward, Redirect}
                                          [--accepted-protocols]
                                          [--backend-pool]
                                          [--cache-duration]
                                          [--caching {Disabled, Enabled}]
                                          [--custom-forwarding-path]
                                          [--custom-fragment]
                                          [--custom-host]
                                          [--custom-path]
                                          [--custom-query-string]
                                          [--disabled {false, true}]
                                          [--dynamic-compression {Disabled, Enabled}]
                                          [--forwarding-protocol {HttpOnly, HttpsOnly, MatchRequest}]
                                          [--patterns]
                                          [--query-parameter-strip-directive {StripAll, StripAllExcept, StripNone, StripOnly}]
                                          [--query-parameters]
                                          [--redirect-protocol {HttpOnly, HttpsOnly, MatchRequest}]
                                          [--redirect-type {Found, Moved, PermanentRedirect, TemporaryRedirect}]
                                          [--rules-engine]

必需参数

--front-door-name -f

Front Door 的名称。

--frontend-endpoints

前端终结点名称或 ID 的空间分隔列表。

--name -n

路由规则的名称。

--resource-group -g

资源组的名称。 可以使用 az configure --defaults group=<name> 配置默认组。

--route-type

用于定义 Front Door 如何处理此路由的请求的路由类型,即将它们转发到后端或将用户重定向到其他 URL。

接受的值: Forward, Redirect

可选参数

--accepted-protocols

要接受的协议的空间分隔列表。 默认值:Http。

--backend-pool

后端池的名称或 ID。 需要创建转发路由规则。

--cache-duration

需要缓存内容的持续时间。 允许的格式为 ISO 8601 持续时间。

--caching

是否要为此路由启用高速缓存。

接受的值: Disabled, Enabled
--custom-forwarding-path

用于重写此规则匹配的资源路径的自定义路径。 保留为空以使用传入路径。

--custom-fragment

要添加到重定向 URL 的片段。 片段是 #之后 URL 的一部分。 请勿包含 #。

--custom-host

要重定向的主机。 保留为空,以使用传入主机作为目标主机。

--custom-path

要重定向的完整路径。 路径不能为空,必须以 /开头。 将传入路径保留为空,以用作目标路径。

--custom-query-string

要放置在重定向 URL 中的查询字符串集。 设置此值将替换任何现有查询字符串;保留空以保留传入的查询字符串。 查询字符串必须采用 = 格式。 第一个? 和 & 将自动添加,因此不要在前面包含它们,但使用 > 分隔多个查询字符串。

--disabled

创建处于禁用状态。

接受的值: false, true
--dynamic-compression

对缓存内容使用动态压缩。

接受的值: Disabled, Enabled
--forwarding-protocol

用于转发流量的协议。

接受的值: HttpOnly, HttpsOnly, MatchRequest
--patterns

要匹配的模式的空间分隔列表。 默认值:“/*”。

--query-parameter-strip-directive

在形成缓存密钥时处理 URL 查询词。

接受的值: StripAll, StripAllExcept, StripNone, StripOnly
--query-parameters

当分别使用 query-parameter-strip-指令类型 StripAllExcept 或 StripOnly 时,要包含或排除的查询参数(逗号分隔)。

--redirect-protocol

将流量重定向到的目标的协议。

接受的值: HttpOnly, HttpsOnly, MatchRequest
默认值: MatchRequest
--redirect-type

重定向流量时规则将使用的重定向类型。

接受的值: Found, Moved, PermanentRedirect, TemporaryRedirect
默认值: Moved
--rules-engine

规则引擎配置的名称或 ID。 若要取消链接属性“--remove rulesEngine”。

全局参数
--debug

提高日志记录详细程度以显示所有调试日志。

--help -h

显示此帮助消息并退出。

--only-show-errors

只显示错误,取消显示警告。

--output -o

输出格式。

接受的值: json, jsonc, none, table, tsv, yaml, yamlc
默认值: json
--query

JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/

--subscription

订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。

--verbose

提高日志记录详细程度。 使用 --debug 获取完整的调试日志。

az network front-door routing-rule delete

删除 Front Door 路由规则。

az network front-door routing-rule delete --front-door-name
                                          --name
                                          --resource-group

必需参数

--front-door-name -f

Front Door 的名称。

--name -n

路由规则的名称。

--resource-group -g

资源组的名称。 可以使用 az configure --defaults group=<name> 配置默认组。

全局参数
--debug

提高日志记录详细程度以显示所有调试日志。

--help -h

显示此帮助消息并退出。

--only-show-errors

只显示错误,取消显示警告。

--output -o

输出格式。

接受的值: json, jsonc, none, table, tsv, yaml, yamlc
默认值: json
--query

JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/

--subscription

订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。

--verbose

提高日志记录详细程度。 使用 --debug 获取完整的调试日志。

az network front-door routing-rule list

列出 Front Door 路由规则。

az network front-door routing-rule list --front-door-name
                                        --resource-group

必需参数

--front-door-name -f

Front Door 的名称。

--resource-group -g

资源组的名称。 可以使用 az configure --defaults group=<name> 配置默认组。

全局参数
--debug

提高日志记录详细程度以显示所有调试日志。

--help -h

显示此帮助消息并退出。

--only-show-errors

只显示错误,取消显示警告。

--output -o

输出格式。

接受的值: json, jsonc, none, table, tsv, yaml, yamlc
默认值: json
--query

JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/

--subscription

订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。

--verbose

提高日志记录详细程度。 使用 --debug 获取完整的调试日志。

az network front-door routing-rule show

获取 Front Door 路由规则的详细信息。

az network front-door routing-rule show --front-door-name
                                        --name
                                        --resource-group

必需参数

--front-door-name -f

Front Door 的名称。

--name -n

路由规则的名称。

--resource-group -g

资源组的名称。 可以使用 az configure --defaults group=<name> 配置默认组。

全局参数
--debug

提高日志记录详细程度以显示所有调试日志。

--help -h

显示此帮助消息并退出。

--only-show-errors

只显示错误,取消显示警告。

--output -o

输出格式。

接受的值: json, jsonc, none, table, tsv, yaml, yamlc
默认值: json
--query

JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/

--subscription

订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。

--verbose

提高日志记录详细程度。 使用 --debug 获取完整的调试日志。

az network front-door routing-rule update

更新 Front Door 路由规则。

az network front-door routing-rule update --front-door-name
                                          --name
                                          --resource-group
                                          [--accepted-protocols]
                                          [--add]
                                          [--backend-pool]
                                          [--cache-duration]
                                          [--caching {Disabled, Enabled}]
                                          [--custom-forwarding-path]
                                          [--custom-fragment]
                                          [--custom-host]
                                          [--custom-path]
                                          [--custom-query-string]
                                          [--dynamic-compression {Disabled, Enabled}]
                                          [--enabled {Disabled, Enabled}]
                                          [--force-string]
                                          [--forwarding-protocol {HttpOnly, HttpsOnly, MatchRequest}]
                                          [--frontend-endpoints]
                                          [--patterns]
                                          [--query-parameter-strip-directive {StripAll, StripAllExcept, StripNone, StripOnly}]
                                          [--query-parameters]
                                          [--redirect-protocol {HttpOnly, HttpsOnly, MatchRequest}]
                                          [--redirect-type {Found, Moved, PermanentRedirect, TemporaryRedirect}]
                                          [--remove]
                                          [--rules-engine]
                                          [--set]

必需参数

--front-door-name -f

Front Door 的名称。

--name -n

路由规则的名称。

--resource-group -g

资源组的名称。 可以使用 az configure --defaults group=<name> 配置默认组。

可选参数

--accepted-protocols

要接受的协议的空间分隔列表。 默认值:Http。

--add

通过指定路径和键值对将对象添加到对象列表。 示例:--add property.listProperty <key=value, string or JSON string>

默认值: []
--backend-pool

后端池的名称或 ID。 需要创建转发路由规则。

--cache-duration

需要缓存内容的持续时间。 允许的格式为 ISO 8601 持续时间。

--caching

是否要为此路由启用高速缓存。

接受的值: Disabled, Enabled
--custom-forwarding-path

用于重写此规则匹配的资源路径的自定义路径。 保留为空以使用传入路径。

--custom-fragment

要添加到重定向 URL 的片段。 片段是 #之后 URL 的一部分。 请勿包含 #。

--custom-host

要重定向的主机。 保留为空,以使用传入主机作为目标主机。

--custom-path

要重定向的完整路径。 路径不能为空,必须以 /开头。 将传入路径保留为空,以用作目标路径。

--custom-query-string

要放置在重定向 URL 中的查询字符串集。 设置此值将替换任何现有查询字符串;保留空以保留传入的查询字符串。 查询字符串必须采用 = 格式。 第一个? 和 & 将自动添加,因此不要在前面包含它们,但使用 > 分隔多个查询字符串。

--dynamic-compression

对缓存内容使用动态压缩。

接受的值: Disabled, Enabled
--enabled

已启用状态。

接受的值: Disabled, Enabled
--force-string

使用“set”或“add”时,保留字符串文本,而不是尝试转换为 JSON。

默认值: False
--forwarding-protocol

用于转发流量的协议。

接受的值: HttpOnly, HttpsOnly, MatchRequest
--frontend-endpoints

前端终结点名称或 ID 的空间分隔列表。

--patterns

要匹配的模式的空间分隔列表。 默认值:“/*”。

--query-parameter-strip-directive

在形成缓存密钥时处理 URL 查询词。

接受的值: StripAll, StripAllExcept, StripNone, StripOnly
--query-parameters

当分别使用 query-parameter-strip-指令类型 StripAllExcept 或 StripOnly 时,要包含或排除的查询参数(逗号分隔)。

--redirect-protocol

将流量重定向到的目标的协议。

接受的值: HttpOnly, HttpsOnly, MatchRequest
--redirect-type

重定向流量时规则将使用的重定向类型。

接受的值: Found, Moved, PermanentRedirect, TemporaryRedirect
--remove

从列表中删除属性或元素。 示例: --remove property.list <indexToRemove> OR --remove propertyToRemove.

默认值: []
--rules-engine

规则引擎配置的名称或 ID。 若要取消链接属性“--remove rulesEngine”。

--set

通过指定要设置的属性路径和值来更新对象。 示例:--set property1.property2=<value>

默认值: []
全局参数
--debug

提高日志记录详细程度以显示所有调试日志。

--help -h

显示此帮助消息并退出。

--only-show-errors

只显示错误,取消显示警告。

--output -o

输出格式。

接受的值: json, jsonc, none, table, tsv, yaml, yamlc
默认值: json
--query

JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/

--subscription

订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。

--verbose

提高日志记录详细程度。 使用 --debug 获取完整的调试日志。