Skip to content

Basic Authorization fails on some piped commands in Office365 remote #7266

Closed

Description

@mrclmh

Steps to reproduce

$Office365 = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri "https://outlook.office365.com/powershell-liveid" -Credential $UserCredential -Authentication Basic -AllowRedirection
Import-PSSession $Office365

Get-Mailbox|Get-MailboxRegionalConfiguration

Expected behavior

Output of a listing of regional settings for all mailboxes.

Actual behavior

Sending data to a remote command failed with the following error message: Basic Authorization failed for user foo@bar.de For more information, see the about_Remote_Troubleshooting Help topic.
+ CategoryInfo          : OperationStopped: (outlook.office365.com:String) [], PSRemotingTransportException
+ FullyQualifiedErrorId : JobFailure
+ PSComputerName        : outlook.office365.com

Environment data

> $PSVersionTable
Name                           Value                                                                                                                                                                                                                                                    
----                           -----                                                                                                                                                                                                                                                    
PSVersion                      6.0.2                                                                                                                                                                                                                                                    
PSEdition                      Core                                                                                                                                                                                                                                                     
GitCommitId                    v6.0.2                                                                                                                                                                                                                                                   
OS                             Darwin 17.6.0 Darwin Kernel Version 17.6.0: Tue May  8 15:22:16 PDT 2018; root:xnu-4570.61.1~1/RELEASE_X86_64                                                                                                                                            
Platform                       Unix                                                                                                                                                                                                                                                     
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}                                                                                                                                                                                                                                  
PSRemotingProtocolVersion      2.3                                                                                                                                                                                                                                                      
SerializationVersion           1.1.0.1                                                                                                                                                                                                                                                  
WSManStackVersion              3.0  

Additional information

This commands work

Get-Mailbox|select Alias
Get-MailboxRegionalConfiguration foo

Get-Mailbox piped to any Get-MailBox* command fail with the above error.

Activity

  1. raysn0w commented on Aug 19, 2018

    @raysn0w

    I have the same issue, did you find any workaround?

  2. mrclmh commented on Aug 19, 2018

    @mrclmh
    Author

    No, Ray Olivero (@raysn0w). In my use case it were just a few mail boxes so I called Get-MailboxRegionalConfiguration on them one by one, which is of course not a solution when you have many mailboxes. I am a powershelll beginner myself but I would try something like a foreach loop over the output of Get-Mailbox when you have many mailboxes.

  3. raysn0w commented on Aug 19, 2018

    @raysn0w

    mmoehring, Bummer. I have over 2,000 users in my org and I was trying to automate a report of users with OOO enabled.

  4. MaximoTrinidad commented on Aug 19, 2018

    @MaximoTrinidad

    If I'm not mistaken, this issue still floating around for some time. I think this module hasn't been converted to .NET Core yet.

    And I'm sure is on there list to do.

    So, for now you can only run it in Windows PowerShell only.
    :)

  5. mrclmh commented on Aug 30, 2018

    @mrclmh
    Author

    Maximo Trinidad (@MaximoTrinidad) Which module has to converted to .Net Core for this to work?

  6. Jvekka commented on Oct 28, 2019

    @Jvekka

    In my case, the easiest workaround was to use foreach statement.
    $AllUserMailboxesStats = ($AllUserMailboxes | ? { Get-MailboxStatistics -Identity $_.Name } )

    Original code

    $AllUserMailboxes = (Get-Mailbox -ResultSize Unlimited `
        -RecipientTypeDetails UserMailbox | ?{$_.WhenMailboxCreated `
        -lt ($Today - $Days)})
    
    # Get the mailbox statistics for the selected mailboxes.
    $AllUserMailboxesStats = ($AllUserMailboxes | Get-MailboxStatistics)
    
  7. Semptra commented on Aug 23, 2021

    @Semptra

    Could we expect this issue to be fixed any time soon? Our customer has a lot of user scripts with pipes inside and after moving to a Linux with PS Core they observe this issue with Basic Authorization failed.

    $PSVersionTable

    Name                           Value
    ----                           -----
    PSVersion                      7.1.3
    PSEdition                      Core
    GitCommitId                    7.1.3
    OS                             Linux 5.4.0-1055-azure #57~18.04.1-Ubuntu SMP Fri Jul 16 19:40:19 UTC 2021
    Platform                       Unix
    PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
    PSRemotingProtocolVersion      2.3
    SerializationVersion           1.1.0.1
    WSManStackVersion              3.0
  8. added
    Needs-TriageThe issue is new and needs to be triaged by a work group.
    WG-RemotingPSRP issues with any transport layer
    on Aug 23, 2021
  9. Fabi1Sc commented on Oct 21, 2021

    @Fabi1Sc

    I have the same issue

  10. Tolgon commented on Nov 4, 2021

    @Tolgon

    Same here

  11. PaulHigin commented on Apr 7, 2022

    @PaulHigin
    Contributor

    @WG-Remoting
    Remoting working group: New-PSSession is no longer supported for non-Windows platforms, because the OMI bridge used on Non-Windows platforms is no longer supported (#15310). It is hoped that community members will provide support for this via the new custom remoting connections (#16923) feature.

    However, I am not sure if Exchange endpoints were ever supported through the previous WinRM/OMI implementation on non-Windows platforms.

  12. PaulHigin commented on Apr 7, 2022

    @PaulHigin
    Contributor

    Resolved as 'answered' and closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Resolution-AnsweredThe question is answered.WG-RemotingPSRP issues with any transport layer

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions