Forum Discussion

yzgulec's avatar
yzgulec
Copper Contributor
Sep 15, 2020

Configuring Password Expiration Policy with Password Hash Sync

We are using Password Hash Sync to sync users from on-prem to o365. I try to enable password expiration on O365 so I used below command to enable it without any problem:

 

Set-MsolDirSyncFeature -Feature EnforceCloudPasswordPolicyForPasswordSyncedUsers -Enable $true

 

As a second step, I need to set PasswordPolicy to None for synchronized users using below command:

 

Get-AzureADUser -All $true | Where-Object { $_.DirSyncEnabled -eq $true -and $_.PasswordPolicies -eq 'DisablePasswordExpiration' } | ForEach-Object {Set-AzureADUser -ObjectId $_.ObjectID -PasswordPolicies None}

 

I get below error message when I try to set PasswordPolicies parameter to None.

 

Set-AzureADUser : Error occurred while executing SetUser
Code: Request_BadRequest
Message: Unable to update the specified properties for on-premises mastered Directory Sync objects or objects
currently undergoing migration.
RequestId: 8ff45ed7-829d-4357-a6a6-f35e72ebb326
DateTimeStamp: Tue, 15 Sep 2020 15:43:37 GMT
HttpStatusCode: BadRequest
HttpStatusDescription: Bad Request
HttpResponseStatus: Completed
At line:1 char:68

 

How can I set this parameter to none so that I can disable "Password Never Expire" feature for synced users.

 

Below, you may find references I use to set this option:

 

https://evotec.xyz/azuread-enable-password-expiration-with-password-hash-synchronization/

https://docs.microsoft.com/en-us/azure/active-directory/hybrid/how-to-connect-password-hash-synchronization#public-preview-of-the-enforcecloudpasswordpolicyforpasswordsyncedusers-feature

Resources