Delen via


Take away the possibility for users in Exchange Online to change their own password

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 Smile And how to do this? Find one way of doing this in this blog post, using (what did you expect?) the magic of PowerShell.

Setting the scene

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.

Step 1. Create the user

Using the  Office 365 admin portal, I’m creating my new user:

SNAG-01046

Step 2. Changing Password Settings

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!

SNAG-01034

Signing in, the user needs to enter his password I have given the user, and can sign in:

SNAG-01035

But the user is still able to go to OWA, select Options, and from there change his password.

SNAG-01036

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!

How to do this in Exchange Online? Using RBAC!

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.

SNAG-01038

Looking at the parameters that can be set using Set-Mailbox within the role AllButChange Password, it is visible that password is included:

SNAG-01039

Time to remove it:

SNAG-01040

And then to create a new RoleAssignmentPolicy, which will include the AllButChangePassword:

SNAG-01041

SNAG-01042

Then assign the new role to my test user:

SNAG-01043

And time to test!

Logging in to OWA as test user, going back to ECP, the ability to change the password is gone!

SNAG-01045

Exchange ROCKS!

 

Ilse

Comments

  • Anonymous
    January 01, 2003
    worked like a charm thank you!

  • Anonymous
    January 01, 2003
    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?

  • Anonymous
    November 14, 2012
    Any news on whether it's possible to prevent users from changing their pasword via the My Profile link too please?

  • Anonymous
    March 17, 2014
    Ok in exchange but in "Office 365 settings" tab how prevent users from changing their password?

  • Anonymous
    April 28, 2014
    The comment has been removed

  • Anonymous
    July 11, 2014
    The comment has been removed

  • Anonymous
    January 16, 2015
    I follow step by step and it doesn't work, is there something new that prevents it?

  • Anonymous
    August 17, 2015
    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.

  • Anonymous
    August 17, 2015
    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.

  • Anonymous
    September 30, 2015
    Doesn't work. I did that step by step and the Change Password Option is available yet for this user

  • Anonymous
    December 03, 2015
    The comment has been removed