Add Port Groups and VLAN Tags via CLI
Just 2 commands – but if you have to add multiple VM Networks with VLANs, this is very helpful:
esxcli network vswitch standard portgroup add --portgroup-name VM_NETWORK_A --vswitch name vSwitch0
esxcli network vswitch standard portgroup set --portgroup-name VM_NETWORK_A --vlan-id 2020