Site provisioning from SharePoint (online) UI - CSOM, REST, Azure? What is the best approach?

Iron Contributor

We have a kind of case-filing application in SharePoint. When we have a new case, a new site has to be genereated (specific webparts, settings and content).

 

We developed a (CSOM) C# windows.exe application to create these sites. For the time being this was an acceptable solution. Now we want to integrate this site provisioning more in the SharePoint user experience.

 

We did a proof of concept with the REST API and javascript. This failed as we did not manage to set all settings of the webparts.

 

Now we are thing about rebuilding our provisioning tool on the azure platform and integrate this in the Sharepoint solution.

 

We do not have any experience using Azure, so before investing a lot of time in our nex proof of concept, I would just like to check if this can be a succesful approach. Or is there another solution possible we did not think of?

 

Thanks, Mike

9 Replies
Hi, see this powershell sample I did: https://github.com/SharePoint/PnP-PowerShell/tree/dev/Samples/Provisioning.SelfHostedWithAzureWebJob

You could easily do this with C#, or create a UI on the list - or have some UI trigger a webjob. Many possibilities :)

Or look at the PnP partner pack solution.

@Mike Jansen i would defenitly advice to use PNP and C# combo where you can use a webjob with a message quee in Azure.. using a event receiver or webhook to trigger the action in SharePoint.

Site provisioning is not a good candidate for the client-side approach. It really needs to happen asynchronously on a server somewhere. There are many ways of achieving this, and Azure has a number of options for running code in the background, including Azure Functions which avoid the need to commit to a server running continuously. I would look for sample code from PnP Provisioning as suggested and host in Azure by one means or another.

+1 for Azure functions approach suggested by Bill

I think a part is right @Bill Ayers @Juan Carlos González Martín but if you use functions be carefull when you have a large site to provision the function will have a time out.


@Deleted wrote:

I think a part is right @Bill Ayers @Juan Carlos González Martín but if you use functions be carefull when you have a large site to provision the function will have a time out.


Indeed, and for functions the connection has to stay open during the duration. Spinning up old style site collection still usually takes 10+ minutes, so an always on webjob or similar might be a more stable approach.

 

For my sample, polling the site order list works fine, and we have it in production. But if you create many sites right away, the last person is in for a white as it does things synchronously. Which means, you need to look at the scenario at hand, and architect the complexity needed to solve your scenario. How many moving parts do you need to make it work for you?

Thanks al lot everyone. I will check the PnP Provisioning option.

 

 

... for Consumption plan, yes there is a 5 min. timeout (although that might change in the future). If you have an existing App Service plan you should be okay. But yes, that is a design consideration.