To activate the key go to https://minecraft.net/user/redeem and click “register for a Mojang account” or login if you already have an account. Choose “redeem gift code or prepaid card” option and type in your code. Please remember to type the key without spaces nor pauses.
Choose the Xbox app from the results to open the app. Select your gamerpic in the top-left corner, and then select Settings. Select Redeem under Redeem a code. Enter the 25-character code, select Next, and then follow the prompts.