We’ve been trying to use PowerShell to provision a site on our TEST environment from SharePoint online lists defined on DEV environment. Unfortunately, I’ve hit a bit of a wall with the provisioning process – I’ve had problems with calculated fields and lookup fields. I’ve tried to apply the resulting provisioning template to the TEST environment, but this fails in Apply-PnPProvisioningTemplate with messages such as
Apply-PnPProvisioningTemplate : Value does not fall within the expected range. At C:\Users\xx\Projects\Provisioning-VanDrivers\Apply-Provisioning.ps1:20 char:2 + Apply-PnPProvisioningTemplate -Path $ProvisioningSource -Connecti ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : WriteError: (:) [Apply-PnPProvisioningTemplate], ServerException + FullyQualifiedErrorId : EXCEPTION,PnP.PowerShell.Commands.Provisioning.Site.ApplyProvisioningTemplate
This faithfully tells me the failing line in the PowerShell script, but not alas any context from the XML. I anticipate that the most straightforward way to reproduce the SharePoint “schema” is to use a very strict manual procedure involving copying of SharePoint list templates, with consequent loss of lookup field context. If you have any better ideas we’d be eager to hear them.