How to fix "The logon attempt failed" with Entra ID on Azure VM

Charles Lakes II 45 Reputation points
2026-01-06T23:52:37.97+00:00

I've created the VM, opened the ports, run the curl commands, checked the network security group, and run the CLI command for the AADLoginForWindows extension, but still can't connect to the VM using an Entra ID account.

Microsoft Security | Microsoft Entra | Microsoft Entra ID

Answer accepted by question author
Sridevi Machavarapu 33,820 Reputation points Microsoft External Staff Moderator
2026-01-07T01:00:49.6966667+00:00

Hello Charles Lakes II,

Thank you for connecting with us offline.

Typically, issues signing in to a VM using Entra ID are related to Multi-Factor Authentication (MFA) being enforced through per-user MFA settings, Security Defaults, or Conditional Access policies.

During our call, we observed that users have per-user MFA was enabled for your account. As per standard procedure, we disabled it.

User's image

When we checked Security defaults, it's enabled in your tenant. To disable it, you opted free trial for Premium license and created Conditional Access requiring MFA excluding the "Microsoft Azure Windows Virtual Machine Sign-in" app (App ID: 372140e0-b3b7-4226-8ef9-d57986796201) from the targeted cloud apps.

User's image

However, the sign-in issue persisted. When we verified the device status from command prompt, it's is not Microsoft Entra joined but Microsoft Entra registered Windows 10 or later PC. In that case, you must enter credentials in the AzureAD\UPN format (for example, AzureAD\******@contoso.com) that resolved "The logon attempt failed" error.

User's image

Later, you got new error saying, "The requested session access is denied". This error occurred as you assigned "Virtual Machine User Login" role to user, but RDP session is trying to take over the admin session. To resolve it, edit the RDP file in Notepad and modify below entry setting to 0: administrative session:i:0

Once this is done, you are able to login successfully to VM.

For reference, see this Microsoft Learn article: Sign in to a Windows virtual machine in Azure by using Microsoft Entra ID.

Hope this helps! Please feel free to reach out for any further queries.


If the resolution was helpful, kindly take a moment to click on 210246-screenshot-2021-12-10-121802.pngand Yes for was this answer helpful to close this question.

Was this answer helpful?

0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.