[BUG] PnP.PowerShell and ExchangeOnlineManagement modules conflicting authentication #4060
Unanswered
RichWorld-Tech
asked this question in
Q&A
Replies: 2 comments
-
I have the same issue! And seems not yet fixed. |
Beta Was this translation helpful? Give feedback.
0 replies
-
Environment Get-Module -Name ExchangeOnlineManagement -ListAvailable
Script 3.6.0 ExchangeOnlineManagement
Get-Module -Name PnP.PowerShell -ListAvailable
Manifest 2.12.0 PnP.PowerShell Action #New-PnPSite -Url "https://[contoso].sharepoint.com/sites/Test02" -Type CommunicationSite -Title "Contoso Test02" # IDX12729
#New-PnPSite -Url "https://[contoso].sharepoint.com/sites/Test02" -Type TeamSiteWithoutMicrosoft365Group -Title "Contoso Test02" # IDX12729
#New-PnPSite -Type TeamSite -Title "Contoso Test02" -Alias Test02 # IDX12729
Workaround Disconnect-ExchangeOnline -Confirm:$false # Not worked
Remove-Module ExchangeOnlineManagement # Not worked v2 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
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.
Beta Was this translation helpful? Give feedback.
All reactions