Skip to content

[BUG] PnP.PowerShell and ExchangeOnlineManagement modules conflicting authentication  #4059

@RichWorld-Tech

Description

@RichWorld-Tech

With the recent release of ExchangeOnlineManagement 3.50 module brings an authentication issue of between the ExchangeOnlineManagement Module 3.5.0 and the PNP.powershell 2.4.0 module. This is not operating system dependent and is happening on server 2019 and Windows 10 on multiple machines.

The issue is that when both modules are loaded and trying to Authenticate to Exchange and PNP online in the same PowerShell 7 session, the second authentication string fails. We have not tested PowerShell 5.1 as we no longer use it.

ExchangeOnlineManagement module 3.4.0 works with PNP.powershell 2.4.0 module. No conflicts

The only thing that is working is to use the -Interactive switch with the Connect-PNP command to avoid conflict. With the -Interactive switch, both modules and authentication work. All commands work once connected. The problem is Authentication.

Connect-PnPOnline -Url "https://MyTenant-admin.sharepoint.com" -Interactive.

However, we have many automation scripts the require logging into Exchange Online and PNP at the same time so the -interactive switch is not a viable option.

If PNP is loaded first, PNP authenticates and connects, and Exchange throws this error:

Connect-PnPOnline -Url "https://MyTenant-admin.sharepoint.com" -Credential $o365Cred
Connect-ExchangeOnline -showbanner:$false -Credential $o365Cred -UseRPSSession:$false**

OperationStopped: Could not load type Microsoft.Identity.Client.BaseAbstractAcquireTokenParameterBuilder`1' from assembly 'Microsoft.Identity.Client, Version=4.50.0.0, Culture=neutral, PublicKeyToken=0a613f4dd989e8ae'.

If Exchange is loaded first, Exchange authenticates and connects and PNP throws this error:

Connect-ExchangeOnline -showbanner:$false -Credential $o365Cred -UseRPSSession:$false
Connect-PnPOnline -Url "https://MyTenant-admin.sharepoint.com" -Credential $o365Cred

Connect-PnPOnline: IDX12723: Unable to decode the payload '[PII of type 'System.String' is hidden. For more details, see https://aka.ms/IdentityModel/PII.]' as Base64Url encoded string.

It seems this conflict needs to be resolved between the two Microsoft PowerShell Groups

If you need any other information let me know.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions