There are various approaches to plan and automate the process for Site creation and management of SharePoint Online Sites. In this blog we will look at these options and how to use with a best possible approach.
Pnp Provisioning PowerShell is a great way to automate creation of SharePoint assets through an xml or pnp template file using PowerShell. Similarly, Site scripts and site design allows us to create Site using JSON templates and also allows call to any Provisioning automation scripts or use a Template for custom implementation. SharePoint CSOM is also a way to apply extensive custom changes onto a site. If you would like to know more about each of these individual approaches, check the blog below
So the most important question is now when to implement what and when. Actually there are so many scenarios that play into it that there is no correct answer to it. Hence in this blog, I will try to put provide some pros and cons for each of them and provide a plan to consider the best options when considering an approach.
PnP PowerShell & SPO PowerShell
One of the powerful admin tool is PowerShell. It has a greater extensibility with regards to modules and also supports C# method implementation with proper dll references.
PnP PowerShell adds to that and allows Admins (both Tenant and Site Collection Admins) to manage and implement automation workloads from scripts
1. Easy installation and cmdlet usage
2. No hosting requirements besides a system where PowerShell (>5.0) is installed
3. One Line cmdlets for most complex SharePoint implementation scenarios
3. Error handling and tracing support
1. Parallel tasking for more data intensive operations is challenging
2. Not much options for extensibility besides the the ones provided
3. Not all Site Operations such as taxonomy field updates (unless do XML schema update) are supported yet
Site Scripts and Site Designs
This is the latest way of creating and applying changes onto modern sites using a custom template called Site Designs. Site designs extend the OOB templates allowing to add more site assets than provided.
1. Simple scripting process (use JSON) to create the script file for site assets and apply features
2. Allows associating a custom theme to the template.
3. Allows extensibility to more complex process by supporting calls to Flow
1. No support yet for complex structures such as taxonomy fields, web part implementation, content type support
2. No hooks or support yet to wait for custom provisioning process to finish
SharePoint CSOM scripts
SharePoint CSOM allow us to programmatically script elements using the SharePoint object model. This allows us to do script elements that can pertain to particular elements on the site and have more extensibility into component handling.
1. The most extensive model available for SharePoint Online that allows us to add/change elements
2. Work on components that need complex provisioning requirements such as dynamic Navigation components, Library and Site settings, default folders etc. More info at here.
3. Provides extensibility for the above two options through explicit referencing when needed
1. Need additional hosting outside of Office 365 via Azure Function, App or equivalent
2. Need maintenance for any breaking changes
Considering the three options above, each of them have their strengths and weaknesses. The best approach would be plan and use them according to the requirements. Below are few recommendations to combine them for each type of elements in SharePoint Sites.
Note: The options listed below are valid as of Nov 2018 and might change as they are updated from MS
|Scope\Tools||PnP and SPO PowerShell||SharePoint Online CSOM||Site Scripts|
|Site / Web||Yes||Yes||No|
|Office 365 groups||Yes||Yes||No|
|Client Side Pages||Yes||Yes||No|
|Site Search Settings||Yes||Yes||No|
In this blog we compared the various options for Site Provisioning and how those could be used to create and prepare site components.