I had the same issue as OP, spoke to Microsoft who said I didn’t need to change my password. I think these are sent before the password is confirmed.
Comment on I started to get these daily at random hours, even when I'm sleeping. Someone's trying to hack me?
Passerby6497@lemmy.world 4 months ago
Change your password immediately to something you’ve never used before and isn’t similar to current passwords. If you’re getting random 2fa codes, someone is able to complete your first factor, so fix that ASAP.
Luvs2Spuj@lemmy.world 4 months ago
thegreenguy@sopuli.xyz 4 months ago
It might not be 2-factor. Microsoft has an option to log in via email code, which doesn’t need a password.