Forum Discussion
JasonYeung
Dec 02, 2025Brass Contributor
add user to SharePoint group via PowerShell error
Hi, I'm trying to use PowerShell to add a user to an existing SharePoint group. I ran the following to connect to the SharePoint site: Connect-SPOService -Url https://site1-admin.sharepoint.com T...
rogerval
Dec 05, 2025MCT
The error indicates that SharePoint Online is not resolving the user principal passed to Add-SPOUser. This usually happens when the LoginName format is incorrect or when the account does not yet exist in the site collection’s user cache.
Try the following:
- Use the UPN format instead of the mailto: format. For example:
-LoginName email address removed for privacy reasons - Make sure the user has accessed the site at least once or add the user to the site collection using:
Set-SPOUser -Site <site> -LoginName email address removed for privacy reasons -IsSiteCollectionAdmin $false
This ensures the user exists in the site’s user info list. - PnP PowerShell can add users more reliably, but the standard SPO module works as long as the LoginName is resolved correctly.
The “Unknown Error” typically means the user lookup failed, not that the cmdlet is broken.