1

I want to copy a site collection from one tenant to another. insdie the source i run this command:-

Get-PnPProvisioningTemplate -Out c:\template20.pnp -IncludeSiteCollectionTermGroup

inside the destination i run this command:-

Apply-PnPProvisioningTemplate -Path c:\template20.xml

but on the Apply-PnPProvisioningTemplate i got this error:-

PS C:\windows\system32> Apply-PnPProvisioningTemplate -Path c:\template20.xml WARNING: ListInstance Style Library is a Style Library of a site with NoScript enabled and will be skipped Apply-PnPProvisioningTemplate : The specified user c:0t.c|tenant|5*****c could not be found. At line:1 char:1 + Apply-PnPProvisioningTemplate -Path c:\template20.xml + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : WriteError: (:) [Apply-PnPProvisioningTemplate], ServerException + FullyQualifiedErrorId : EXCEPTION,SharePointPnP.PowerShell.Commands.Provisioning.Site.ApplyProvisioningTemplate

Any advice please? now the 2 tenants do not share the same users, so how i can skip applying the users?

Thanks

2 Answers 2

0

You can open the .xml file in a text/code editor and do a search & replace with a corresponding user from your second tenant.

There are a few main sections that can include users in the provisioning template. If you do not need to provision these you can remove the whole section.

These are:

  1. <pnp:SiteDesigns />
  2. <pnp:Security />
  3. <pnp:Lists /> (*)
  4. <pnp:TermGroups />
  5. <pnp:ClientSidePages /> (*)

(*) = If they include lists/pages with unique permissions

6
  • if i modify these section or remove them, i will get an error on the Apply PnP that the template is not valid!
    – John John
    Commented Mar 23, 2020 at 12:01
  • That would mean that you either removed too little or too much. When removing a section you must find the matching end tag and remove everything that is a part of that. Commented Mar 23, 2020 at 12:03
  • yes this what i did remove everything that is a part of the section
    – John John
    Commented Mar 23, 2020 at 12:37
  • Which section did you remove? Commented Mar 23, 2020 at 12:42
  • all the sections which contain c:0t.c|tenant|5*****c inside it
    – John John
    Commented Mar 23, 2020 at 12:51
0

We will face this issue when we have already created the site with the group and there trying to run the Apply-PnPProvisioningTemplate command- with the new site this issue will not come.

In order to work with the current template, we need to do few changes in the PnP template before running the Apply-PnPProvisioningTemplate command.

Sample PnP Template:

<pnp:Security AssociatedOwnerGroup="{sitetitle} Owners" AssociatedMemberGroup=" 

{sitetitle} Members" AssociatedVisitorGroup="{sitetitle} Visitors">

Now this can be resolved if we change the Owner field from Owner="{associatedownergroupid}" to Owner="{sitetitle} Owners" as shown below.

<pnp:SiteGroup Title="{sitename} Field Limited" Description="" Owner="{sitetitle} Owners" AllowMembersEditMembership="false" AllowRequestToJoinLeave="false" AutoAcceptRequestToJoinLeave="false" OnlyAllowMembersViewMembership="true" />

How to reproduce this issue:

  1. Create a SharePoint group on a team site. Any custom group other than the default three groups.
  2. Go to groups settings and change the newly created group's owner as the site's owner's group
  3. Get the new provisioning XML using Get-PnPProvisioningTemplate Command
  4. When we apply the template using apply provisioning command, the custom group will not get created on the newly provisioned site and provisioning fails to give below error: "The specified user 3 not found"

Source:

Issue while applying PnP site provisioning Powershell -The specified user 3 could not be found. #2112

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.