Note This procedure does not apply to users who are enabled for single sign-on (SSO). This is because passwords for SSO-enabled users are managed in the on-premises environment. If you try to perform this procedure for an SSO-enabled user, you receive output that resembles the following in Windows PowerShell:
Set-MsolUser : Unable to update parameter. Parameter name: PasswordPolicies.
At line:1 char:13
+ Set-MsolUser <<<< -UserPrincipalName jsmith@contoso.com
-PasswordNeverExpires $true
+ CategoryInfo : OperationStopped: (:) [Set-MsolUser], MicrosoftOnlineException
+ FullyQualifiedErrorId : Microsoft.Online.Administration.Automation.PropertyNotSettableException, Microsoft.Online.Administration.Automation.SetUser
Note Only passwords for user accounts that are not synchronized through directory synchronization can be configured to never expire.