azure cli 2.0如何添加inbound-nat-rule?

时间:2017-03-13 03:23:49

标签: azure azure-cli

作为标题,我尝试使用以下命令执行此操作:

az network nic ip-config inbound-nat-rule add --ip-config-name default-ip-config 
  -g <resource_group> --nic-name <nic_name>  --inbound-nat-rule 
  subscriptions/<subscription_id>/resourceGroups/<rg_name>/providers/Microsoft.Network/loadBalancers/<lb_name>/inboundNatRules/<nat_rule_name>

然后我得到了以下内容:

NoneType' object is not iterable
Traceback (most recent call last):
  File "/Users/goodwill/lib/azure-cli/lib/python2.7/site-packages/azure/cli/main.py", line 37, in main
    cmd_result = APPLICATION.execute(args)
  File "/Users/goodwill/lib/azure-cli/lib/python2.7/site-packages/azure/cli/core/application.py", line 157, in execute
    result = expanded_arg.func(params)
  File "/Users/goodwill/lib/azure-cli/lib/python2.7/site-packages/azure/cli/core/commands/__init__.py", line 343, in _execute_command
    raise ex
TypeError: 'NoneType' object is not iterable

任何人都知道什么是错的?

1 个答案:

答案 0 :(得分:0)

  

添加规则后,您需要从nic端进行关联   将nic私有IP添加到规则

旧的Xplat-CLI和CLI 2.0之间存在一些差异,以下是将现有 NIC与负载均衡器NAT规则相关联的脚本:

az network nic ip-config update -g vm --nic-name nic-name --name ipconfigname --lb-name lbname --lb-inbound-nat-rules natrule

如果要为此NAT规则创建新的VM NIC,请参阅此link