- You can create as many VMs as you like. There is no limit beyond your hardware.
You need to properly license all the VMs you create, if they require a license. Windows and some Linux distributions require a valid license to be in your terms "legal." If you're installing Debian or Ubuntu, for example, no license is required, as they don't have a "license" in the same way as a Windows "license."
Hyper-V won't prevent you from installing more Windows VMs than you have a license for.
There are two licensing schemes per core and per VM, per VM is only available for subscription licenses and Software Assurance.
For per core, which is what you seem to be asking about:
When all cores on the server are licensed (subject to a minimum of 8 core licenses per physical processor and a minimum of 16 core licenses per server), Standard has rights to use two OSEs (operating system environments) or two Windows Server containers with Hyper-V isolation and unlimited Windows Server containers without Hyper-V isolation, if the physical Windows Server is used solely to host and manage the virtual OSEs.
- If you want more than two instances, you need to stack:
When licensed based on physical cores, Windows Server Standard has rights to use two operating system environments (OSEs) or two Windows Server containers with Hyper-V isolation and unlimited Windows Server containers without Hyper-V isolation (licenses equal to the physical cores on the server are assigned (subject to a minimum of 8 core licenses per physical processor and a minimum of 16 core licenses per server). Once a server is licensed, customers may wish to license the server for additional OSEs or Hyper-V containers. This practice is often referred to as “stacking” and is allowed with Standard edition.
See:
https://www.microsoft.com/en-us/licensing/product-licensing/windows-server
https://aka.ms/WindowsServerLicensingGuide
Download the Windows Server Licensing guide for a lot more information and examples.