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.
SharePoint Online tutorial contents:
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
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 single user using PowerShell.
I am Bijay from Odisha, India. Currently working in my own venture TSInfo Technologies in Bangalore, India. I am Microsoft Office Servers and Services (SharePoint) MVP (5 times). I works in SharePoint 2016/2013/2010, SharePoint Online Office 365 etc. Check out My MVP Profile.. I also run popular SharePoint web site EnjoySharePoint.com