I (PC) want to play Minecraft with a friend (PS4). Now I found out that you have to connect your Microsoft and Mojang accounts. I don't know how.
No that would not work would also bring nothing. You must have Windows 10 installed and buy and download Windows 10 Edition from the Microsoft Store Minecraft then you can't play with your friend otherwise.
Minecraft Java Edition and PS4 Edition are like two different games. You can't play them across platforms.