Trigger MSFlow from SharePoint Site Design

Today i am sharing knowledge how can we trigger Microsoft Flow using SharePoint site design.
What is site design ?
To automate provisioning new or existing modern SharePoint sites that use your own custom configurations.
We need to ensure some level of consistency through out the share point modern site in organizations.
For example, we may need proper branding and themeing applied to each new site.
You may also have detailed site provisioning scripts, such as using the PnP provisioning engine, that need to be applied each time a new site is created.
Site designs are like a template. They can be used each time a new site is created to apply a consistent set of actions .
(i.e. As per my simple understanding Site Design(Modern Site) = Site Defination(SharePoint OnPrem))

What is Site Script ?
Site scripts are JSON files that specify an ordered list of actions to run when creating the new site. The actions are run in the order listed.
Fix Pattern which help us to provide the order of SharePoint objects like Site Column, Site Content Type, List, Document Library, Apply Theme.
I have mention below sample json file of site script.

For a complete list of available actions and their parameters, see the JSON SCHEMA

  "$schema": "",
  "actions": [
      "verb": "applyTheme",
      "themeName": "Contoso Explorers"
      "verb": "createSPList",
      "listName": "Customer Tracking",
      "templateType": 100,
  "version": 1

How can we get Ms Flow URL?
Create a new flow
Create a new flow using blank template
Select action “When a HTTP request is received ” from the action selection.
Once you save the flow HTTP POST URL generated automatically.
Copy that URL and keep it in safe place. We will use it in site script.

Add new step “Send an email” . Configure To, Subject, Body etc.

MS Flow Configuration

Let’s create Site script to trigger a Microsoft flow from site design.
Create a new file with name site-script.json.
Copy below code and paste it in Json file.

  "$schema": "schema.json",
  "actions": [
      "verb": "triggerFlow",// Action used for trigger flow
      // url you can create from flow action.
      "url": "<Update Flow URL>",// Paste URL which we have generated from MS Flow
      "name": "Team site + Teams",
      "parameters": {
        "event": "Microsoft Event",
        "product": "SharePoint"
  "bindata": {},
  "version": 1

Add site script to your tenant using power shell
Open SharePoint Online management shell and connect to your tenant in to the SharePoint Online Management Shell
How to connect SharePoint Online in power Shell?

Once Connection is established. Get content from the "site-script.json".
To add script in to the tenant use Add-SPOSiteScript and add properties.

C:\> Get-Content 'c:\scripts\site-script.json' `
     -Raw | `
     Add-SPOSiteScript `
    -Title "MsFlow Trigger"

Id          : 2756067f-d818-4933-a514-2a2b2c50fb06
Title       : MSFlow Trigger
Description :
Content     :
Version     : 0

Bind Site script to site design
To add site script to site design use command Add-SPOSiteDesign

C:\> Add-SPOSiteDesign `
  -Title "MSFlow Trigger" `
  -WebTemplate "64" `
  -SiteScripts "2756067f-d818-4933-a514-2a2b2c50fb06" `
  -Description "Trigger MS Flow from Site Design"

Note: .
WebTemplate : Defines the Team Site or Communication Site
SiteScripts : Provide the Scripts which we have created.
Title : Site Design Name
Description: Site Design Description

Microsoft has provided certain commands to add, remove and get site scripts and site designs.To explore power shell commands click here

Now Create a new site using URL
Click on New Site
Select Team or Communication site.
Choose Site from the drop-down. Here you can see the site design with name “MSFlow Trigger“.
Once site is configured, User can get the email from flow.

Valuable feedback is always welcome.
Happy Coding 🙂

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.