Auto-provisioning of SharePoint sites is one of the productive tasks that we can set up in any organization to reduce the number of Server Tickets raised with IT for site provisioning. We can set up a Power Automate to get this done and build some additional functionalities like applying Out of the Box or Custom Site Templates(Previously Site Designs) to the created site to add a layer of additional functionality
In this article, we will see how to use Power Automate to auto-provision Communication Sites by creating a List Item entry with the basic site information and applying an Out of the Box Site template to the newly created site.
Business Use Case
We have a requirement where we need to disable the Create Site Option in the SharePoint start page which we will do by going to the SharePoint admin center -> Settings ->Site Creation and disable the option “Let users create sites from the SharePoint start page and OneDrive”
This will disable the Create a new site which otherwise will appear in the SharePoint Start Page
This way unnecessary site creations can be avoided by restricting access to the site creation button. However, we will still need to provide an option to a selected group of users to create sites for their team.
We can achieve this by creating a SharePoint List that has restricted access to a limited set of users and providing it with a set of columns that would capture the needed information for Site Provisioning. When a user creates an item by filling these needed columns, Power Automate will pick the values and create a SharePoint Site using the selected template.
Let’s create a List called Site Creation Wizard and add the below columns to it:
The Site Template column will be a choice field to hold the site template/design values which can be applied on top of a communication site.
Build the Flow
We will now move on to Power Automate and create a cloud flow with the trigger – When an Item is Created. We will also initiate a variable of type object that will hold the corresponding template IDs for each of the Site Template/Design names. The rationale behind storing this key-value pair is that, when a user selects the site design name from the choice drop-down, we will need to get the corresponding ID to use in the site provisioning action.
In the next step, lets initialize a variable to get the Site template ID of the selected Site Template/Design by using the expression
Once we have the Site template ID, let’s add the HTTP Request to SharePoint action and provide the values as shown in the below diagram. We will issue a POST request to the URI – _api/SPSiteManager/create and keep the Site Address as the SharePoint Admin Center URL. In the Body, we will paste the request payload with the below values :
The Title that should come up in the Site Title bar
The URL where the site should be provisioned, we are getting the Site Address from the user that should come after /sites
Locale identifier . By default 1033 is English(United States)
Description for the site obtained from the user
By default, we are creating a communication site that has the web template ID: SITEPAGEPUBLISHING#0
Site Design ID
The user has supplied the Site Design/template name which we cross-check against the variable -varTemplateIDs to get the associated ID
Email ID of the item created user
Thus the overall flow will look like this:
Test the flow :
So as to test the flow, let’s create a list item with the needed information.
This will trigger the flow and it will create a Communication Site using the Site Template – Showcase and we can see the Site Status as 2 which indicates a successful creation :
The full set of values for SiteStatus are as follows:
- 0 – Not Found. The site doesn’t exist.
- 1 – Provisioning. The site is currently being provisioned.
- 2 – Ready. The site has been created.
- 3 – Error. An error occurred while provisioning the site.
The site has also been provisioned at the provided URL :
Thus, we saw how to create an Auto Provisioning Site Solution using Power Automate and a SharePoint List and we also saw how we can give the end-users the flexibility to customize the created site using one of the available Site Templates/Designs.