Today I started my day with my inbox filled with exceptions notifications of one of our workflow scripts taking of Office 365 services provision. Error message was rather generic and not very helpful
Data returned by the remote Get-FormatData command is not in the expected format.
I was able to easily pinpoint this to he function opening a connection to Exchange online, I will publish this soon, but the error message was not really helpful to know exactly what’s going on.
It turns out this is a known and unfortunately semi random issue Microsoft is aware of and, at the time of writing, there is no ETA on a final solution.
The official workaround from Microsoft is connecting to Exchange Online via the following code:
# Connect to Exchange online with modified endpoing URL Connect-ExchangeOnline -ConnectionUri "https://outlook.office365.com/powershell-liveid?SerializationLevel=Full"
The above, as per Microsoft statement, has a very low performance impact in the process of selecting the optimal endpoint for interaction with the service and I can confirm it works reliably in solving the issue.
Microsoft also made available a feedback form you can use to report the issue which should help them track down the issue and hopefully solve it.
Hope this will help you as well!