So i need to script detaching Load Balancer's backend pool from NIC to update our live machines, but i have a strange problem while updating NIC from CLI.
I can set whole 'loadBalancerBackendAddressPools' group to null with --set or remove key, but when this is a last property in a group - i can't update it.
az network nic update --resource-group MyPreciousGroup -n machineNetworkInt01020 --set ipConfigurations.[0].loadBalancerBackendAddressPools.[0].backendIpConfigurations=null
this throws an error:
Operation failed with status: 'Not Found'. Details: 404 Client Error: Not Found for url: https://management.azure.com/subscriptions/00000000-1234-1234-1234-0000000000/providers/Microsoft.Network/locations/australiaeast/operations/1111111-1234-1234-1234-1111111111?api-version=2017-03-01
Btw, is there a way to update whole property group with JSON or something? All that i want to setup after machine updates with parameters below:
loadBalancerBackendAddressPools": [
{
"backendIpConfigurations": null,
"etag": null,
"id": "/subscriptions/111111111-1111-1111-1111-111111111111/resourceGroups/MyEnvironment-AustraliaEast/providers/Microsoft.Network/loadBalancers/MyLoadBalancer/backendAddressPools/MyBackendPool",
"loadBalancingRules": null,
"name": null,
"outboundNatRule": null,
"provisioningState": null,
"resourceGroup": "MyEnvironment-AustraliaEast"
}
],
Python 2.7.12
azure-cli 2.0.7
You could try to use the following commands to detach NIC from Load Balancer backend pools.
az network nic update -g <your group name> -n <nic name> --set ipConfigurations[name=<ip-config-name>].loadBalancerBackendAddressPools=[]
Following script is an example, it works for me.
az network nic update -g shuiload -n shui0 --set ipConfigurations[name=ipconfig1].loadBalancerBackendAddressPools=[]
Also, you could use Azure CLI to add NICs to backend pools.
az network nic update -g ${resource-group} --name ${nic-name} --add ipConfigurations[name=${ip-config}].loadBalancerBackendAddressPools id=${backend-address-pool-id}