Run Power Automate as Part of a SharePoint Site Design

Back in the old days of SharePoint, you could save a whole site as a template, and any workflows that were on that site, were automatically part of the template.  So, sites that were created from that template then automatically had the workflows included.

Now, “Site Designs” are the new way of creating a sort of site template in SharePoint Online, and Microsoft Flow is the new way of doing workflows.  Flows aren’t really a part of a site like old workflows used to be, so Flows aren’t automatically going to be included.

In site designs, there is a way to make the site design trigger a Flow to run, when the site design is being applied.  This can be done as the site is being created, or later on.

Here’s the scenario.  I have a Flow on a site, that sends out emails about the tasks in the task list on that site.  Pretty simple.  I kept it as simple as possible for testing and figuring this out.  I want that Flow to get created as part of a site design, so that the task list on that site will automatically have that Flow associated with it, and running right when the design is applied.  This ended up being extremely complicated to figure out, especially since I’m not a dev.  It took way longer than I expected.

Check out my Advanced Flow Course

High level:  To try this out, you will have two Flows.  First is the Flow that gets triggered from the site design.  I’m just calling mine “HTTP Trigger”, but in reality you should give it a name that is relevant to the site design and what it does.  The second Flow, like “new task email” or “document approval” will be the one that you want to have a copy of as part of the site template (site design) and all the sites that get created with that design.

This is an overview of the first workflow that creates the second one.  Also, there is an hour long demo video at the end of this post, of me building this.


Here are the steps, and the way I finally got it to work:

1.  In a new, blank Flow,  add the trigger called When a HTTP request is received.

2.  Add an action Initialize variable.  Name the variable varJSON and Type is Object.

3.  Give the Flow a name, and Save the Flow.  This will be your Flow that will be triggered when the site design is applied, which will then create a Flow that is specific to that site.  I’ll call mine “HTTP trigger

4.  You need another Flow.  It doesn’t really matter what it does, like approvals or notifications, but I recommend keeping it fairly simple when you first try this.  I called mine “Scheduled Task Reminder” and it runs every day and looks at a task list in a SharePoint site and sends emails about overdue tasks.  Create this other Flow and make sure it is fully functional, and tested.  Also, remember what site that it’s associated with.  This part in yellow, this is the important thing that you’ll need to remember, the URL to the SharePoint site.  In production, you could just have this as a disabled (turned off) workflow associated with some test site, but it does need to exist, and you don’t want to delete it.


5.  Open the first Flow that you created at step 1.  Copy the HTTP POST URL to the clipboard.


6.  This next step is done in PowerShell.  Here is the script.  It connects to your site, creates a site script that entails the creation of a very simple task list, and it triggers your first Flow.  See the part that says “Your Flow Http Trigger URL”.  That’s where you need to paste the URL that you just copied to the clipboard.  What did you name your first Flow, at step 3?  Put the name of it there below where it says “your first Flow name”.  Run this script.  New to PowerShell?


Connect-SPOService -Url

$site_script = @'
   "$schema": "schema.json",
   "actions": [
       "verb": "createSPList",
       "listName": "Tasks",
       "templateType": 100,
       "subactions": [
           "verb": "SetDescription",
           "description": "List of Tasks"
         "verb": "addSiteColumn",
         "internalName": "AssignedTo",
         "addToDefaultView": true
         }       ]
     "verb": "triggerFlow",
     "name": "Your first Flow Name",
     "parameters": {
         "Event": "testevent",
         "Product": "testproduct"
     }   ],
   "bindata": { },
   "version": 1
$newscript = Add-SPOSiteScript -Title "Tasks and Flow" -Content $site_script -Description "Creates tasks with a Flow in a site"

Add-SPOSiteDesign -Title "Tasks with Flow" -WebTemplate "64" -SiteScripts $newscript.Id -Description "Has tasks and a flow"

Check out the Microsoft Flow class that I teach!
7.  Test it.  Go to any of your SharePoint sites, or create a new one.  Go to the Settings gear, and click Site designs.


8.  The one you just created is called “Tasks with Flow”.  Pick that from the drop-down, and choose Apply to site.


9.  In Flow, go to your first workflow, and after a couple of minutes (maybe up to 5), you should see “Succeeded” in the run history.  Edit the Flow again.

10.  Add a new step, the action called Parse JSON.

For the Content, select the Body from the HTTP request.


For the Schema, paste this:

