Forum Discussion
Password Expiration with AAD connect Password hash sync
When Password Sync is enabled, the cloud password for a synchronized user is set to “never expires”. This means that the password synchronized to the cloud is still valid after the on-premises password expires.
Please see scenarios below:
ITEM | USER ACTION | Effect in Password in Office 365 |
120-day password expiry in Local AD was enforced | User changed password |
|
120-day password expiry in Local AD was enforced | User did not change password |
|
Is there a way that we can enforce the following:
- force Office 365 users to change password in Local AD once the password expiration in local AD is enforced
- disable users in office 365 if the password in local AD is expired
thanks
15 Replies
- SukhijaVikasCopper Contributorps sscript can be used to overcome this, I was searching for the same for one of our customers so created the script which is now live in couple of our environments.
Use below script to fill this gap till we have a full solution from MS.
https://techwizard.cloud/2021/02/17/password-hash-sync-password-expiry-set-to-never-expire/ - lucafabbri365Brass Contributor
Hello Marvin Oco,
I noticed MS is working to find the better solution about this (link: https://feedback.azure.com/forums/169401-azure-active-directory/suggestions/18367720-allow-password-expiration-policy-to-sync-from-on-p).
At meanwhile, even if PasswordNeverExpires=True when password sync is enabled (AADConnect), however, Azure let change the attribute to False via PowerShell, can it be considered a workaround? Will it inherit the password expiration policy set in Azure AD, then ?
What about ?
Thank you,
Luca
- TimLBIron Contributor
I was investigating into this situation a bit and upon finding this thread - I thought it might be good to update it. Microsoft has added a feature in public preview where you can turn on password expiration when using the password hash synchronization scenario. Bad news however. documentation recommends that this be turned on before password sync is turned on.
Also, I've seen comments in the user voice post Luca referenced saying that people have contacted MS support and have received other ways to work around this.
- lucafabbri365Brass Contributor
Hello TimLB,
well, we implemented the EnforceCloudPasswordPolicyForPasswordSyncedUsers feature time ago, and set the same password expiration policy like on-premise AD (90 days*) but unfortunately, it was enabled with password hash sync already in place; so every time a new user is synced to Azure AD (initial sync of password) the PasswordPolicies attribute is set to DisablePasswordExpiration value by default. The (manual) solution is to change it via PowerShell:
Single user:
Set-AzureADUser -ObjectId <user ID> -PasswordPolicies None
In bulk:
Get-AzureADUser -All $true | Set-AzureADUser -PasswordPolicies None
I hope Microsoft can find a more flexible way to manage it.
* - There is a limit when there are multiple on-premise AD domains with different password expiration policy, all syncing with same Azure AD tenant through AAD Connect and sharing the same registered domain.
You can certainly create some script or custom AAD Connect rules to disable the user upon password expiration, or force a password change in O365. But there is no out of the box solution, if that's what you ask for.
- Or also switch over to a pass-through authentication model. This was your auth gets passed via agent to have your AD do the auth. This will follow all local AD rules.
https://docs.microsoft.com/en-us/azure/active-directory/hybrid/how-to-connect-pta-quick-start