There is a great Microsoft Learn article which will help you with this task with the step-by-step instructions, which can be found here:
https://learn.microsoft.com/en-us/azure/virtual-machines/windows/prepare-for-upload-vhd-image
It will guide you through the pre-sysprep steps necessary to get the image ready for VHD generalisation & sysprep.
Once you are in a ready state with your prepared VHD image, you can check out this article to see ways to upload the VHD into Azure so you can attach it to a virtual machine:
If this has been useful, please feel free to mark as accepted. Any questions do feel free to reply to me.