Depending on your host, the configuration for connecting a VM to a logical switch can vary.

The supported hosts that can connect to a logical switch are ESXi hosts in a VMware vCenter and standalone ESXi hosts.