简体   繁体   English

Azure CLI:无法更新NIC参数

[英]Azure CLI: unable to update NIC parameters

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. 因此,我需要编写脚本来从NIC分离Load Balancer的后端池,以更新我们的运行中的计算机,但是从CLI更新NIC时遇到一个奇怪的问题。

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. 我可以使用--set或remove键将整个'loadBalancerBackendAddressPools'组设置为null,但是当这是组中的最后一个属性时-我无法更新它。

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? 顺便说一句,有没有办法用JSON或其他方式更新整个属性组? 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 Python 2.7.12

azure-cli 2.0.7 天蓝色cli 2.0.7

You could try to use the following commands to detach NIC from Load Balancer backend pools. 您可以尝试使用以下命令从负载均衡器后端池分离NIC。

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. 另外,您可以使用Azure CLI将NIC添加到后端池。

az network nic update -g ${resource-group} --name ${nic-name} --add ipConfigurations[name=${ip-config}].loadBalancerBackendAddressPools id=${backend-address-pool-id}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM