Forum Discussion
Will_Hoch
Aug 22, 2022Copper Contributor
Connect-SPOService Unexpected token error
Hello, This is my first post ever so I apologize if I am missing obvious details. I am writing a script in PowerShell that requires connecting SharePoint and I am doing so with the Connect-SP...
- Aug 23, 2022
A cursory search on google points to this:
The most likely causes of the error are as follows: the UPN of the admin account used to connect to SharePoint Online contains special characters, for example - or _, or the admin account has abnormal/non-standard values defined in other properties. There are two known solutions to the problem: Use the UPN with the default onmicrosoft.com domain name (e.g. email address removed for privacy reasons) to connect to SharePoint Online in CodeTwo Backup. Use another global admin account (global admin or SharePoint admin) to configure a SharePoint connection in the program. Preferably, create a fresh account that does not include any problematic configuration or special characters in its UPN.
https://www.codetwo.com/userguide/backup/troubleshooting-sharepoint.htm
Aug 22, 2022
Hello, What happens if you login interactively?
- Will_HochAug 22, 2022Copper ContributorIt works fine
- Aug 22, 2022Trying to reproduce but I still can't, also using SecretManagement
Are you using a PSCredential?
What version of the management shell?- Will_HochAug 22, 2022Copper Contributor
Yes the Get-Secret returns a PSCredential, but also I think that's not the problem. I just re-created the problem without it. I can do:
Connect-SPOService -url link -credential email
Enter my password, and still get the same 'center' unexpected token error.