英文:
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
输出:
如果您需要使用相同的规则名称添加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
输出:
门户:
英文:
> 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:
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:
Portal:
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论