Forum Discussion

Dean_Gross's avatar
Dean_Gross
Silver Contributor
Dec 19, 2018

Unable to add Group as Owner

I'm trying to fix a problem that was caused by someone who replaced the Office Group in the Site Collection Admin group with a service account. I thought that I could do this by reassigning the Office Group to the Owners attribute using pnp as follows, but I get the error shown. Can anyone tell me what I'm doing wrong?

 

PS C:\scripts> Set-PnPTenantSite -Url https://premierinc.sharepoint.com/teams/dgtest1 -Owners "dgtest1@premierinc.onmicrosoft.com"
Set-PnPTenantSite : The user does not exist or is not unique.
At line:1 char:1
+ Set-PnPTenantSite -Url https://premierinc.sharepoint.com/teams/dgtest ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : WriteError: (:) [Set-PnPTenantSite], ServerException
    + FullyQualifiedErrorId : EXCEPTION,SharePointPnP.PowerShell.Commands.SetTenantSite

3 Replies

  • I had the same issue and struggled quite some time with a solution so thought I'd share.

    You can use the full SharePoint id of the login like this:

    $adminAccounts = @("myadminuser@abc.com", "c:0t.c|tenant|06f4bb89-36bc-464c-9d42-060da22d4ec4")

    Set-PnPTenantSite -Url $sitecollection.Url -Owners $adminAccounts

     

    I found the "user id" by adding the group in UI to some site and then use the get-pnpuser cmdlet to get the login name.

     

    Hope this helps...

  • Deleted's avatar
    Deleted
    Not applicable

    Are you connected to the tenant admin site when performing this, or connected to the site collection? The command needs to be run from the admin site connection.

    • Dean_Gross's avatar
      Dean_Gross
      Silver Contributor

      Yes, I connected to the tenant-admin.sharepoint.com site