How to Set Office 365 Password Policy

This Office 365 tutorial explains, how to set Office 365 password policy. How to set up password expiration in office 365. We will also see 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:

how to set up password expiration in office 365

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
office 365 password policy

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
set an individual users password to never expire office 365

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

You may like following Office 365 tutorials:

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 single user using PowerShell.

>