Microsoft might delete Microsoft accounts if you don't sign in for two years. An updated policy on a Microsoft support site (via MSPU) states that users must keep accounts active, or Microsoft reserves the right to close accounts.

To keep an account active, a user has to sign in at least once every two years. There are also a number of exceptions that keep your account marked as "active:"

Purchases. If you have used your Microsoft account to purchase, or to redeem or access a purchase of, a current Microsoft product or service, your Microsoft account will remain active and Microsoft will not close your account due to inactivity. Note, this does not apply to gift cards, certifications or subscription-based purchases or services.

Subscriptions. Your Microsoft account will continue to remain active for so long as you have an active Microsoft subscription associated with your Microsoft account. Following the expiration or termination of the subscription, you must sign in to your Microsoft account at least once in a two-year period to keep your account active.

Publishing to the Microsoft Store. If you have used your Microsoft account to publish applications or games (including game DLCs) to the Microsoft Store or to register for a Microsoft Partner Center account, your Microsoft account will remain active and Microsoft will not close your account due to inactivity.

Certifications. If you earn a certification from Microsoft using your Microsoft account, your Microsoft account will remain active and Microsoft will not close your account due to inactivity.

Account Balance. Your Microsoft account will continue to remain active for so long as you have an unspent balance in your Microsoft account (e.g. from a Microsoft gift card or a credit from Microsoft). If you live in a jurisdiction where gift cards are considered "unclaimed property," Microsoft will, pursuant to local law, escheat the unspent balance associated with your Microsoft gift card.

Accounts Payable. Your Microsoft account will continue to remain active for so long as there is an amount owed to you by Microsoft associated with your Microsoft account (e.g. amounts due to you from Microsoft Payment Central).

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.

Legal Requirements or as otherwise provided by Microsoft. Notwithstanding the foregoing, Microsoft reserves the right to maintain your account status as active, or not to close an inactive account, as required by applicable law or regulation, or as otherwise provided by Microsoft to you.

The list of exceptions is rather long. When combined with the two years required to be marked as inactive, it's unlikely this will happen to someone by accident. Still, it's important for Microsoft to clarify these types of policies. The policy goes into effect on August 30, 2019.