Got a question today if it is possible to prevent a user from changing his or her own password when using Exchange Online, within Office 365.
The answer is Yes And how to do this? Find one way of doing this in this blog post, using (what did you expect?) the magic of PowerShell.
I want to create a new user id, called Test, in my Office 365 environment, and have the following password characteristics:
- Password should never expire
- Password should not need to be changed at first logon of the user
- Password can not be changed by the user, using OWA.
Using the Office 365 admin portal, I’m creating my new user:
I do not want my user to sign in with that temporary password, so by using the Microsoft Online Service Module for Windows PowerShell, I change the password to the one I want, and I set it to never expire, and I disable the fact that the user will need to change the password at the first logon.
To set the password to never expire, I’m using the cmdlet Set-MsOlUser and adding PasswordNeverExpires, and setting it to $True.
To set the password to a predefined value, I use the cmdlet Set-MsOlUserPassword, and add the new password using NewPassword (be aware, you need to identify the password in clear text here, no need to encrypt it first), and then by adding the ForceChangePassword and setting it to $False, the user won’t be prompted to change it after his first login!
Signing in, the user needs to enter his password I have given the user, and can sign in:
But the user is still able to go to OWA, select Options, and from there change his password.
When searching the web, it is possible in an Exchange On Premises environment to disable the Change your password functionality from within OWA/ECP:
But the cmdlet Set-OwaVirtualDirectory and its parameter ChangePasswordEnabled, is not available in Exchange Online!
As described in one of my previous blog posts (Exchange Online (Office365) and RBAC?), you can create and assign custom roles in Exchange Online. The permission to change your password, is included in the default role assigned to any mail-enabled user in Exchange Online. It is included in the role MyBaseOptions.
First I will create a new role AllButChangePassword, and make it a copy of the existing MyBaseOptions role.
Looking at the parameters that can be set using Set-Mailbox within the role AllButChange Password, it is visible that password is included:
Time to remove it:
And then to create a new RoleAssignmentPolicy, which will include the AllButChangePassword:
Then assign the new role to my test user:
And time to test!
Logging in to OWA as test user, going back to ECP, the ability to change the password is gone!
Thanks for this tip. This work for exchange but once you log into O365 you can still change your password via the My profile link despite having done the above. how can we fix that?
Any news on whether it's possible to prevent users from changing their pasword via the My Profile link too please?
worked like a charm thank you!
Ok in exchange but in "Office 365 settings" tab how prevent users from changing their password?
aredubbya512, christian, and Nzeg,it really depends on your set up...if you have your ad and the online ad syncing, then you select "cant change password" on the on site AD...sync the users and then that user wont be able to change their password on the online side.
I'm getting the error below:
The term 'New-ManagementRole' is not recognized as the name of a cmdlet, function, script file, or operable program. Ch
eck the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:23
+ New-ManagementRole <<<< -Name AllButChangePassword -Parent MyBaseOptions
+ CategoryInfo : ObjectNotFound: (New-ManagementRole:String) , CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
What should be the permission of the credential I'm using.
I follow step by step and it doesn't work, is there something new that prevents it?
The Password Reset from withing Office 365 settings in OWA is managed by
https://account.activedirectory.windowsazure.com/Profile/Default.aspx and not frm the RoleGroups above.
If you want to turn off the ability for Self Service Password Resets from the
http://portal.office.com you can use the following PowerShell: Set-MsolCompanySettings -SelfServePasswordResetEnabled 0 -TenantId "", 0 disables, 1 enables. When a Users attempts a password reset from the login - they will get a denial with a link that
will contact the Tenant Admin for a reset.
nobbynic, Did it work on Office 365?
Darach, how can we accomplish it for just a few users? Not for the entire organization. Take away the possibility for SOME users in Office 365 to change their own password. The previous steps don't do the trick for the "Office 365 settings" on the user.