If you want to install Ubuntu or any other Linux inside a Hyper-V Generation 2 Virtual Machine you need to do a simple change to the VM so you can install it from ISO. If you create a Hyper-V Generation 2 Virtual Machine and try to start the Virtual Machine, the Virtual Machine will not boot from ISO. This is because of the Secure Boot feature, which is included in Hyper-V Generation 2 Virtual Machines and applies to all Linux operating systems running on Hyper-V.
How to Install Linux in a Hyper-V Generation 2 VM
Create a new Virtual Machine in the Hyper-V Manager
On the Hyper-V Virtual Machine Generation selection screen, choose Generation 2
Attach the Ubuntu ISO Image to the virtual machine
After you have created the Virtual Machine using the wizard, go into the settings of the virtual machine. Switch to the Security section and choose the Microsoft UEFI Certificate Authority Secure Boot Template.
Now the Virtual Machine will boot from the Ubuntu ISO, and you can install Ubuntu.