Skip to content

Connect-PNPOnline returns connection in Dev, but an Array in Prod. (Begging for help) #4844

Answered by argRegEater
argRegEater asked this question in Q&A
Discussion options

You must be logged in to vote

Solution:

OK, after 12-ish hours I found the compound problem that caused this. I'm recounting in detail for anyone else facing similar issues. In short, dumb script monkey + a corrupt/weird M365Team.

Problem 1: The "Connect-PNPOnline returns array for prod only"

I built a wrapper around Connect-PNPOnline so I could switch between my dev/staging/prod environments. I used that wrapper to also give a warning if you were connecting to PNP in a production environment. Because of powershell function behavior, that wrapper was creating an inadvertent additional return value, thus automatically changing the function return variable into an Array. I was looking in the wrong place because I though…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by argRegEater
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant