PnP Deploy Template to existing Multiple Sharepoint Site Collections

Brass Contributor

Hi,

I am using PnP Library to apply a template to existing sites(with new changes- such as adding new site fields, content types, modifying views etc). We have 40+ site collections, where I need to apply the template.

Depending on the number of changes, for each site it is taking 5-10 minutes. As the number of sites are more, the deployment process is taking lot of time to deploy the changes to existing sites.

 

I have used async approach with Tasks, which has improved the performance. Could anyone advise is there any other better approach that can improve the performance while applying changes to existing sites?

 

Is it possible to take a site collection offline while the deployment is in progress?

5 Replies

Hi @Venkata Ratnam Vemula,

 

Applying templates with PnP PowerShell/Core can indeed be a slow process. I have however found some ways to speed things up.

 

First of all I don't like the concept of Content type hubs, however the use of  a content type hub could speed your process up a bit. You would only need to apply fields and content types to the conten type hub and then you ould exclude them form the rest of your template applications.

 

The other option is to exclude handlers from your template application. So if for example you know that you have made only chnages to fields. Then run:

 

Apply-PnPProvisioningTemplate -Handler Fields ...

(or if you are running the core libraries you could run only the fields handler there). I would still extract the full template but only apply parts of the template to your many sites. Of course you do need to be very much aware of your chnages that you want to apply.

 

 

The number of sites have increased to 200 almost. Is there any other approach to deploy or rollout the changes to multiple sites?

 

How does Microsoft manage rolling out changes to multiple tenants?

We use C# so we can have some more control on the rollout. And only do updates on the selected parts we noticed especially Lists are slowing the provisioning down. So if you do not update a list remove it out of your template. Or only do the parts you need.

 

Hope this helps. And i noticed if you do it over the weekend the system is most of the time 30-40% faster. As the load is not that high.

Paul,

Thanks for the reply.I am applying only selected parts (Lists/Security/Content types) in the template. There are situations where I need to update the lists. For 100+ sites, it is taking almost 8+ hours depending on the changes. Sometimes, we get 401 unauthorized error while the execution is in progress. (May be due to DDOS). We are re-running the deployment again for such sites.

 

Is there a way to automate the deployment? I mean give the list of sites as input and the template -which has the list of changes and run the deployment and log the errors if any.

 

 

Yes that would be to create a webjob in azure or a console app that performs the update but complete lists content types etc takes a long time. Be sure you only update what is necessary and leave out the components that do not need to be updated.