How to set user password expired immediately??

%3CLINGO-SUB%20id%3D%22lingo-sub-913002%22%20slang%3D%22en-US%22%3EHow%20to%20set%20user%20password%20expired%20immediately%3F%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-913002%22%20slang%3D%22en-US%22%3E%3CP%3EHi!%26nbsp%3B%20Is%20it%20possible%20to%20set%20an%20user's%20password%20expired%20immediately%3F%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-913002%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EOffice%20365%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3ESecurity%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-913022%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20set%20user%20password%20expired%20immediately%3F%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-913022%22%20slang%3D%22en-US%22%3E%3CP%3ESome%20context%20might%20help%3F%20You%20can%20force%20the%20user%20to%20change%20his%20password%20if%20that's%20what%20you%20mean.%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-913115%22%20slang%3D%22en-US%22%3ERE%3A%20How%20to%20set%20user%20password%20expired%20immediately%3F%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-913115%22%20slang%3D%22en-US%22%3EI%20am%20trying%20to%20test%20my%20app's%20error%20handling.%20One%20of%20which%20is%20handling%20when%20the%20user's%20password%20has%20expired.%20Specifically%2C%20I%20am%20trying%20to%20get%20the%20exception%20message%20%22Authentication%20Error%3A%20Password%20has%20expired.%22%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-914226%22%20slang%3D%22en-US%22%3ERE%3A%20How%20to%20set%20user%20password%20expired%20immediately%3F%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-914226%22%20slang%3D%22en-US%22%3E%3CP%3EHi%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F425839%22%20target%3D%22_blank%22%3E%40LennartSkyKick%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIf%20this%20is%20a%20cloud-only%20account%20you%20can%20try%20the%20following%20powershell%20to%20force%20the%20user%20to%20change%20password%20on%20next%20sign%20in%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ESet-MsolUserPassword%20-UserPrincipalName%20%3CYOUR%20user%3D%22%22%3E%20-ForceChangePassword%20%24true%3C%2FYOUR%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThis%20is%20what%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F58%22%20target%3D%22_blank%22%3E%40Vasil%20Michev%3C%2FA%3E%26nbsp%3Bwas%20talking%20about%20and%20should%20provide%20a%20the%20response%20that%20the%20password%20needs%20to%20be%20changed.%3C%2FP%3E%3C%2FLINGO-BODY%3E
Highlighted
New Contributor

Hi!  Is it possible to set an user's password expired immediately? 

3 Replies
Highlighted

Some context might help? You can force the user to change his password if that's what you mean. 

Highlighted
I am trying to test my app's error handling. One of which is handling when the user's password has expired. Specifically, I am trying to get the exception message "Authentication Error: Password has expired."
Highlighted

Hi @LennartSkyKick 

 

If this is a cloud-only account you can try the following powershell to force the user to change password on next sign in:

 

Set-MsolUserPassword -UserPrincipalName <your user> -ForceChangePassword $true

 

This is what @Vasil Michev was talking about and should provide a the response that the password needs to be changed.