When creating a NIC, --subnet is a required argument and it says it takes a 'Name or ID of an existing subnet'.
However, if you provide a name, you must also pass in --vnet-name.
If you do not, you get an unhelpful error message.
$ az network nic create -g derek1 -n mynewnic --subnet dvm1Subnet --public-ip-address mynewpublicip
'new' is not valid value for enum <enum 'subnetType'>
The current help for the command is as follows:
$ az network nic create --help
Command
az network nic create
Arguments
--name -n [Required]: Name of the new NIC.
--resource-group -g [Required]: Name of resource group.
--subnet [Required]: Name or ID of an existing subnet.
--internal-dns-name : The internal DNS name label.
--ip-forwarding : Enable IP forwarding.
--lb-address-pools : Space separated list of names or IDs of load balancer address
pools to associate with the NIC. If names are used, --lb-name
must be specified.
--lb-inbound-nat-rules : Space separated list of names or IDs of load balancer inbound
NAT rules to associate with the NIC. If names are used, --lb-
name must be specified.
--lb-name : The name of the load balancer to use when adding NAT rules or
address pools by name (ignored when IDs are specified).
--location -l : Location.
--network-security-group : Name or ID of an existing network security group to associate
with the NIC.
--private-ip-address : Static private IP address to use.
--private-ip-address-version : The private IP address version to use. Allowed values: ipv4,
ipv6. Default: ipv4.
--public-ip-address : Name or ID an existing public IP address to associate with the
NIC.
--tags : Multiple semicolon separated tags in 'key[=value]' format. Omit
value to clear tags.
--vnet-name : The virtual network (VNet) associated with the provided subnet
name (Omit if supplying a subnet id).
Help for --vnet-name should instead say (Required if subnet name instead of id supplied). This would be better than (Omit if supplying a subnet id) because asking the user to omit the parameter when they likely would not have known to add it in the first place is a bit backwards IMO.
When I specifed subnet id instead of name, the NIC creation worked as expected.
When creating a NIC, --subnet is a required argument and it says it takes a 'Name or ID of an existing subnet'.
However, if you provide a name, you must also pass in --vnet-name.
If you do not, you get an unhelpful error message.
The current help for the command is as follows:
Help for
--vnet-nameshould instead say(Required if subnet name instead of id supplied). This would be better than(Omit if supplying a subnet id)because asking the user to omit the parameter when they likely would not have known to add it in the first place is a bit backwards IMO.When I specifed subnet id instead of name, the NIC creation worked as expected.