Hi Nick, thanks for explaining the situation. When you’re logging in from a new device or a virtual machine, Microsoft treats it as an untrusted environment, so two-factor authentication is triggered. If you’re not getting the code, it usually means the sign-in attempt is being blocked before the message is sent, often due to network restrictions on the VM or remote desktop, or because the account security settings require additional verification like the Microsoft Authenticator app instead of SMS or email. First, check if the VM has internet access and can reach Microsoft’s servers. Then confirm that your account still lists SMS and email as active sign-in methods under Security Info at account.microsoft.com. If those look good, try signing in from a browser on that VM to see if the prompt appears there. Do you have the Authenticator app set up, or is it only email and SMS? Also, is this VM running behind a corporate firewall or VPN? That can block the verification service. Let me know what you find.
I never receive my code for two-factor authentication
Hi, I have set up two-factor authentication for Windows login, and I can receive the security code either by email or by text to my cell phone. Usually, my personal Windows 11 Surface laptop is a trusted device, and I am not redirected for two-factor authentication. However, when attempting to log in to my Windows account on a different device (e.g., a Windows 10 desktop or laptop), I never receive the security code to complete the authentication process. At the moment, I have set up a Virtual Machine on a remote desktop running Windows 10 and installed Windows 11. To complete the installation, I am asked to log in to my Windows account, but I can't because I don't receive the code. Why? (Both my email address and cell number are correct under my account).
Thanks in advance.
Windows for home | Windows 11 | Security and privacy
-
Rez 13,830 Reputation points Independent Advisor2025-12-11T22:06:41.0233333+00:00
1 additional answer
Sort by: Most helpful
-
Q&A Assist2025-12-11T21:26:49.4166667+00:00 AI generated content. This question contains an answer created with AI from Q&A Assist. Learn moreIf you are not receiving the security code for two-factor authentication when trying to log in to your Windows account on a different device, there are several factors to consider:
- Verification Method: Ensure that you have set up multiple verification methods in your account settings. If one method fails, you can try another. You can select Other verification options during the login process to see if you can receive the code through a different method.
- Account Settings: Double-check that your email address and phone number are correctly configured in your account settings. Sometimes, even a small typo can prevent the delivery of the code.
- Third-Party Apps: If you are using any third-party security apps, they may block the verification code. Try disabling these apps temporarily and request another code.
- Network Issues: Ensure that the device you are using to log in has a stable internet connection. Network issues can affect the delivery of text messages or emails.
- Delivery Reliability: Keep in mind that the delivery of text messages isn't guaranteed and can be affected by factors such as your mobile carrier or signal strength. If you frequently experience issues with receiving codes via text, consider using the Microsoft Authenticator app, which can generate codes even without a cellular signal.
If you have tried these steps and are still unable to receive the code, it may be necessary to contact support for further assistance.
References: