Hello Demy Demza,
Welcome to Microsoft Q&A forum. It's my pleasure to help you today.
I understand that you want to buy the Minecraft realms subscription using the money in your Microsoft account. This depends on the version that you own, Minecraft Java edition was created in 2009, before Microsoft acquire Mojang, so this edition has its own systems for accounts, payments, and game management on Minecraft.net. When you buy the subscription on the Java edition, the purchase will go through Minecraft.net, which doesn't support Microsoft account balance.
The Bedrock edition, which was created after Microsoft acquire Mojang, is tied to the Microsoft ecosystem. The purchase made on the Bedrock edition will go through Microsoft Store and you will be able to use your Microsoft Account balance.
If you have any other questions regarding the purchase, please let me know.
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.