1
votes

Using the Azure CLI, I would like to remove a series of backends from a Front Door backend pool based on their address. But from what I can tell you need to know the position of the backends in the list (the index) rather than pick from the address.

I am using az network front-door backend-pool backend list to get the list of backends, the response does not provide an index to use.

  • Can I remove a backend by the address, or some other identifier, rather than an index?

If I am forced to delete by index:

  • If I list the backends multiple times, can I be guaranteed that they always come back in the same order?
  • If I add a new backend to the pool, is it always the last in the list, and therefore the highest index?
  • If I delete the first backend (index = 1), does that index get replaced with the next in the list?
1

1 Answers

1
votes

Azure CLI only provides a way with an index to remove a backend. But you can use the command below to get the index of a backend that you want to remove by its address:

backends=$(az network front-door backend-pool backend list --resource-group <resource group name> --front-door-name <front door name> --pool-name <pool name>)
echo $backends |jq

echo $backends | jq  '[ .[] | .address == "stantest1016.blob.core.windows.net" ] | index(true) +1' 

Result: enter image description here

It is recommended that query backend list to get the latest list after add/remove backends.