There are two ways how you can redeem a code in your Microsoft account.
The first, a bit quicker option is to redeem it on the Microsoft website. All you need to do is click on this link, log in to your account and enter the product key in the activation window.
The second option is to redeem it in the Microsoft store on your Windows device:
Select Microsoft Store on the taskbar.
Once logged in, in the upper-right corner you will find your avatar - click on it and select Redeem code or gift cards.
Enter the 25-character code, and then select Redeem.