To set the password expiration policy to never expire in Office 365 and Exchange Online you need PowerShell.
Latest posts by Michael Pietroforte (see all)

For some reason, the Office 365 web interface only allows to set the password expiration period to a maximum of 730 days. In the Office 365 admin center, click service settings > passwords.

Office 365 Password Expiration Policy

Office 365 Password Expiration Policy

If you want to set the password expiration policy to never expire, you have to use PowerShell. Since I only need to change the password policy once a year or so, I always find myself googling again to collect the PowerShell cmdlets I need from different web pages. Time to write my own documentation.


This cmdlet connects you to Office 365. It is the same as for Windows Azure and Windows Intune. You’ll have to provide the credentials of an Office 365 admin account after you enter the command.

With the next command, you set the password expiration policy for a single user to never expire:

Set-MsolUser -UserPrincipalName <user ID> -PasswordNeverExpires $true

<user ID> is just the main email address of the mailbox.

To verify the new password policy has been set, you can use this command:

Get-MSOLUser -UserPrincipalName <user ID> | Select PasswordNeverExpires

If you want to set the password policy to never expire for all accounts in your organization, you need this command:

Get-MSOLUser | Set-MsolUser -PasswordNeverExpires $true

And if you want to display the password expiration policy of all users, you have to use this one:

Get-MSOLUser | Select UserPrincipalName, PasswordNeverExpires

Another question is if you reduce the security in your organization if you change the password policy to never expire. If you force your users to change their passwords too often, they will start sticking notes with their passwords on their monitors. In my view, it is better to force users to use strong passwords and work with a long password expiration period. Think of it this way. How much safer will you be if you change the locks of your house every two months or so.

What password expiration policy do you have in your organization?

1 Comment
  1. Nick Bernfeld 7 years ago

    Thanks for the post i made a youtube video People can follow along with your guide here

Leave a reply

Please enclose code in pre tags

Your email address will not be published. Required fields are marked *


© 4sysops 2006 - 2021


Please ask IT administration questions in the forums. Any other messages are welcome.


Log in with your credentials


Forgot your details?

Create Account