"type": "object",
"properties": {
"webUrl": {
"type": "string"

"webTitle": {
"type": "string"

"webDescription": {
"type": "string"

"groupId": {
"type": "string"

"creatorEmail": {
"type": "string"

"creatorName": {
"type": "string"

"createdTimeUTC": {
"type": "string"

"parameters": {
"type": "object",
"properties": {
"Event": {
"type": "string"

"Product": {
"type": "string"


11.  Next, add the action called Get Flow.

12.  Select your environment, and then for the Flow, pick the Flow that you decided upon at step 4 above.  The one I’m using is called Scheduled Task reminder.


13.  Add the action called Compose. Basically, we need to find the old SharePoint site URL from the flow we got at step 12, and replace it with the URL of this new site.  It has to be a string in order to do the replace function, so this is the best way I could figure out.

Put the Flow Definition in there as the Input, and put single quotes on either side of it.  That converts it from a JSON object to a string.  I renamed my action instead of Compose, Flow definition JSON to string


14.  Add the action called Compose again. For the Input, use this expression.


Remember at step 4 when you created that second Flow, and remember what the URL is to that site (highlighted in yellow at step 4)?  This is where you’ll need that.  Notice the single quotes around the URL.  Also notice that it’s got the exact names of my actions in the formula here, so if you name your actions differently that what mine are, your formula will need to be adjusted as well.  To see an overview of what I named all my actions, refer to the screenshot at the very beginning of this post.  Also, that webUrl is what comes from parsing the JSON at the beginning, where it got all of the info about this new site, like it’s name and URL.  I renamed my action here instead of Compose, Find and replace in string


15.  Add the action Set Variable.  For Name, select the name of the variable that you created at step 2, varJSON.

For the Value, use this expression:


16.  Finally, add the action called Create Flow.  Pick your own environment, and for the Flow display name, I recommend something with the name of the site, and what the workflow does.  So I call mine Task reminder – (and then put the name of the site in there).  For the Flow Definition, use the varJSON variable.  Flow state is up to you.  I set mine to Started.

17.  Connection references.  This is the part that I got stuck on in my video demo.  I never did get it figured out, and then figured it out the next day (today).   Click the little icon circled here.  It’s called Switch to input entire array.


18.  After you’ve clicked the icon, the connection references field changes to a single field instead of two.  Insert the connectionReferences from your Get Flow action, like this:


19.  Save the workflow. Done!  Since you’ve already run the workflow back at step 7, you can simply re-run it.  While editing the Flow, click the Test button at the top right, and choose Using data from previous runs.  Click the first one in the list, and click Save and Test.


After the Flow runs, this time it will create another Flow.  So when you go back to your list of Flows and refresh it, the new one will be there, with the name you gave it at step 18.  To see me build this whole thing, and all of my troubleshooting, here is the video:


Here are some good references related to the topics in this post:


Get started creating site designs and site scripts

Site design JSON schema

Check out the Microsoft Flow class that I teach!


  • I don’t see Site Designs in my Office 365 SharePoint settings. Do I need to turn on something? I am a global admin.

  • Maurice Bakker

    Great post and nice to see this can really work, but is this really a good solution? If you have less than 30 sites it is quicker to manually add the flows, and if you have more what would your Flow overview (My Flows, or Team Flows) look like: 30+Flows with the same name, I presume. And what if the process needs to be changed and the logic is copied this many times in seperate Flow instances… Isn’t it better to wait until Flow comes with a “reusable” Flow solution, or to use the business flows?

    • Sure, you can wait until Microsoft comes up with an official solution, but this is the only way to accomplish it as of now. You’re definitely right that it’s messy.

  • Laura – thanks for the detailed instructions. I have used this as a guide to create a site design that runs a flow, and it works up to a point. The Get Flow step in the HTTP Trigger Flow returns a flow definition that contains a reference to the url of the original site where the flow was created (this is what we replace in the Find and Replace in String Step). The flow definition also contains a reference to the GUID of the list (not the list name) on the original site. When I create a new site with this site design, a new list is created which has a GUID different than that contained in the flow definition, so the flow that was created by the site design fails because it can’t find a list on the new site that has a GUID that matches the list GUID contained in the flow definition. If the flow definition contained the list name rather than the list GUID, it seems like this would work, but the different GUIDs is making it fail. Did you run into this issue?

    • In mine, I had it creating the list called Tasks as part of the site design. I was able to simply use the word “tasks” in my workflow, and it worked without a GUID. Try another test, using a very short simple list name, no spaces, and see if it will let you use that instead of a GUID.

    • I have faced an issue simillar to yours. The flow that i am calling from the first flow uses a sharepoint list item creation as trigger. So when the flow is called with get flow action, the flow definition contains the table guid of the sharepoint list that I used for creating the 2nd flow. So, that way even when we replace the site url with the new site url the table guid remains the same. And, thats what I presumed causes the error. So, what I did is I used Send a http request and REST api to get the guid of the list created using the site design when the site design is applied to a new site. And then I simply replaced the GUIDs using the already mentioned method. And now its working perfectly.

  • Pingback: Let it flow! – digital comma

  • Can you do an update to this? My question is does “Power Automate” allow you to save both Power Automate “flow” and site it is attached to when the flow is saved as a “solution”?

    • Nothing has changed that I’m aware of that needs to be updated on this article, besides the name of the product. No, it doesn’t save the site as part of the solution. Solutions do have a new concept that just came out called environment variables or solution variables, but I haven’t looked into or tried those yet, and I’m not sure if it’s relevant to the topic in this post or not.

  • Thank you.

  • I have no action called “Get Flow” has it been removed?

Leave a Reply