Site Governance using Microsoft Flow and Site Designs

I’ve recently blogged about Controlling site sprawl by implementing Modern Governance in your SharePoint environment. This post will show a practical way to do just that by extending the Site Script and Site Design I built for a modern Project Team site (Building a Modern Flat Project Hub using Site Designs). The site design in that post added some standard Information Architecture components, updated the navigation and joined it to a Project Hub. 

Using this Microsoft post as a reference, Calling Microsoft Flow from a site script, I’ll extend the site script from my post above to keep track of new Project sites in a list. We can then leverage the list to automate some governance processes for Project sites. This model can easily be extended to additional site types in your tenant. 

Steps: 

  • Create a SharePoint list to hold site details
  • Create a Microsoft Flow (triggered by an HTTP Request) to:
    • Create a new item in the SharePoint list
    • Send email to Information Management team
    • Send email to Training/Adoption team
    • Add Planner tasks for each team
  • Update Site Script to trigger the Microsoft Flow
  • Test it out!

Read on for more detail. 

Create a SharePoint list 

In this example, we have a Modern Communication site already created to house Governance material. Examples of content on this site: 

  • who the Governance stakeholders are 
  • what the Standard Operating Governance is 
  • what the Information Management Guidelines are

This site is the ideal place to store the site tracking SharePoint list called Site Governance. Here’s the information we’ll track for each item: 

  • Site name (single line of text – rename the Title column to this) 
  • TypeOfSite (choice: Project, Team, Community) 
  • SiteStatus (choice: Provisioned, Deleted) 
  • webUrl (Hyperlink or Picture) 
  • webDescription (single line of text) 
  • creatorName (single line of text) 
  • creatorEmail (single line of text) 
  • createdTimeUTC (single line of text) 
  • SiteTrainingComplete (Yes/No, default No) (Optional) 
  • InformationManagementTrainingComplete (Yes/No, default No) (Optional)

Tip: For the column TypeOfSite, include choices for all types of sites to be provisioned in your tenant (Project, Team, Community, etc.). This allows you to build different flows for each type of Site Design and take different action on each. You can then create a list view grouped by this column to organize your sites. 

Here are the columns. All but the Site Name column were added as site columns (Site Name is the Title column renamed): 

Create a Microsoft Flow 

The flow will be triggered by an HTTP request from the Site Script (next step). The Flow is an opportunity to automate many things, however for purposes of this post we’ll use it to do 3 things: 

  • add a new item in the above Site Governance SharePoint list 
  • send emails to the Site Training and Information Management teams 
  • assign Planner tasks to the Site Training and Information Management teams

The JSON schema is extremely important for the Flow to be able to parse the properties being sent from the Site Script. I followed the above referenced Microsoft blog post however I also included the title property of the site provisioned (webTitlein the JSON schema since I want to use that in the Flow in numerous places. Here is the final schema (click link if not expanded) 

https://gist.github.com/joannecklein/e5182a438e68175877f15305bbbbf9f1 

The next step is to create the new item in the SharePoint list, Site Governance, taking the values from the Site Design to populate it. Here is that expanded step: 

Here is the entire Microsoft Flow and the additional steps to send emails and add the Planner tasks: 

To call this Flow from the Site Script, we need to copy the workflow trigger URL (circled) from the HTTP request step at the start of the Flow:

Trigger the Microsoft Flow from the Site Script 

I’m extending the site script from the blog post, Building a Modern Flat Project Hub using Site Designs, to do 2 additional things: 

  • include the triggerFlow script action so the Flow will be triggered when the site is provisioned. With the URL copied from the previous step, build a new script action for the triggerFlow verb:

  • add the Information Management team to the site’s Visitors group. This is done so they will have authorization to click the link to the new site in the email we’re sending to them. In this example, I’m using the Office 365 group address for the Governance Team.

… and insert both it into the script from the above blog post. Here is the complete final site script file on GitHub: 

https://gist.github.com/joannecklein/6b438fe20b6e8f063c53cf43684452bc 

With PowerShell, I removed the old site design for Project site (Remove-SPOSiteDesign), created a new site script with the above changes and added a new site design for Project site with the updated script: 

Test it out! 

When I select the Team site tile from the SharePoint app’s Create site link, I see Project Site as a design option. The 3 numbered items below will now be mapped to columns in the Site Governance SharePoint list: 

  1. Site name – will map to the Title property and be used in emails and tasks 
  2. Site Address – will map to the webUrl property and used in email and list 
  3. Site description – will map to the webDescription property 

When I create a new Project Site, the site actions run and the Microsoft Flow is triggered. The SharePoint list item is created, Visitors access is granted, 2 emails are sent and 2 Planner tasks are created for the Project site just created. Awesome! 

Site Governance SharePoint list: 

My thoughts 

I really like the tools and capabilities now available for advanced power users to be able to build end-to-end solutions for some of an organization’s requirements and to implement some governance controls along with it. Although this post demonstrated Project sites, it could easily be extended to many types of sites in your tenancy for different actions on each. 

Powerful indeed. 

Thanks for reading. 

-JCK 

Did you enjoy Joanne’s blog? Read Valo’s newest eBook written by Joanne C. Klein to learn all about Modern Site Architecture!

***

Would you like to learn more from the incredible Joanne C Klein? We’ve got you covered! 😉👍

Read what she has to say about:

Integrate the Microsoft 365 Learning Pathways solution into your own modern Adoption Center

A modern policy hub and archive

Content type benefits in Modern SharePoint

Controlling SharePoint sprawl with modern governance

***

Stay tuned for more invaluable content from thought leaders in the Microsoft community by following us on social!

FOLLOW US ON TWITTER

Schedule your free demo!

Want to make your life much easier and work more effective? Yes! We’re more than happy to schedule a demo with you! Just contact us and we’ll get back to you.

We keep your information safe. Read more from our Privacy Policy.

Subscribe to our Newsletter

Get our news delivered right into your inbox. We won’t spam, promise!

We keep your information safe. Read more from our Privacy Policy.