You can't mine on a VM because it uses the hardware features on the actual CPU (in this case AES-NI). Depending on the VM hypervisor, you might be able to expose the AES-NI feature to the VM.
I can confirm that VMware (ESXi and Workstation) and VirtualBox both expose AES-NI to the guest, as I mine XMR in VMs under both of those using xmr-stak-cpu in Linux guests.