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...
PatrickF11
Jul 29, 2022Steel Contributor
Thank you Josh, at this moment i already know how to deal with that. 🙂
The linked article from Thijs Lecomte is really great, although I had to taught this by myself.
The linked article from Thijs Lecomte is really great, although I had to taught this by myself.
Nick_Zhitkov
Nov 29, 2022Copper Contributor
This works perfectly for the dynamic group:
user.assignedPlans -any (assignedPlan.service -eq "TeamspaceAPI" -and assignedPlan.capabilityStatus -eq "Enabled")
To get Service names you can run PowerShell:
Get-AzureADUser -SearchString "UserName" | Select -ExpandProperty AssignedPlans
The whole idea is that you can combine results by the part of the name using "contains" (to get all users licensed for AAD for. instance). I use it to get all users with any Teams License for any E or F licenses.
For the license separation you can use name that only exisit for the E3/E5 plan but you can do the same with Service Plan IDs.
I hope it helped.
- PatrickF11Nov 29, 2022Steel Contributor
Because of the long time passed by, i've updated my personal documentation in the meantime, too.
Just in case someone stumbles upon this topic:
I personally prefer using the ServicePlan ID:
- Get ServicePlan ID via Powershell
- Get-AzureADUserLicenseDetail -ObjectId $user.objectid | Select-Object -ExpandProperty ServicePlans
- Get ServicePlan ID via Graph Explorer (https://developer.microsoft.com/en-us/graph/graph-explorer)
- Dynamic Rule Query
- user.assignedPlans -any (assignedPlan.servicePlanId -eq "xxx-xxx-xxx-xxx-xxx" -and assignedPlan.capabilityStatus -eq "Enabled")
- Entra_lover5Mar 12, 2024Copper Contributor
Patrick, I am trying to understand what the problem was with your original solution? I am trying to do the same thing right now and was going to use your original solution, but am not following why you werent happy with it.
Thanks
- PatrickF11Mar 12, 2024Steel Contributor
Entra_lover5 The ServicePlanName isn’t „that unique“, as the SKU is. The approach that worked best for me is the one in my latest reply. (before this one)
- Get ServicePlan ID via Powershell