skip to Main Content

I need to associate my rewrite rule set with the routings rules in my Application Gateway in Azure using AZ CLI but I can’t with the commands I have used.

I tried some commands but any doesn’t work.

I need help. I just need to associate my rewrite rule set with the routings rules in my Application Gateway in Azure. And I must do this action with AZ CLI or with some other mechanism that can be automated.

I tried associate the rewrite rules set to my routing rules with these commands:

az network application-gateway rewrite-rule set update `
  --gateway-name <application_gateway> `
  --resource-group <resource_group> `
  --name <rewrite_rule_set> `
  --rule-name <routing_rule>

–> ERROR: ‘–rule-name’ is misspelled or not recognized by the system.

az network application-gateway rewrite-rule set create `
  --resource-group <resource_group> `
  --gateway-name <application_gateway> `
  --name <rewrite rule> `
  --rule-set-type RequestResponse `
  --rule-set-version 1.0 `
  --rule-sequence 100 `
  --action RewriteValue `
  --value <value> `
  --sequence <sequence> `
  --routing-rule-name <routing_rule>

–> But I do not need to create a rewrite rule set. I just need to associate a existing rewrite rule set to my routing rules.

I just need to associate my rewrite rule set to my routing rules in my Application Gateway in Azure. And I must do this action with AZ CLI or with some other mechanism that can be automated.

Please I need some help.

2

Answers


  1. I agree with @Thomas, you can make use of below CLI command to associate existing rewrite rule set with the routing rule:

    az network application-gateway rule update -g <rg_name> --gateway-name <appgateway_name> -n <rule_name> --rewrite-rule-set <rewriteruleset_name>
    

    I have one application gateway named appgw1 with below rules:

    enter image description here

    I created one rewrite rule set named srirewrite without associating it with any rules like this:

    enter image description here

    To associate existing rewrite rule set with rules, I ran below CLI command:

    az network application-gateway rule update -g <rg_name> --gateway-name appgw1 -n rule1 --rewrite-rule-set srirewrite
    

    Response:

    enter image description here

    When I checked the same in Portal, rule1 associated with existing rewrite rule set successfully like below:

    enter image description here

    Login or Signup to reply.
  2. how to disassociate a rule from rewriteset ?

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search