Office 365: Error 500: Unable to convert regular mailbox to shared mailbox

Sometimes when you trying to convert Shared mailbox to Regular mailbox or vice versa on your Office 365 tenant you may face following error: (actually you may face the error when performing any type of mailbox conversions):

Error on proxy command 'Set-Mailbox -type: 'Shared' -Identity: 'your_alias' -Confirm:$False -Force:$True' to server DBXPR04MB205.eurprd04.prod.outlook.com: Sever version 1941996320, Proxy method PSWS: Request return error with the following error message:
The remote server returned an error: (500)
Internal Servicer Error...
+CategoryInfo :NotSpecified: (:)
[Set-Mailbox], CmdletProxyException
+FullyQualifiedErrorID : Microsoft.Exchange.Configuration.CmdletProxyException,Microsoft.Exchange.Management.RecipientTasks.SetMailbox
+PSComputerName : pod51000psh.outlook.com

It seems to be internal Office 365 issue and there is no other solution other than give Microsoft a call, but in case you need convert mailboxes urgently, you may want to use following workaround:

  1. Connect to the tenant using PowerShell.
  2. Execute the command to convert the mailbox from UserMailbox to SharedMailbox type:
    Set-Mailbox somemailbox -Type Shared

    You will get error similar to error listed above. Get the server name from the error output.

    For example it is AMXPR01MB024.eurprd01.prod.exchangelabs.com

  3. Run following command, to remove previous session:
    Get-PSSession | Remove-PSSession
  4. Make a new PS connection to the tenant using following:
    $LiveCred = Get-Credential
    $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell/?targetserver=[Use your server name here] -Credential $LiveCred -Authentication Basic –AllowRedirection

    Example:
    $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell/?targetserver= AMXPR01MB024.eurprd01.prod.exchangelabs.com -Credential $LiveCred -Authentication Basic –AllowRedirection

  5. Then run following:
    Import-PSSession $Session -AllowClobber
  6. Execute the command to convert mailbox again:
    Set-Mailbox –Identity [mailbox identity] –Type Shared

Now all conversions should be completed successfully. That error seems to be intermittent but may occur time to time.