Provision site with parallel PnP tasks

Highlighted
Occasional Contributor

Hi,

I have a PnP template with >10 libraries (with folders, views and permissions). 

I would like to split the template and run all library-parts in parallel.

My approach at the moment:

  1. User add a new post to a projekt site list
  2. A flow gets triggered
  3. The flow puts a messages at a Azure Queue
  4. The queue starts an Azure Function
  5. The function runs a PowerShell script provisioning the entire PnP template

 

Different approaches that might be possible:

a. Split the function into multiple functions, each with one script provisioning one library.

     - Would that require one queue per function as well?

     - Could my existing "main" function call the other functions in parallel?

     - I guess I can set up the flow with one action per queue (or function)

b. Split the PowerShell script into multiple scripts (provisioning one library each), all kept in one function.

     - How can I call all scripts in parallell from the "main" script?

 

Any other suggestions?

 

2 Replies
One design pattern you could look at is chaining your functions. We don't have a lot of info to go off of, but I will assume you want to break this up because you might have different provisioning scenarios that don't all require the same lists.

You could have a first function which your Flow starts by putting a message in a queue. That message could contain info for which lists or libraries need to be provisioned. You could then have a function for each list (for example) and have that initial function put messages on the necessary queues to provision those lists.
Highlighted
Thanks for your suggestion.
My main goal is to save time. All site will have all libraries, but since there are no dependencies between the libraries, they could all be created in parallel.