Can I "transfer" my Windows 7 license to a virtual machine running on the same computer?
Section 3d of both the OEM and Retail licenses of the ones I checked (Windows 7 Professional and Windows 7 Home Premium) state:
d. Use with Virtualization Technologies. Instead of using the software directly on the licensed computer, you may install and use the software within only one virtual (or otherwise emulated) hardware system on the licensed computer.
Since the poster's machine is the licensed computer and will be running Ubuntu as a host OS with Windows running in a single VM on a virtual hardware system on the same licensed computer, then according to this, it's okay.
https://www.microsoft.com/en-us/useterms
You're allowed to do this if Microsoft allows you to do this. This sounds like a non-answer but keeping this in mind helped me move my OEM license to a VM, free and clear, with the help of Microsoft support.
Get your product key first from the original OEM-install of Windows by entering wmic path softwarelicensingservice get OA3xOriginalProductKey
at an administrator command prompt.
Then move the OEM Windows to a VM somehow (e.g. via VMware's free vCenter Converter), enter slui 4
at the command prompt, and follow the instructions for activating over the phone. You may need to call back a few times to get a cooperative support associate but it's worth the effort.