In today’s fast-paced digital landscape, organizations strive to streamline user onboarding processes while ensuring efficient access to various platforms and resources. But traditional methods often involve manual tasks, requiring direct access to the Azure AD portal and causing unnecessary delays. By integrating Power Automate and SharePoint Online, organizations can revolutionize their user onboarding experience, empowering operators to handle the process without accessing the Azure AD portal.
This article explores how the combination of Power Automate and SharePoint Online can automate user onboarding. Operators can submit user details by adding an item to a SharePoint Online list, triggering a seamless automated workflow. This approach saves time, reduces errors, ensures consistency, and enables organizations to scale their onboarding efforts efficiently.
Stay tuned, and we will delve into implementing an automatic user onboarding process using Power Automate and SharePoint Online.
- Access to an Azure AD tenant with a Power Automate license.
- This tutorial will only include the free connectors, so you don’t need a premium license.
User Onboarding Flow Overview
In this tutorial, we’ll cover the following scenario.
- The new user details submission is made through a SharePoint Online list.
- A Power Automate flow monitors new items added to this list and triggers the following actions.
- Search the directory to confirm if the user already exists.
- If the user does not exist, create a new user in Azure AD.
- If the user already exists, notify the team mailbox, and terminate the flow.
- Assign a manager.
- Email the manager about the newly created user, including the username and password.
- Search the directory to confirm if the user already exists.
Set Up the SharePoint Online List
Let’s first set up the SharePoint Online list where the new user details will be submitted.
In this example, we are using a Team Site called IT Ops with the following URL: https://lazyexch.sharepoint.com/sites/ITOps. This team site is private and only members have access to it. This way, only members can submit new items.
Next, let’s create a new list. Click New → List.
Select the Blank list option.
Enter the new list’s name and description (optional) and click Create. I’ll name the list as New User Onboarding.
To edit and add columns, click the Settings icon → List settings.
Create the following columns.
|User Principal Name||Single line of text||Yes|
|First name||Single line of text||Yes|
|Last name||Single line of text||Yes|
|Alias||Single line of text||Yes|
|Display Name||Single line of text||Yes|
|Initial Password||Single line of text||Yes|
|Manager||Person or Group||Yes|
Once the columns are created, they should resemble the column list below.
Your SharePoint list is now ready.
Create a Power Automate SharePoint Online Flow
Let’s now create the Cloud Flow in Power Automate. Log in to the Power Automate web at https://make.powerautomate.com/.
Click My flow → New flow → Automated cloud flow.
Enter the flow name. In this example, we’ll call it “User Onboarding”. Select the “When an item is created” trigger, and click Create.
Configure the Trigger Source
Select or enter the SharePoint site address and list name, and click New step.
Search for the User
Choose the Search for users (V2) action.
Under the Search term box, click Add dynamic content, choose the User Principal Name item, and click New step.
Next, select the “Initialize variable” action.
Name the variable “user_exists” and select the type “Boolean”.
Click Add dynamic content → Expression in the value and enter the following formula:
The above expression verifies if the previous action had no output (did not find a user matching the UPN). The value is true if the user was found (the result is not empty). The value is false if the user was not found (the result is empty).
Click New step. Select the Condition control action.
In this step, we’ll test whether the user_exists value is true or false. On the left field, select the “user_exists” variable.
On the left field, type “true”.
The editor automatically adds the “If yes” and “If no” control branches.
Condition 1: If the User Already Exists
If the user with the same UPN already exists, the actions will be to notify the team mailbox and terminate the flow.
Click “Add an action”.
Select the “Send an email from a shared mailbox (V2)” action.
Now, specify the following:
- Original Mailbox Address: The shared mailbox to be the email sender.
- To: The email recipient(s). In this example, the email will be sent to the team mailbox.
- Subject: The email notification subject.
- Body: The email body. You can also add dynamic content here.
Condition 2: If the User Does Not Exist
If the user with the same UPN does not exist, this logic will create a new user.
Under the “If no” control branch, click Add an action.
Choose the “Get user” Azure AD action.
In the “User Id or Principal Name”, select the “Manager Email” dynamic content item.
Let’s rename the step from “Get user” to “Get Manager Details”, and click Add an action.
Create the New User
Select the “Create user” Azure AD action.
Fill in the required information, as shown below. Ensure to select the appropriate dynamic content from the SharePoint Online list. Click Add an action.
Assign the Manager
After the user creation, let’s add an action to assign a manager. Select the “Assign manager” action.
In the User Id or Principal Name, select the “Id“ item under the “Create a user“ dynamic content.
In the “User Id of the Manager”, select the “Id“ item under the “Get Manager Details“ dynamic content. Click Add an action.
Notify the Manager
The final action is to send an email notification to the assigned manager.
Choose the “Send an email from a shared mailbox (V2)” action.
Specify the sender, recipient, subject, and body of the message.
If you’ve followed the instructions accurately, you’ll end up with the below flow.
Click the Save button, and you’ll see a confirmation banner message like this one. In this case, your new Power Automate SharePoint Online flow was created without errors.
Test the Power Automate SharePoint Online Flow
On the upper-right of the Flow editor, click Test.
Select Manually under Test Flow, and click Test.
Now, switch to the SharePoint Online list and add a new item.
Switch to the Power Automate editor and await confirmation, as shown below.
According to the test result, the Power Automate SharePoint Online flow ran successfully.
The manager, Homer Simpson, received the email notification about the new user account details.
And the user has been created, and the manager has been assigned.
This blog post has shown how to create an automatic user onboarding process using Power Automate and SharePoint Online. This process can save time and resources, and it can also help to ensure that new users are onboarded quickly and efficiently.
The process outlined in this blog post can be customized to meet your organization’s specific needs. For example, add steps to the process, such as adding the user to a group to apply group-based licensing.
However, the basic steps outlined in this blog post provide a good starting point for creating your own automatic user onboarding process.