Go to https://www.xbox.com
Login to your account
Hover over your account link (the top right of the screen) a menu will appear, click on the “Redeem Code” button.
On the next page, click “Redeem”
Enter your code
Click “Confirm” again to assign the key to your account.