How to Automate O365 User Creation Process by Power Automate?⚡

Introduction

The automation of the user creation process in O365 is a game-changer, drastically reducing the time and effort required to onboard new users. By simplifying the user creation process and separating the approval and licensing steps, organizations can benefit from enhanced efficiency, reduced administrative workload, and a smoother onboarding experience for new users.

You just have to fill out the form and submit it, and within 1 second, the Manager gets an email to approve. Even via phone, he/she can approve with one click. Then, within 1 second, a user will be created in O365 with all the details. Parallelly, the System Administrator gets an email notifying about the new user creation, and then he/she just has to assign a license.

By automating the user creation process, the System Administrator only needs to log into the Microsoft 365 Admin Center or Entra Admin Center to assign a license to the newly created user instead of creating and filling in the details of the user.

Prerequisite

  • Microsoft Form with relevant attributes. (First name, Last name, Display name, User UPN, Manager UPN, Requester UPN, etc.)
  • Basic knowledge of Power Automate functions

Notes

  • Both the Microsoft form and the Power Automate flow should be created with the same Microsoft account.
  • Rename all actions to identify the flow easily. Here, I have renamed and described the actions to give a better understanding.

Step 1. Log in to Microsoft Power Automate and create a new flow (Automated flow).

Step 2. Give a flow name and choose the flow trigger as "When a new response is submitted"

Flow trigger image

Step 3. Enter Form ID (All the forms will automatically display, and select the relevant form)

Step 4. Add an action as "Get response details"

  • Form ID: Select the relevant Form ID from the list.
  • Response Id: Click and enter the attribute Response Id.

Get response details image

Step 5. Add an action as "Initialize variable" and fill as below. Rename action as Password.

Enter the value as Adm and Expression rand(10000,99999).

Initialize variable image Initialize variable image

Step 6. Add an action as "Get user profile (V2) and select Manager UPN in Forms.

Attributes in Microsoft Form will display when we click the blank cell and select the appropriate attribute.

Get user profile image

Step 7. Add an action as "Search for users(V2) and select User UPN in Forms

In this step, we are searching whether a user with the same UPN exists or not.

Search for users image

Step 8. Add an action as "Condition"

Click the "Choose a value" Expression tab, type length(outputs and select "outputs" named Search for users... and "body/value" headings from the Dynamic content tab. Full function as below.

length(outputs('Search_for_users_(V2)_-_To_search_if_the_user_already_exists_in_the_tenent')?['body/value'])

Condition image

Step 9. If yes, Add an action as "Send an email (V2)"

If there exists a user with the same UPN, we will send an email to the requester to change the UPN. Otherwise, I will send the email to get the Manager's approval.

Customize the Subject and Body as you wish. Below is an example.

Send an email image

Step 10. If no, Add an action as "Start and wait for approval"

Approval type – Approve/Reject First to respond.

Customize the Title and Details as you wish. 'Assigned to' should be Manager UPN as to send the approvals to the manager. Below is an example.

Start and wait for an approval image

Step 11. Add an action as "Condition"

Click "Choose a value" Dynamic content Outcome.

The next tab is equal to, and type Approve in the last tab.

Condition image

Step 12. If yes, Add an action as "Create user in Entra" and Enter appropriate details as follows.

Create user in Entra image

Step 13. Add an action to 'Create user' as "Assign manager in Entra". Then Add a parallel branch to 'Create user' as "Send an email (V2)".

In this step, send an email to the Manager with login credentials. Customize the subject and body as you wish. Below is an example.

Send an email to the Manager image

Step 14. Add an action as "Send an email (V2)".

This step is to notify the System Administrator that a new user has been created and assigned a license.

Customize the subject and body as you wish. Below is an example.

Send an email to System Administrator image

Step 15. If no in the condition, which means if the Manager rejects the approval, notify the requester.

Customize the subject and body as you wish. Below is an example.

Notify the requester image

Suggestions. You can automate the License assigning with a few steps with Azure Runbooks.


Similar Articles