Connect-ExchangeOnline -Device output not complete


I asked in discord but I think this is probably a better place.

I’ve just started testing UA in our environment and have an issue with what the output displays or doesn’t.

I have a one-line script that just runs Connect-ExchangeOnline -Device. In powershell 7, I get this output:

PS C:\Users\********> Connect-ExchangeOnline -Device

The module allows access to all existing remote PowerShell (V1) cmdlets in addition to the 9 new, faster, and more reliable cmdlets.                                                                                                                                                                                                                                    |--------------------------------------------------------------------------|
|    Old Cmdlets                    |    New/Reliable/Faster Cmdlets       |
|    Get-CASMailbox                 |    Get-EXOCASMailbox                 |
|    Get-Mailbox                    |    Get-EXOMailbox                    |
|    Get-MailboxFolderPermission    |    Get-EXOMailboxFolderPermission    |
|    Get-MailboxFolderStatistics    |    Get-EXOMailboxFolderStatistics    |
|    Get-MailboxPermission          |    Get-EXOMailboxPermission          |
|    Get-MailboxStatistics          |    Get-EXOMailboxStatistics          |
|    Get-MobileDeviceStatistics     |    Get-EXOMobileDeviceStatistics     |
|    Get-Recipient                  |    Get-EXORecipient                  |
|    Get-RecipientPermission        |    Get-EXORecipientPermission        |

To get additional information, run: Get-Help Connect-ExchangeOnline or check

Send your product improvement suggestions and feedback to For issues related to the module, contact Microsoft support. Don't use the feedback alias for problems or support issues.

**To sign in, use a web browser to open the page and enter the code ******** to authenticate.**

In UA, the final line including the device login code is missing.

I understand there are other ways to run the authentication, but device login is a simple way for me to publish scripts to users with existing access to these services.

Why would UA be cutting this info out? Shouldn’t it just output the same as Powershell itself? I could probably work around this instance but I need to understand what the UA shell will output for me as I work through testing more scripts.


Product: PowerShell Universal
Version: 1.5.14

Seems like a bug. The UA host is using a custom PS host that writes anything it receives from the PS output stream but it must be messing it up somehow. It seems like it could be a problem with multi-line input or something.

I’ll open an issue for this.

1 Like

I use certificate based authentication in my EXO Scripts!
Maybe this will help you:

1 Like

I will have to go this way now. Thanks for the link

Running into the same issues. Seems like it works sometimes but the majority of the time the script gets stuck in a loop and canceling doesn’t work. @chrisr - were you able to get cert based auth working? Did that fix the issue?

I had the problem before that the connection limit to Exchange Online would be exceeded. (I think default 3 with the same user/principal) - just as a hint.
Here is my simple ‘Connect-EXO’ function

<# AAD App Details in a Hashtable like
        ClientId = '3e72947c-825a-4c27-9763-628ba501a8b3'
        CertificateThumbprint = 'YOURTHUMBPRINT'
        Organization = ''
param (

Import-Module ExchangeOnlineManagement -RequiredVersion '2.0.5'
$ConnectionParameter = @{
    ClientId              = $AadApp.ClientId
    Organization          = $AadApp.Organization
    ShowBanner            = $false
    CertificateThumbprint = $AAD_APP.CertificateThumbprint

Connect-ExchangeOnline @ConnectionParameter

This works fine for me!