Introducing Dynamics 365 F&O License Automation
When the license enforcement was announced at the end of March 2025, I got heavily involved in several client projects, and I participated in weekly office hours to provide feedback to Microsoft for fixing bugs and improving the new license reporting. During several talks and interactions, it became clear that there is a need for automation on license assignments for Dynamics 365 Finance and Operations licenses. I’m thrilled to announce that I created a solution via Power Automate, which I now share on this blog site.
Introduction
Users of Dynamics 365 require a license. Assigning a license for Microsoft365 or Dynamics 365 Customer Engagement apps is straightforward in the Microsoft 365 Admin Center. When onboarding users who also need Dynamics 365 F&O apps, there is a complexity as the required license(s) depend on the security roles granted in the application. This information is often not known when creating the user in Microsoft Entra ID. When the user is set up in Dynamics 365, you need to wait for an update of the User License Consumption reports on the Power Platform Admin Center or the Licenses Usage Summary page in Dynamics 365 F&O.
Then you need to go back to the Microsoft 365 admin center and assign the licenses. For organizations, this is unwieldy and time-consuming.
Assignment options
For assigning licenses, you can choose a manual option and directly assign licenses in the Microsoft 365 admin center. There is also an option to create Entra ID groups for each Dynamics 365 license SKU, assign the license to the group, and add users to these groups.
There is also an option for system administrators to manage licenses using PowerShell. Marijan Sivrić wrote an extensive blog about this option. See: D365FO License Management with PowerShell
Using PowerShell, you can assign multiple licenses at once, but when following the blog, there are still manual interactions required.
License automation
Since September 2025, I have been working on the idea for Power Automate scripts. My goal was to provide a solution to the community that does not require installing additional customizations in Dynamics 365 F&O that could find out what licenses are required when assigning and removing security roles from a user. Then, a license, if available, should be assigned. The steps were the validation of what options could be used in Power Automate flows. It is possible to assign users to Entra ID groups, which was the first feature I found. There is an Entra ID group connector available that can assign users to a group. One downside is that there is no direct feedback if the user was also assigned a license linked to the group. This is because the connector is not aware of licenses assigned to the Entra ID groups. There is also a challenge to link a group with a Dynamics 365 license SKU, but for sure not impossible.

A next search learned that it is possible to use HTTP calls to Microsoft Graph, which has an API to read and update users and licenses. Then, instead of having an additional step to create an Entra ID group per license SKU, I decided to directly interact with the Microsoft Graph API and assign licenses directly without using the groups. In case you are currently using groups and want to continue using them, know that it can be achieved with a different flow.
Configuring the flow
Building the flow was quite an extensive job. Where I have development experience, the options in Power Automate make you think differently. Step by step, I added actions to the flow. E.g., find available licenses, link them to the Dynamics SKUs listed in the Licensing tables, but also check what licenses are required for the user and if they are already assigned. When the flow was finally working, I added more validations, result logs, and checked for the performance. The flow was running for almost a minute per user. This is not an issue for a trigger based on role assignments. I then also wanted to support a run across all users. How to run this flow for 1000 users? I then checked for some smarter options, which resulted in flow runs between 15 and 20 seconds per user. In case the user can be skipped, the flow ends within 5 seconds. In addition, a parent flow for looping all users was set to run multiple users in parallel. The maximum concurrent sessions to run in parallel is 50. When testing this, the flow was running between 2 and 3 minutes. There was one major drawback, as due to concurrent calls, license assignments were not aware of other flow runs, resulting in assigning more licenses than actually available.

