Azure-cli: az webapp traffic-routing set using slotname for distribution causes invalid traffic routing

Created on 18 Jan 2019  Â·  4Comments  Â·  Source: Azure/azure-cli

For https://docs.microsoft.com/en-us/cli/azure/webapp/traffic-routing?view=azure-cli-latest#az-webapp-traffic-routing-set the docs states that you can do az webapp traffic-routing set --resource-group ***** --name **** --distribution staging=50 .... This will result in an invalid traffic routing 50% of the traffic to staging.azurewebsites.net.

>az webapp traffic-routing show --resource-group ***** --name ****
[
  {
    "actionHostName": "staging.azurewebsites.net",
    "changeDecisionCallbackUrl": null,
    "changeIntervalInMinutes": null,
    "changeStep": null,
    "maxReroutePercentage": null,
    "minReroutePercentage": null,
    "name": "staging",
    "reroutePercentage": 50.0
  }
]

What is very confusing though is that the Azure portal shows this:
image

The correct notation apparently is az webapp traffic-routing set --distribution [nameofwebapp]-staging=50 ... meaning that you have to provide the hostname of the slot instead of the name of the slot. Either the documentation is wrong or the CLI is creating an invalid traffic routing when using this command.


Document Details

⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

bug

Most helpful comment

@panchagnula I ran this command az webapp traffic-routing set --resource-group ***** --name **** --distribution staging=50 ... (I omitted the actual names of the resource group and webapp here but those were provided as well). And I got this as a result:

>az webapp traffic-routing show --resource-group ***** --name ****
[
  {
    "actionHostName": "staging.azurewebsites.net",
    "changeDecisionCallbackUrl": null,
    "changeIntervalInMinutes": null,
    "changeStep": null,
    "maxReroutePercentage": null,
    "minReroutePercentage": null,
    "name": "staging",
    "reroutePercentage": 50.0
  }
]

As you can see 50% of the traffic is now directed to staging.azurewebsites.com instead off {web app name}-staging.azurewebsites.com. I have to provide --distribution {web app name}-staging=50 to the az webapp traffic-routing set command for it to work whereas I would expect that just providing the slot name in --distribution and the webapp name in --name would be sufficient. This is also what the docs suggest, but that does not work correctly.

All 4 comments

the name should be the {web app name}-{slot name} , i think a good solution would be to update the command to have a -name & -slot & required properties let me talk to some folks on the team & update this issue

@sanderaernouts, i re-looked at this & i am confused about what the expectation is, for Traffic-Routing the overall distribution should be 100%, so in the example above, when staging is set to 50%, the other resource, which is the production app should be 50%.

Also, when running the command, to set traffic routing use -n parameter which should be name of the app.

@panchagnula I ran this command az webapp traffic-routing set --resource-group ***** --name **** --distribution staging=50 ... (I omitted the actual names of the resource group and webapp here but those were provided as well). And I got this as a result:

>az webapp traffic-routing show --resource-group ***** --name ****
[
  {
    "actionHostName": "staging.azurewebsites.net",
    "changeDecisionCallbackUrl": null,
    "changeIntervalInMinutes": null,
    "changeStep": null,
    "maxReroutePercentage": null,
    "minReroutePercentage": null,
    "name": "staging",
    "reroutePercentage": 50.0
  }
]

As you can see 50% of the traffic is now directed to staging.azurewebsites.com instead off {web app name}-staging.azurewebsites.com. I have to provide --distribution {web app name}-staging=50 to the az webapp traffic-routing set command for it to work whereas I would expect that just providing the slot name in --distribution and the webapp name in --name would be sufficient. This is also what the docs suggest, but that does not work correctly.

I totally agree with you sander, i am facing the same problem. According to the deployment script generated by Azure, I should put these parameters :

"actionHostName": "[concat('**************-blue.azure', parameters('config_web_name'),'sites.net')]",
                        "reroutePercentage": 20,
                        "changeStep": null,
                        "changeIntervalInMinutes": null,
                        "minReroutePercentage": null,
                        "maxReroutePercentage": null,
                        "changeDecisionCallbackUrl": null,
                        "name": "Blue"

But with az webapp traffic-routing i can only generate this one :
{
```
"actionHostName": "blue.azurewebsites.net",
"changeDecisionCallbackUrl": null,
"changeIntervalInMinutes": null,
"changeStep": null,
"maxReroutePercentage": null,
"minReroutePercentage": null,
"name": "blue",
"reroutePercentage": 35.0

  }
Or this one : 
{
   ```
 "actionHostName": "**************-Blue.azurewebsites.net",
    "changeDecisionCallbackUrl": null,
    "changeIntervalInMinutes": null,
    "changeStep": null,
    "maxReroutePercentage": null,
    "minReroutePercentage": null,
    "name": "*************-Blue",
    "reroutePercentage": 35.0

}

So it doesn't work because they are conflicts between the rule generated with Azure CLI and existing ones.

Was this page helpful?
0 / 5 - 0 ratings