In this article, you will see how to create a new user in Azure Active Directory and assign Office 365 licenses to the user using Power Automate.
Use case
Consider a scenario, whenever a new user joins the organization (small organization) the manager/hiring manager needs to create an account in AD and enable an Office 365 license. Instead of doing this activity manually, the hiring manager/manager can just fill in the user's basic details in a SharePoint list form and Power Automate will be triggered to create an account in Azure AD and assign licenses.
There is no action available in order to assign the Office 365 license to users in Power Automate. In order to achieve this we need to create an Azure AD group and assign appropriate licenses to that group. Once the user is created in Azure AD, we need to add that user to the Azure AD group.
Click here to learn about assigning licenses to users by group membership in Azure Active Directory.
Flow Design
In order to achieve this, you need to perform the following tasks,
- Create a SharePoint Custom List
- Create Azure AD group
- Assign Licenses to the Azure AD group
- Create a flow in Power Automate to automate the process
- Test the process
Create a SharePoint Custom List
Navigate to the SharePoint site and create a custom list named “Onboarding Users”. Create all the required columns as shown in the below screenshot.
Create Azure AD group
Navigate to the Azure portal (https://portal.Azure.com). Navigate to Azure Active Directory Resource and click Groups.
Click New Group.
Enter all the required details and click Create.
Azure AD group is created successfully.
Assign Licenses to the Azure AD group
Navigate to the Azure portal (https://portal.Azure.com). Navigate to Azure Active Directory Resource and click Licenses.
Click All Products and select the Office 365 License. Click Assign.
Select the Azure AD group for which the license has to be assigned and click Assignment options to turn on/off the services available to the users.
Click Assign. Licenses are assigned to the Azure AD group successfully.
Create a flow in Power Automate
Navigate to the Power Automate portal (https://flow.microsoft.com). In the left navigation, click Create and then click Automated Flow. Select the “When an item is created” trigger and click Create.
When an item is created trigger?
Select the site address and list name.
Click New Step and add the Create user (Azure AD connector) action.
Create user action
Add the dynamic contents as shown below.
Click New Step and add Add user to group (Azure AD connector) action.
Add user to group action
Go to the Azure AD group to get the group ID. Add the dynamic contents as shown below.
Enter the flow title and click Save.
Test the process
Navigate to the SharePoint list and create a new item.
Flow has run successfully. A user account is created and added to the Azure AD group.
Summary
Thus, in this article, you saw how to create a new user in Azure Active Directory and assign an Office 365 license to the user using Power Automate.