I've seen this question asked before, but the answers posted always seem incorrect. For example, in the article below, the user asks how to create a site collection but the proposed solution creates a SUBSITE - in Office 365, there is a HUGE difference:
https://powerusers.microsoft.com/t5/General-Power-Automate/Create-Site-Collection/m-p/294258#M28790
Most answers I've seen make a similar error or advise using Azure functions to run a Powershell script to provision the site collection. What I'd like to know is the following:
1. Has anyone triggered a PowerShell script running in an Azure function from Power Automate which provisions a site collection? Not a subsite - a *site collection.*
2. Based on what I'm seeing, I don't see a way to create the site collection via Power Automate directly via a REST connection. Is that true?
3. Plumsail makes Plumsail Actions and it has a lot of cool activities, including an activity to deploy modern sites - which deploys an actual site collection. Does anyone have experience with these activities?
Solved! Go to Solution.
I'm going to go ahead and post the proper ( 🙂 ) solution to this question in case anyone asks in the future. You CAN create a site collection from Flow very easily. First, an article on creating modern sites with REST:
https://docs.microsoft.com/en-us/sharepoint/dev/apis/site-creation-rest
Second, implementation in Power Automate:
This creates a new site collection! In my example above, I have it triggered from a manual Flow from a list item, but you can trigger it any other way as well. You can also associate the site with a hub site using an additional REST call - details here:
https://docs.microsoft.com/en-us/sharepoint/dev/features/hub-site/rest-joinhubsite-method
You can deploy a site with any site design in your tenant.
I'm going to go ahead and post the proper ( 🙂 ) solution to this question in case anyone asks in the future. You CAN create a site collection from Flow very easily. First, an article on creating modern sites with REST:
https://docs.microsoft.com/en-us/sharepoint/dev/apis/site-creation-rest
Second, implementation in Power Automate:
This creates a new site collection! In my example above, I have it triggered from a manual Flow from a list item, but you can trigger it any other way as well. You can also associate the site with a hub site using an additional REST call - details here:
https://docs.microsoft.com/en-us/sharepoint/dev/features/hub-site/rest-joinhubsite-method
You can deploy a site with any site design in your tenant.
Yes, the second link in my post describes that process.
Yes I followed that, however it times out with BadGateway. Basically I have a process in which a site is created based on a list. That portion is fine.
The associating with a hub site is what keeps failing
"parameters": {
"dataset": "https://domain.sharepoint.com/sites/Test",
"parameters/method": "POST",
"parameters/uri": "/_api/site/JoinHubSite('##########')",
"parameters/headers": {
"Accept": "application/json;odata=verbose\n",
"Content-Type": "application/json;odata=verbose;charset=utf-8\n"
If you're putting the hub site REST call as the step after the site creation, you should add a delay between the two steps. I create my site, have a delay activity (I arbitrarily put 5 minutes), and then perform the hub site REST call. Mine works fine that way.
Thanks @blanghorst .
Can you confirm that, the user/flow connection needs SharePoint admin/ Global Admin rights on tenant right.?
Can this be done by a regular user with his permissions elevation like RunWithElevatedPrivileges in Server Object Model and app-only permission in Provider Hosted model in On-premise environment.
Thanks
Purna
I haven't tested it with a standard user because I ended up not needing it. However, my guess is that if site creation is enabled for users (which I believe is the default), this would likely work for a standard user. You could also potentially run the creation steps in the flow using an account which does have the proper permissions.
Any idea, if we can set external sharing using the same way?
I would have to research that. I'm pretty sure it is possible but don't know off the top of my head.
Has anyone been successful in setting up guest access when the site collection is created?
Hello, thank you for this solution, it was very helpful.
I'm wondering how I can grant acces to multiple owners or, even better, to everyone in the organization except external users. Now only the person mentioned in the request has access.
Yes, you should be able to add users to the site via the workflow. You should be able to use the "Send HTTP Request to SharePoint" to do a REST call to add users to the respective groups.
Thank you.
Can you also add a group?
Goals is to give everyone (except outside users) access to the site. Now I would have to add users one by one.
Thank you for your help.
To add multiple users you would add them to an array variable, then do a For Each when adding the users. Now if you just want to do something like "Everyone except external users" you'd take the ID of that AD group and use that.
The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.
Announcing a new way to share your feedback with the Power Automate Team.
Learn to digitize and optimize business processes and connect all your applications to share data in real time.
User | Count |
---|---|
40 | |
18 | |
16 | |
15 | |
13 |
User | Count |
---|---|
67 | |
36 | |
28 | |
21 | |
19 |