This Office 365 tutorial explains, how to set Office 365 password policy, and also, we will see how to set password to never expire in Office 365. Also, we will see, how to set up password expiration in office 365 and how to set up the password policy in Office 365 using PowerShell
Also, we will see how to set a password never expire in office 365 for a single user using PowerShell.
How to Set Office 365 Password Policy
After I sign up for an Office 365 trial, I created some users in Office 365. We can also easily set up password expiration in office 365 for all the users.
From the Microsoft 365 admin center, we can set the password expiration policy in just few clicks.
Login Microsoft 365 admin center.
Then click on Settings -> Settings. Then click on Security & privacy and click on Password expiration policy like below:

Then check the checkbox “Set user passwords to expire after a number of days”
If it is unchecked, then the password will never expire for all the users in Office 365.
Here, it will ask you to enter below values:
- Days before password expire
- Days before a user is notified about expiration

But you have enter values:
- Days before passwords expire, should be between 14 to 730
- Days before a user is notified about expiration, should be between 1 and 30

How to Set Office 365 Password Policy using PowerShell
Now, we will see how to set office 365 password policy using PowerShell.
We can use Microsoft Azure AD Module for Windows PowerShell to set a password never expire in office 365 for a single user.
If you have not installed Azure AD cmdlets, then run the below command:
Install-Module AzureAD
Once installed successfully, run the below command to connect to Azure AD.
Connect-AzureAD
To set the password never expire in office 365 for single user, run the below command:
Set-AzureADUser -ObjectId -PasswordPolicies DisablePasswordExpiration
Example: Set-AzureADUser -ObjectId user@tenantname.onmicrosoft.com -PasswordPolicies DisablePasswordExpiration
To set the password never expire in office 365 for all users in your organization, run the below command:
Get-AzureADUser -All $true | Set-AzureADUser -PasswordPolicies DisablePasswordExpiration
We can also use MSOnline module to set password never expire in office 365 for a single user or for all the users in the organization.
If you have not installed MSOnline, run the below command to install MSOnline.
Install-Module MSOnline
One installed successfully, to connect to MSOnline, run the below command.
Connect-MSOLService
To set password never expire for all the users in your organization in office 365, run the below command.
Set-MSOLUser –PasswordNeverExpires $true
To set a password never expire in office 365 for a single user run the below command.
Set-MsolUser -UserPrincipalName alias user@tenant.onmicrosoft.com -PasswordNeverExpires $true
Office 365 Password Guidelines
You can set Office 365 password guidelines for administrators as well as users.
- Minimum 8 characters length
- Password complexity like allow uppercase, lowercase, and numbers, special characters
- Should not give common passwords
- It is advisable to not use the same password which is common to all your other web sites.
- Don’t use single-word passwords
- Make password hard to guess etc
Set password to never expire Office 365
Now, let us see how to set password to never expire in office 365. We can easily set password to never expire for all users in your organization from Microsoft 365 admin center.
Open Microsoft 365 admin center -> Settings -> Org settings -> then in Org settings page, click on Security & privacy like below:

This will open the Password expiration policy page, where you can see the “Set user passwords to expire after a number of days” will be checked and you will see, Days before passwords expire to 90 days and Days before a user is notified about expiration 14 days like below:

To set password to never expire in Office 365 for all users in the organization, uncheck the checkbox, “Set user passwords to expire after a number of days” like below, then click on the Save button.

In this way, we can set password to never expire in Office 365 or Microsoft 365 for all users in the organization.
How do I set my Office 365 password to never expire
How do I set my Office 365 password to never expire? In Microsoft 365 admin center, there is no option to set Office 365 password to never expire for an individual user. But we can do it using Set-MsolUser PowerShell.
Run the below PowerShell command using PowerShell ISE.
$credential = Get-Credential (When prompt, please enter Office 365 global account credentials)
Connect-MsolService -Credential $credential
Set-MsolUser -UserPrincipalName bijay@tsinfotechnologies.onmicrosoft.com -PasswordNeverExpires $true
This is an example of office 365 set individual user password to never expire PowerShell. In Office 365, we can set password to never expire for one user using PowerShell.
By executing the PowerShell command, we can set Office 365 password to never expire for individual users in Microsoft 365.
You may like following Office 365 tutorials:
- How to set up self-service password reset in Office 365
- How to Change Office 365 Theme
- Office 365: Change Organization Name and Contact Details
- PnP PowerShell Commands for SharePoint Online List
- How to give unique permission to a folder in SharePoint Online document library
- SharePoint Video Tutorials
- Free SharePoint Training for beginners
- PnP PowerShell commands for SharePoint Online Site
- How to change SharePoint Online site URL
- Create a site collection in SharePoint Online
- Get SharePoint document library size using PowerShell
This Office 365 tutorial explains, how to set up password expiration in office 365 and how to set password never expire in office 365 for a single user using PowerShell. Also, we saw how to set password to never expire in office 365 for all users in the organization.
I am Bijay a Microsoft MVP (8 times –Â My MVP Profile) in SharePoint and have more than 15 years of expertise in SharePoint Online Office 365, SharePoint subscription edition, and SharePoint 2019/2016/2013. Currently working in my own venture TSInfo Technologies a SharePoint development, consulting, and training company. I also run the popular SharePoint website EnjoySharePoint.com