Hi Hasan Naqvi,
Thanks for reaching out to Microsoft Q&A.
Here are the steps which you can cross check to see if everything is followed-
Does your phone block texts from unknown numbers? If so, change your phone settings then choose I don't have a code. We'll send another verification code.
Have you added a VOIP number? VOIP numbers cannot be added as a way to sign in or get verification codes. Please add a mobile phone number.
Did your email send your verification code to your junk folder? Check your junk email folder for a message from a Microsoft account, and use the code sent to you. Valid verification codes come from an @accountprotection.microsoft.com email address.
Mark @accountprotection.microsoft.com as a trusted sender to receive your verification code in your inbox.
Is your phone number or email address entered correctly? To keep your information safe when you're signing in, we only show you the last two digits of your phone number or the first two characters of your email address.
To see if your security info is correct:
Sign in to your Security basics page with your Microsoft account. Sign in
Select Update info.
Choose a method that you know works, or choose I don't have any of these to replace your security info.
Does your alternate email address end in @outlook.com, @hotmail.com, @live.com, or @msn.com? If so, you're using one Microsoft account to verify another Microsoft account. This can make it tricky to keep track of which one you're signed in to. When you sign in to the second account (to get the code sent to that email), most browsers automatically sign you out of the first account (the one that's actually requesting the code).
To get your verification code:
- Using a browser in privacy mode, sign in with the first account. This lets you stay signed in to both accounts at the same time.
- When you're prompted to enter the verification code that was sent to your alternate email address, don't close the browser window.
- Open a new window in privacy mode. Ctrl + Shift + P is the shortcut for InPrivate Browsing in Microsoft Edge and Internet Explorer. If you're using a different browser, check that browser's help for info about privacy mode.
- In the new window, sign in to your alternate email account and look for the message from the Microsoft account team. Copy or write down the verification code from the message.
- Return to the window that is asking you for the verification code. Enter the code and follow the instructions.
If still issue exist, kindly contact support team using this link- https://support.microsoft.com/en-US/home/contact?linkquery=Troubleshooting%20verification%20code%20issues
Please do not forget to "Accept the answer” and “up-vote” wherever the information provided helps you, this can be beneficial to other community members.