Automating User Creation in Microsoft Entra ID using Microsoft Power Automate

In this article, we explore automating user provisioning in Microsoft Entra ID using Microsoft List Form for SharePoint List and Power Automate. We streamline the process by setting up a dedicated list, customizing the form, and automating user creation with dynamic password generation and email notifications.

In this article, we’ll explore into the process of automating user provisioning within Microsoft Entra ID utilizing the powerful combination of new Microsoft List Form for SharePoint List and Microsoft Power Automate.

Microsoft List Form Setup

Let’s kick things off by setting up a new list in SharePoint List dedicated to user creation. We’ll name this list “User Creation” and ensure it contains the following columns:

Display Name Internal Name Field Type  
Username Title Single Line of Text Unique: True

Required: True

First Name Firstname Single Line of Text Required: True
Sur Name Surname Single Line of Text Required: True
Display Name Displayname Single Line of Text
Personal Mail PersonalMail Single Line of Text
  • Once the columns are set up, we can proceed to create a new Microsoft List Form. By appending the querystring “env=WebViewList” to the URL, we can access the form within the Microsoft Lists user experience.
https://<yourtenant>.sharepoint.com/sites/sitename/Lists/UserCreation/AllItems.aspx?env=webViewList
  • Upon accessing the form, we’re presented with options to customise its appearance and functionality. Utilizing the Customize tab, we can perform the following actions step by step:
      • Reorder columns as needed
      • Choose to show or hide specific field according to requirements
      • Modify the form’s theme and background to align with preferred style
      • With in the Settings section, we can define specific messages to appear after the form is submitted.
  • we can reorder columns, show/hide specific fields, and even modify the form’s theme and background. The Settings section allows us to define appropriate messages to be displayed after form submission.

  • After customizing the form to meet our specifications, we can proceed to preview it. Following the preview, we then obtain its URL by navigating to the “Send Form” tab and selecting the “Copy link” button.

Automate User Creation process

Having configured the form, our next step involves automating the user creation process using Power Automate Flow.

  • Navigating to the Power Automate Flow homepage.
  • We create a new flow using the “When an item is created” trigger and name it “User Provisioning (Automated)”.
  • Within the flow, select the Trigger action and specify the SharePoint site address and list name corresponding to our user creation list. Additionally, we incorporate a Compose action to dynamically generate a password adhering to Microsoft 365 Password policy requirements.
concat(substring('abcdefghijklmnopqrstuvwxyz',rand(0,25),5),substring('!@#$%^&*()?.<\>|=+:;,[-_]"',rand(0,24),2),substring('1234567890',rand(0,9),1),toUpper(substring('abcdefghijklmnopqrstuvwxyz',rand(0,25),3)))
  • After adding the expression, change the action name to “Compose Generate Random Password“.

  • Them add a new action called Create user, which is available in Microsoft Entra ID connector group and fill up the following parameters,
Account Enabled Yes
Display Name triggerBody()?[‘DisplayName’]
Mail Nickname triggerBody()?[‘Title’]
Password outputs(‘Compose_Generate_Random_Password’)
User Principal Name concat(triggerBody()?[‘Title’],’@<tenant name>.com’)

ex: concat(triggerBody()?[‘Title’],’@contoso.com’)

Given Name triggerBody()?[‘FirstName’]
Surname triggerBody()?[‘SurName’]

  • This action is customised to populate user creation parameters, such as Account Enabled, Display Name, Main Nickname, User Principal Name, Given Name and Surname.
  • To conclude the automation process, we add a new action called “Send an email (V2)“to notify users of their account creation. This email includes details such as the user’s personal email, username and password.
To triggerBody()?[‘PersonalMail’]
Subject New user account created
Body Dear outputs(‘Create_user’)?[‘body/displayName’],
Your account is created successfully.
Use the below details to sign in,
Mail ID: outputs(‘Create_user’)?[‘body/userPrincipalName’],
Temporary Password: outputs(‘Compose_Generate_Random_password’)Regards,
HR Team
Importance Normal

By following these steps, we streamline and automate the user creation process within Microsoft Entra ID, enhancing efficiency and reducing manual effort.

Overall, this automation not only enhance efficiency but also significantly reduces manual effort, empowering organizations to focus on higher-value tasks while ensuring a smooth onboarding process for new users.

Shantha Kumar
Shantha Kumar
Articles: 295