A cloud-based identity and access management service for securing user authentication and resource access
Hi Rico,
Before you tune the policy, I'd check one thing. With device code phishing, the attacker usually ends up with tokens, not just the password, and a password reset doesn't always cut off everything they obtained. If the attempts still raise user risk a week later, they may not be failing the way you think.
1. Check the error code of the hostile attempts
In Sign-in logs, filter by the attacker's IP and look at both Interactive and Non-interactive user sign-ins:
| What you see | Meaning |
|---|---|
50126 (invalid username or password), interactive only |
The attacker really only has the old password, so this is the case the existing answer covers |
53003 / 530032 (blocked by Conditional Access) |
First-factor authentication succeeded. Your IP block stopped them, but they hold a valid credential or token |
| Entries under Non-interactive with a refresh token | They are replaying a token from the phishing session |
2. If it's anything other than 50126, finish the remediation
Connect-MgGraph -Scopes "User.ReadWrite.All","Directory.ReadWrite.All","UserAuthenticationMethod.ReadWrite.All"
$upn = "******@contoso.com"
Get-MgUserRegisteredDevice -UserId $upn | ForEach-Object { Get-MgDevice -DeviceId $_.Id } |
Select-Object DisplayName, OperatingSystem, RegistrationDateTime # remove anything created after the phishing date
Get-MgUserAuthenticationMethod -UserId $upn # remove methods the user doesn't recognise
Revoke-MgUserSignInSession -UserId $upn # invalidate all refresh tokens
Device code phishing campaigns often register a device to get a Primary Refresh Token, so the device list matters most. Also check Enterprise apps → User consents for apps the user didn't approve.
3. Prevent it from happening again
Create a Conditional Access policy for all users, with Conditions → Authentication flows → Device code flow and the grant Block. Exclude only the accounts that really need device code (for example, meeting room devices).
Once the attacker's credentials and tokens are gone, the new risk events should stop. If they still show 50126 after this, open a support case with the correlation IDs, as the other answer suggests.