How to create a modern Team site with Microsoft 365 group using Power Automate
Tags: microsoft365, powerfuldevs, powerplatform, sharepoint
Published: 2023-03-05 15:52:21

######(THIS POST HAS BEEN MIGRATED FROM MY PREVIOUS BLOG PUBLISHED ON DECEMBER 12, 2020.)######

---

_OMG! I completely forgot about this blog. The reason for my absence is not that I didn't have much to write about (in fact, it's the opposite). I had so many ideas, but I haven't had the time to sit down and organize them to post here. So, let's get started!_

The other day, I was asked to create a list that would trigger a flow to automate the creation of a modern Team Site associated with an Office 365 group. I have to be honest, the process was not as straightforward as I had imagined. Here, I'll explain how I achieved my goal.

I started by creating a list with the necessary columns (_the user will only need to fill in the "Name" field, which is the name of the Team Site_)...

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/skl5xlf7jzg4v0eqy7c8.png)

 I then moved to Power Automate and started work on my flow. As the trigger, I selected "When an item is created" to retrieve the list of projects I created in the previous step.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cvndssyin3s7ixwk4bgn.png)

Here comes the ~~magic~~ important part, the action! It will literally add action to your flow. In the new step, I searched for the action "Send an HTTP request to SharePoint".

In Power Automate, the SharePoint Send HTTP Request flow action lets you construct and execute SharePoint REST API queries. This action is particularly useful in cases where the existing SharePoint flow actions do not handle your requirements, or the action you are looking for is not yet available in the SharePoint connector. As Microsoft's documentation explains, this action allows you to extend your SharePoint capabilities beyond what is available out of the box.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jrntdq17pz4q7wy28cwx.png)
Then fill the fields as image bellow.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dlu56ri0a00utvqtmejh.png)
In "Site address", you're going to put your root address like so: https://TENANT.sharepoint.com.

In the Uri as endpoint, you're going to use "/_api/GroupSiteManager/CreateGroupEx". This will allow you to pass the Display Name, Alias, and the boolean "isPublic".

The next step is to add the "Parse JSON" action and paste the output of the "Send an HTTP request to SharePoint" action into the "Schema" field.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ba8gvkcvlwdcq80hj88c.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ur64jrhxzw25whvf1lsp.png)
When it's done, you're good to go and update your list item with the newly created properties. To do so, you will need to add one more action: "Update file properties".

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/c62stks72zc3xg4is88t.png)

This time, in the "Site Address" field, you're going to select the site where your list lives, something like so: https://TENANT.sharepoint.com/sites/SITENAME/Lists/LISTNAME. Select the list you created in the first step of this tutorial and the item ID. Fill the fields of your list columns and, hopefully, everything is successfully configured.

Whenever you create a new item in the list, a new modern Team Site should be created and the flow updates the list columns with the new status (Active) and URL.

So, that's it! I hope you find this post helpful and why not develop it further with an approval request or assign multiple owners?

See you in the next post! 😉