1. Open Windows PowerShell 2.0
2. At the prompt, type $cred = Get-Credential. The user is prompted to enter their administrative credentials.
3. Create a Remote PowerShell object. To do this, type the following:
$Session = New-PSSession-ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell/ -Credential $Cred -Authentication Basic -AllowRedirection
Download all the available cmdlets from the server. To do this, type Import-PSSession $session. After this command is run successfully, the available cmdlets are downloaded
Then type the command below:
Set-MsolUser-UserPrincipalName <Microsoft Online Services ID> -PasswordNeverExpires $true