Remote Desktop error 0x904 (Extended Error 0x7) typically indicates a general network connection issue where the client and remote server cannot establish or maintain a stable handshake
If after these steps you're still encountering issues, it might be helpful to:
On the Remote PC, right-click "This PC" and go to Properties.
Steps:
Verify that the host pool is "Healthy" in the Azure portal. If the status is "Needs Assistance" or "Unavailable," the 0x904 error is just a symptom of the VM being stuck in a boot loop or update state.
Open Command Prompt as Administrator and run: restart-service termserv -force (or restart the "Remote Desktop Services" in services.msc).