You actually don't have to. You can just install the game and play it. Java Minecraft has no effective anti-piracy checks, which also means it has no effective legal-copy-but-not-using-a-microsoft-account checks. And the auto update URLs have no authorization checks at all. You can go to the root index URL (I don't remember it) and follow a few HATEOAS links to get any version-specific .jar that's available in the official launcher. This is an open secret and they leave it that way on purpose. Most third-party launchers (e.g. PrismLauncher) won't force you to log in before installing the game.
Of course, you should only install the game if you own a license to it. Otherwise that's piracy and it's illegal.