I already have a Microsoft account with Windows on my laptop, I have now built a pc myself. Do I have to buy an extra license key for windows or is it enough if I log in with the Microsoft account.
A Windows key has to be bought (regularly), unless you have a key from a Windows 7 or Windows 8 edition. That should / could also be accepted during the installation.
A license key is required to use Windows. This license is usually preinstalled on finished computers.
Well that would have been way too nice if you only get Windows 10 for free with your own Microsoft account. But unfortunately that's not how it is. Unfortunately you have to buy the license. Otherwise you have to use Linux, because it is really 100% free and without any account registration.
In principle, you can use a Microsoft account to transfer a Windows 10 license from another computer. Provided the license was linked to the Microsoft account. How to do it is written there:
https://support.microsoft.com/...are-change
You can only use the license on one computer. So either or. Using a license on multiple computers at the same time would be a license violation and illegal. Plus, that shouldn't work either, at least not if the license is linked to a Microsoft account. If you sold the old laptop with Windows 10 activated, then you also resold the license. If this is still linked to your Microsoft account, then you should remove the link from your account, because you no longer own the license. If you reactivate the license on your new computer in this way, although you previously sold the license together with the laptop, then you would commit a criminal offense and the buyer could hold you accountable, or whatever it is called.
https://www.pc-magazin.de/ratgeber/pc-mit-windows-10-verkaufen-lizenz-aktivierung-microsoft-konto-was-tun-3196484.html
https://itigic.com/de/unlink-windows-10-license-from-your-pc/
Oh yes, the real question: Well, no, it doesn't work the way you imagine it. You need another Windows 10 license for the second computer, which you have to buy. Explanation is above in the answer.