Assigning 16 licenses when only 5 are available is not acceptable. By setting the runs with 10 flows in parallel, I found an acceptable performance level, and the number of over assignments was reduced. This is still a possibility, but after running the flow for all users, you must check for this type of situation and take action to be compliant with your licenses.
In my latest test, the assignment of licenses to 120 users (10 concurrent in parallel) took 3 minutes. This is in a test environment where not all required licenses were available.
The current approach of the flow is using security role metadata, including license requirements, which are copied into an Excel file manually. This is because not all the information for license calculation is available via either an API or a data entity. Per user, it checks which roles are assigned and rolls up the license requirement.
I also considered using the information with the license indication from the User role licenses tab page, but that requires the license reports to be refreshed first.
Available flows
The Dynamics 365 License Automation solution consists of Power Automate flows. The next flows are part of the first public release of the solution that is available as a download (version 0.9.0.6).
- Dynamics 365 F&O License Automation – base
The flow contains all logic to check for available and missing licenses. It can run stand-alone per user or as a child flow. It checks the assigned security roles and sums up the required licenses for a user. - Dynamics 365 F&O License Automation – all users
A flow that loops all users and runs the base flow as a child flow. It will be started manually (instant cloud flow). The result will be sent in an email to the person running the flow. - Dynamics 365 F&O License Automation – role assignment change
This is an automated flow. Whenever a role is added to a user, the flow is triggered and calls the base flow as a child.
Flow steps
The flow Dynamics 365 F&O License Automation – base contains all logic for checking required and available licenses, and assigning them if available.
It is reading the security role requirements and has a mapping between a Dynamics 365 SKU and the Microsoft Graph license API.
The first steps are to check if the user can be found in Dynamics 365, is active, has security roles assigned, and if there are any excluded roles. E.g., there is no license requirement for system administrators or integration accounts. It also checks if the user can be found in Entra ID and if a UsageLocation is set on the user.
When it passed, these validations, the flow will obtain a security token to interact with Microsoft Graph. It will read all available licenses in your tenant and already assigned licenses for the user. Then, based on the security role assignments, it will check for required full product licenses or if there are only additional licenses required, such as a Team members SKU. If available, it will then assign a license, and when needed, also attach licenses. In case the user has a requirement for a base license for Commerce, Finance, or Supply Chain management, this will be the priority above Human Resources or Project Operations. In case, e.g., Human Resources is assigned as a base license or available, and a Finance SKU is required, it will only add the user to a log, and manual interaction is required first to remove the Human Resources license. A future version might check for incorrectly assigned licenses and remove them.
Demo video
I created a demonstration video, showing the Power Automate flows in action after deploying the solution package, configuring the required Azure resources, an Excel workbook, and some settings in the flows. You can watch the video embedded in this blog or on YouTube.
Additional resources
The links below give access to more documentation and the download of the solution.
Dynamics 365 F&O License Automation overview
This article provides an overview on the Dynamics 365 F&O License Automation solution.
Dynamics 365 F&O License Automation installation and configuration
This article explains how to install and configure the Dynamics 365 F&O License Automation solution.
Dynamics 365 F&O License Automation download
This page has the asset to download the solution with related files.
I do hope you liked this post and will add value for you in your daily work as a professional. If you have related questions or feedback, don’t hesitate to use the Comment feature below.
That’s all for now. Till next time!



Original image from Jan Alexander on Pixabay

Image by Dave Tavres from Pixabay

Hi Andre! What happens if you don’t have any available license for assignment?
Hi Marijan,
In case there is no license available to assign, it will add it to a log that licenses are not available. If you are using the flow for all users, the log is added to a summary email where you can review missing licenses and more.
Hi André,
I congratulate you on the great work you’ve done with this project.
I wanted to let you know that when I import the solution, I get an “An expected error occurred” error, and when I download the log, I see the following: “Failed to sync entity metadata for entity ‘SystemSecurityUserRoleAssociationEntity’. Exception details: CreateRequest failed with error: String or binary data would be truncated in table ‘{0}’, column ‘{1}’. Truncated value: {2}.”
Do you have any idea what this could be?
Thank you very much.
Hi David,
Thanks for your comment. The solution works with a few virtual entities. So far, in my experience, the required data entities were enabled by default in Dataverse. It might be the case that the virtual entity is not enabled. What environment type are you using? Is this environment linked to a Power Platform environment? Is the virtual entities connector for Finance and Operations working in this environment? I have one environment myself where the virtual entity connector is corrupted.
Can you check in your Power Platform environment if the virtual entity Security user role association is enabled and returns data?
Hello,
The environment I’m using is the production environment, as that’s where I have all the permissions configured (I currently have a different database in the sandbox).
Yes, PowerPlatform is enabled in this environment, as is the connector, since I already work with other virtual entities from Automate.
I’ve checked the table you mentioned and I can access it, but it’s empty.
Thank you, regards.
Hi David,
This entity should have data in case you have security roles assigned to users. Can you try to refresh the entity in Dataverse? See: Enable Microsoft Dataverse virtual entities
Hello André,
I’ve tried updating it, but I’m getting a similar error:
String or binary data would be truncated in table ‘{0}’, column ‘{1}’. Truncated value: {2}
From what I understand, I’ll have to fix this before I can continue.
I’ll see what I can do.
Thanks for your time.
Sorry André,
If the entity is mserp_systemsecurityuserroleassociationentity, then just I see the data.
I think I was incorrectly testing with the msdyn_personasecurityrolemapping table.
Hi David,
Are you now able to run the flows, or are you still stuck on the step to import the solution?