Cannot RDP to Azure VM (error 0x904)


Posted On June 5, 2025

Today I had a annoying problem in a Azure Virtual machine that would give me an instant error when trying to login using RDP. The error was:
This computer can’t connect to the remote computer. Error code: 0x904, Extended error code 0x7.
and:
This computer can’t connect to the remote computer. Error code: 0x4, Extended error code 0x7.

mstsc jtewh9asw8

Table of Contents

Why is RDP giving this error?

After searching the internet I couldn’t find a satisfying answer and I started digging into the problem using the Azure Console. This didn’t give any conclusive answers so I went to the next troubleshooting tool

image

From the Azure Portal it is possible to Run PowerShell scripts.

image

After a while I found out that everything relying on certificates returned an error around certificates, either corrupt certificate store and for RDP, cannot create a new self signed certificate:

image

How to resolve?

The resolution is actually simple, we need to rename the MachineKeys store and reboot the server.

From the Azure Portal go to the VM and select Run Command and then RunPowerShellScript:

Rename-Item -path "C:\ProgramData\Microsoft\Crypto\RSA\MachineKeys" -NewName "MachineKeys_old"
image

Reboot your machine and you should be good to go again!


Share this content:

I am a passionate blogger with extensive experience in web design. As a seasoned YouTube SEO expert, I have helped numerous creators optimize their content for maximum visibility.

Leave a Comment