Create User In Azure AD And Assign Office 365 Licenses Using Power Automate

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) then 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 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 SharePoint Custom List

  • Create Azure AD group

  • Assign Licenses to Azure AD group

  • Create a flow in Power Automate to automate the process

  • Test the process

Create SharePoint Custom List

Navigate to SharePoint site and create a custom list named as “Onboarding Users”. Create all the required columns as shown in the below screenshot.

Create Azure AD group

Navigate to Azure portal (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 Azure AD group

Navigate to Azure portal (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 Azure AD group successfully.

Create a flow in Power Automate

Navigate to Power Automate portal (flow.microsoft.com). In the left navigation, click Create and then click Automated flow. Select “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 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 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. User account is created and added to Azure AD group

Summary

Thus, in this article, you saw how to create a new user in Azure Active Directory and assign Office 365 license to the user using Power Automate.