Recently I was involved in building an automated project site provisioning process for a client, using LogicApps and FunctionApps. I had generated a number of PnP templates for a site (e.g. 1 for site columns/content types, 1 for lists, 1 for features and 1 for pages/navigation) using the Get-PnPProvisioningTemplate -out template.pnp -Handlers
As my plan was to store the PnP templates within SharePoint, the file extensions must be .pnp and not .xml (.xml will not work). Within the document library I stored a 'sequence' field, which basically dictated which PnP templates should be applied and in what order. The LogicApp then iterated this library and called various FunctionApps to first apply the necessary PnP file and (later) to add custom web parts.
If you did not know, the default timeout on a Function App is only 2 minutes (and PnP provisioning can be slow). This can be increased up to 10 minutes by navigating to 'Platform Features | Kudo | Debug Console | PowerShell' within the Azure console, navigating into the 'site | wwwroot', then clicking the pencil icon next to host.json and adding the functionTimeout JSON property to 10 minutes.
Sometimes however, this 10 minute timeout still isn't enough, particularly if you have a large number of content types and lists in the site. In order to fix this you have to 'hack' the Lists PnP file, so that you split it up into multiple (smaller) List PnP files. To do this, here are the steps:
1) Copy your PnP file to a temporary folder.
2) Change the file extension from .pnp to .zip.
3) Within the 'files' folder, edit the XML file and strip out the number of lists to be provisioned
4) As you will be saving these updates to a new PnP filename, it is important that the files-map.xml file in the ProvisioningTemplate folder is updated to match the new PnP filename, except with the .xml extension. For example, if I was going to name my PnP file ProjectSiteTemplateLists1.pnp, the files-map.xml file would look like:
6) Rename the .zip file to ProjectSiteTemplateLists1.pnp.
7) Repeat the process to create the other list pnp files (i.e. by starting with the full PnP file again).
I hope this helps someone. Often you don't do this sort of thing often, but when you do it is important that it is done correctly, as otherwise you will get a nasty 'Apply-PnPProvisioningTemplate : The Provisioning Template URI ProjectSiteTemplateLists1.xml is not valid'.