Microsoft says that they plan on closing inactive accounts, including Xbox Live accounts, after two years of inactivity.
Before you get tied up in knots, you should know that there are several exceptions. If you have ever purchased a “Microsoft product or service,” your account will not close due to inactivity. This exception does not include subscription-based purchases or services, so Xbox Live subscriptions won’t save your account from deletion unless it is a currently-active subscription.
Your account is also exempt from deletion if you have an unspent balance or any amount owed to you from a refund. This includes any physical or digital gift card balances that remain on your Xbox Live account.
A final exception is made for family accounts:
If you have an inactive Microsoft account that has granted consent for an active Microsoft account belonging to a minor, Microsoft will not close your Microsoft account due to your inactivity. Your inactive Microsoft account will be kept open by Microsoft until the minor’s account (i) is deemed inactive and closed by Microsoft, (ii) is closed by you, or (iii) transitions into a standard Microsoft account when the minor reaches the requisite age of majority in their region.
If you do not qualify for one of the exceptions, all you have to do is sign in to your Microsoft or Xbox Live account once every two years to keep it active.