Setting Office 365 user account password to never expire

28.6.2013

Our Integrations link directly into CRM 2011 our latest integration required us to us an office 365 account to access Dynamics CRM via the Windows Azure Active Directory

Trouble is that the passwords expire after 90 days which is nice especially when using automated routines to fetch and process data. So what’s the work around…?

Step 1 - Install the Required Software

The following are required in order to run the Windows Azure Active Directory Module or the Active Directory Federation Services server role in Windows Server® 2012:

  • Operating system: Use Windows 7, Windows 8, Windows Server 2008 R2, or Windows Server 2012. „h Microsoft .NET Framework: You must install the Microsoft .NET Framework 3.51 feature.
  • Install the obligatory Updates: Ensure you have installed all of the required updates required by the Microsoft cloud services to which you have subscribed. For example, some cloud service features may not work properly without the appropriate versions of operating systems, web browsers, and software.
  • Install Microsoft Online Services Sign-in Assistant: You must install the appropriate version of the Microsoft Online Services Sign-in Assistant for your operating system from the Microsoft Download Centre.
  • Install the Windows Azure AD Module for Windows PowerShell: You must install the appropriate version of the Windows Azure AD Module for Windows PowerShell for your operating system from the Microsoft Download Centre:

Step 2: Connect to Windows Azure AD Using Windows PowerShell

  • Click the Windows Azure Active Directory Module for Windows PowerShell shortcut to open a Windows PowerShell workspace that has the cmdlets.
  • Next, type in ‘connect-msolservice’ on the Windows PowerShell command prompt.
  • You will then be prompted for the username and password.

Step 3: Set Password to never expire

  • To set the password of one user to never expire, run the following cmdlet by using the user principal name (UPN) or the user ID of the user: Set-MsolUser -UserPrincipalName <user ID> -PasswordNeverExpires $true
  • To set the passwords of all the users in an organization to never expire, run the following cmdlet:
  • Get-MSOLUser | Set-MsolUser -PasswordNeverExpires $true

Step 4: Check if User Password has been set to never expire

To see whether a single user’s password is set to never expire, run the following cmdlet by using the user principal name (UPN) (for example, april@contoso.onmicrosoft.com) or the user ID of the user you want to check: Get-MSOLUser -UserPrincipalName <user ID> | Select PasswordNeverExpires

To see the "Password never expires" setting for all users, run the following cmdlet: Get-MSOLUser | Select UserPrincipalName, PasswordNeverExpires