I needed to use Visual Studio Online (VSO) from a remote site where I connected via a VPN and Remote Desktop. I have multi-factor authentication enabled on my Microsoft account. I saw a message stating “We detected something unusual and need to verify your account. Where should we send the code?” I enter the last four digits of my phone number and the wizard took me to the next page. I received the code via SMS and entered it on the second page, then clicked “Next”. The wizard took me back to the page that said “We detected something unusual…” Even though I received many codes and enter them all correctly, this loop repeated and I could not access VSO. Eventually I received the message “You’ve requested too many codes this week. Please try again in a week.”
In this case I was using an account from outlook.com. I resolved the situation using outlook.com, which was actually where the problem originated. I changed the two-factor authentication to use Microsoft Authenticator on my phone. That allowed me to receive more codes. Then I started up Internet Explorer on the remote machine and logged directly into outlook.com using the same Microsoft account. Internet Explorer asked me for the Authenticator code and displayed a check box stating “I sign in often on this device. Don’t ask me for a code.” I entered the Authenticator code and checked the check box. I was then able to view my email. I repeated the process while connecting to VSO and was successful. This link was helpful in identifying the remote computer as a trusted device.