Have you ever made an account for something because you just kind of had to, only to immediately forget about it? If you have a Microsoft account that fits that pattern - and that includes Xbox accounts - you might want to give it a poke soon, because starting August 30, 2019, Microsoft will close any accounts which have been inactive for two years.
The good news is that this policy is really only meant to cull dead, duplicate, or otherwise pointless accounts. Outside of, you know, signing in, there are a number of simple ways to prove and refresh your account's active status. Even if you're an infrequent Microsoft customer but you want to hold onto your account, you should be in the clear.
As Microsoft explained in its new activity policy, maintaining a subscription or making any kind of purchase will extend your account's active status. So if you just use your Microsoft account for an annual subscription to Xbox Live or Microsoft Office or something like that, you're good. You don't need to meticulously catalog your account activity. And even if your subscription expires, you'll have two years after the expiration date until your account is closed.
Likewise, your Microsoft account will never be closed as long as you have an unspent balance or an unpaid credit. So if you have some money on your account, or if Microsoft owes you some money for a refund or what-have-you, your account's fine. And if you have a family account with one or more sub-accounts, the main account won't be closed as long as at least one sub-account is active. If that account holder ages out of the sub-account minor program, that's when the two-year timer will start ticking on the main account. This should really only matter to parents whose kids play Xbox, and by the time they stop being minors, those kids will probably have made their own account anyway.
Those are the most pertinent exceptions, but if you happen to publish something via the Microsoft Store or earn a certification through Microsoft, your account will also remain active indefinitely (unless some really weird legal stuff happens). You can check your account's status and see how long you have until the activity hourglass runs out via the Microsoft account management page. If you're even remotely unsure of where you stand, I'd give it a look just to be safe.