Search code examples
macospowershelloffice365exchange-server

Connect-ExchangeOnline with German 0365 cloud always times out


I want to configure some rooms in Outlook in Microsoft 365 and therefore need to use the Powershell. I'm using Powershell 7.4.2 on macOS.

At first im running

Import-Module ExchangeOnlineManagement

then

Connect-ExchangeOnline -UserPrincipalName [email protected] -ExchangeEnvironmentName O365GermanyCloud

after running this command it takes a couple minutes until a browser tab opens at https://login.microsoftonline.de/organizations/oauth2/v2.0/..., but the Site loads forever until it eventually runs into a timeout.

The command doesn't return on its own and I have to stop it manually. I'm getting the following error in the powershell then.

System.OperationCanceledException: The operation was canceled.
   at System.Threading.CancellationToken.ThrowOperationCanceledException()
   at System.Threading.CancellationToken.ThrowIfCancellationRequested()
   at Microsoft.Identity.Client.Platforms.Shared.DefaultOSBrowser.HttpListenerInterceptor.ListenToSingleRequestAndRespondAsync(Int32 port, String path, Func`2 responseProducer, CancellationToken cancellationToken)
   at Microsoft.Identity.Client.Platforms.Shared.Desktop.OsBrowser.DefaultOsBrowserWebUi.InterceptAuthorizationUriAsync(Uri authorizationUri, Uri redirectUri, Boolean isBrokerConfigured, CancellationToken cancellationToken)

I'm using O365GermanyCloud because the its a Microsoft 365 account.

I've also tried this procedure with different admin accounts in the 365 instance.

Do you know if I'm doing something wrong or if Microsoft is having issues? I've tried it multiple times on different days.

$PSVersionTable:

Name                           Value
----                           -----
PSVersion                      7.4.2
PSEdition                      Core
GitCommitId                    7.4.2
OS                             Darwin 23.4.0 Darwin Kernel Version 23.4.0: Fri Mar 15 00:10…
Platform                       Unix
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Solution

  • The problem was that I used the O365GermanyCloud environment, but instead it was just a tenant in the regular O365Default environment.

    The tenant was in Germany but apparently not in the O365GermanyCloud.