Forum Discussion
PatrickF11
Jul 11, 2019Steel Contributor
dynamic group based on assigned license
Hi, is it possible to create a group with users based on a assigned license? So i want to include all users into this specific group who has e.g. an E3 license assigned, but not an E5. It se...
Steven-H
Apr 03, 2020Brass Contributor
You can do this using the following advanced rule
(user.assignedPlans -any (assignedPlan.servicePlanId -eq "<servicePlanId>" -and assignedPlan.capabilityStatus -eq "Enabled"))
You can lookup service plan ids by using the Graph Explorer and looking at licenseDetails on a user that has the desired license assigned.
https://graph.microsoft.com/v1.0/users/someperson@yourdomain.tld/licenseDetails
Look in the resulting output for the specific thing to key off.
Links
- PatrickF11Apr 08, 2020Steel Contributor
Hi Steven-H
Thanks for your reply, this is nearly the same of what i'm using at the moment.
(Except that u use the id and not the name.)
Edit: I didn't think about the approach via the graph, thank you 🙂
- shathawayNov 17, 2021Copper Contributor
I was wondering if you have found a solution to creating a dynamic group based on license. I am looking to the do the same.
Thank you,
Steve
- D6BoostDec 02, 2021Copper Contributor
This expression appears to be working for me
(user.assignedPlans -all (assignedPlan.service -ne "Unassigned" -and assignedPlan.capabilityStatus -eq "Enabled"))
To use the expression builder :
Set the Property to: assignedPlans
Set the Operator to: all
Set the Value to: (assignedPlan.service -ne "Unassigned" -and assignedPlan.capabilityStatus -eq "Enabled")