如何在“az network application-gateway rule create”命令中指定多个url-path-map?

huangapple go评论68阅读模式
英文:

How to specify more than 1 url-path-map in the command of az network application-gateway rule create

问题

这个命令中涉及的部分是这样的:

az network application-gateway rule create --gateway-name --name --resource-group [--address-pool] [--http-listener] [--http-settings] [--no-wait {0, 1, f, false, n, no, t, true, y, yes}] [--priority] [--redirect-config] [--rewrite-rule-set] [--rule-type {Basic, PathBasedRouting}] [--url-path-map]

我有两个名为MyPathMap2和MyPathMap3的url-path-map。

但如果我想要有2个或更多的路径,我不知道如何修改命令以接受多个路径映射。

根据文档,我应该使用参数**--rule-type PathBasedRouting**,然后使用以下命令创建具有一个路径映射的规则:

az network application-gateway rule create --gateway-name --name --resource-group --address-pool --http-listener --http-settings --rule-type PathBasedRouting --url-path-map MyPathMap2 --priority
英文:

The command in question is this:

az network application-gateway rule create --gateway-name --name --resource-group [--address-pool] [--http-listener] [--http-settings] [--no-wait {0, 1, f, false, n, no, t, true, y, yes}] [--priority] [--redirect-config] [--rewrite-rule-set] [--rule-type {Basic, PathBasedRouting}] [--url-path-map]

I have 2 url-path-map named MyPathMap2 and MyPathMap3.

But if I want it to have 2 or more paths I do not know how to modify the command so that it accepts more than 1 path-map.

According to the documentation, I should use the parameter --rule-type PathBasedRouting, then to create the rule with 1 single path-map I use the command:

az network application-gateway rule create --gateway-name --name --resource-group --address-pool --http-listener --http-settings --rule-type PathBasedRouting --url-path-map MyPathMap2 --priority

答案1

得分: 0

以下是翻译好的部分:

希望它具有2个或更多的路径,我不知道如何修改命令以接受多于1个路径映射。

据我所知,我们无法在创建应用程序网关网络规则时传递2个URL路径映射。

您可以按照这个 MS-文档 来创建URL路径映射并添加到规则名称中。

在创建应用程序网关规则时,您可以创建单个URL路径映射。

命令:

我使用以下命令为单个URL路径映射创建了规则。

az network application-gateway rule create \
  --gateway-name myAppGateway \
  --name rule2 \
  --resource-group myResourceGroupAG \
  --http-listener backendListener \
  --rule-type PathBasedRouting \
  --url-path-map myPathMap \
  --address-pool appGatewayBackendPool \
  --priority 200

输出:
如何在“az network application-gateway rule create”命令中指定多个url-path-map?

如果您需要使用相同的规则名称添加URL路径映射,可以使用以下命令。

命令:

az network application-gateway url-path-map rule create \
  --gateway-name myAppGateway \
  --name videoPathRule \
  --resource-group myResourceGroupAG \
  --path-map-name myPathMap \
  --paths /video/* \
  --address-pool videoBackendPool \
  --http-settings appGatewayBackendHttpSettings

输出:
如何在“az network application-gateway rule create”命令中指定多个url-path-map?

门户:
如何在“az network application-gateway rule create”命令中指定多个url-path-map?

英文:

> Want it to have 2 or more paths I do not know how to modify the command so that it accepts more than 1 path-map.

AFAIK, we can't pass the 2 URL path-map while creating an application gateway network rule.

You can follow this MS-Document to create URL path map to add in the rule name.

You can create a single Url path map while creating an application gateway rule.

Command:

I have created a rule for a single URL path map with the below command.

az network application-gateway rule create \
  --gateway-name myAppGateway \
  --name rule2 \
  --resource-group myResourceGroupAG \
  --http-listener backendListener \
  --rule-type PathBasedRouting \
  --url-path-map myPathMap \
  --address-pool appGatewayBackendPool \
  --priority 200

Output:
如何在“az network application-gateway rule create”命令中指定多个url-path-map?

If you need to add the Url path map with the same rule name, you can use the command below.

Command:

az network application-gateway url-path-map rule create \
  --gateway-name myAppGateway \
  --name videoPathRule \
  --resource-group myResourceGroupAG \
  --path-map-name myPathMap \
  --paths /video/* \
  --address-pool videoBackendPool \
  --http-settings appGatewayBackendHttpSettings

Output:
如何在“az network application-gateway rule create”命令中指定多个url-path-map?

Portal:
如何在“az network application-gateway rule create”命令中指定多个url-path-map?

huangapple
  • 本文由 发表于 2023年5月11日 07:27:54
  • 转载请务必保留本文链接:https://go.coder-hub.com/76223198.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定