In this post, I would like to talk about automated site collection and Teams (Microsoft Teams) provisioning in Microsoft 365. We had to provide a Self-Service site and Team creation for one of the clients instead of depending on Admins and at the same time without compromising governance. For this, we have introduced Admin approvals. The SharePoint site also should be created with a custom template.
We have developed a Governed Self-Service Site Creation solution. The process is as follows (this process was inspired by the MS Doc article):
-We have created a hub site to group/organize all the sites requested by a specific group/department.
-Custom List is used to drive user requests for a new site and it is maintained in the hub site.
-Invoke Power Automate for approval by admin before creating a site ( Power Automate Process including, Approval and Call Azure Function to initiate provisioning).
Provisioning Solution 1. Create a Site Template using the PnP provisioning engine. The following articles explain the easier way to create a site template:
2. Create a Tenant Template to provision teams in Microsoft Teams using the PnP provisioning engine.
3. Setup the Daemon app in Azure Active Directory to provision resources as the Azure function executes the scripts using application identity instead of user identity. Daemon app needs following permissions to provision Sites and Teams.
4. Create a Hub site
5. Create a List to handle user requests.
6. Create a Power Automate to trigger when an item added to the above list.
7. Approval request will be sent to Admin. If Admin approves, then approval confirmation email sent to the requestor and SharePoint list item status changed to "Provisioning". Otherwise, a rejection email will be sent to the requestor and the status changed to "Rejected".
8. After updating the status, we have initiated a few variables to invoke the Azure function.
9. We have created three Http trigger Azure Functions to perform the complete provisioning process. First one is for Create Site, the second one is to apply Site Template and the third one is for Teamify the newly created site.
10. If all activities are successfully completed then success notification, otherwise failure notification, will be sent to the requestor.
11. We have followed this article to create azure functions as we have used PnP PowerShell commands to do all activities.
Let's look at the PowerShell scripts of each function.
Apply Site Template:
Create Teams (Teamify):
Exported from pokurim365.blogspot.com on November 1st, 2020