SOLVED
Home

Filtering users based on licenses for dynamic grouping

%3CLINGO-SUB%20id%3D%22lingo-sub-289207%22%20slang%3D%22en-US%22%3EFiltering%20users%20based%20on%20licenses%20for%20dynamic%20grouping%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-289207%22%20slang%3D%22en-US%22%3E%3CP%3EHi%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20am%20trying%20to%20make%20a%20dynamic%20users%20query%20for%20a%20dynamic%20group%20in%20AAD.%20What%20I%20essentially%20want%20is%20to%20add%20every%20member%20that%20does%20not%20have%20a%20E3%20license%20to%20the%20group%20for%20automatic%20licensing.%20I%20have%20figured%20out%20that%20the%20assignedLicense%20aren't%20supported%20and%20I%20have%20tried%20to%20do%20a%20call%20for%20Exchange%20Online%20Plan%202.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EMy%20current%20query%3A%3C%2FP%3E%3CP%3E%3CSPAN%3Euser.assignedPlans%20-all%20(assignedPlan.servicePlanId%20-eq%20%22efb87545-963c-4e0d-99df-69c6916d9eb0%22%20-and%20assignedPlan.capabilityStatus%20-eq%20%22Disabled%22)%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3EThis%20should%20look%20for%20everyone%20with%20Exchange%20Online%20Plan%202%20disabled%20and%20add%20them%20to%20the%20group.%20That%20has%20worked%20so%20far.%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3EThe%20problem%20I%20got%20now%20is%20when%20I%20am%20automatically%20assigning%20E1%20licenses%20to%20everyone%20in%20the%20group%20they%20will%20be%20removed%20from%20the%20group%20and%20the%20license%20will%20be%20removed%20from%20the%20user.%20I%20am%20also%20experiencing%20that%20I%20can't%20add%20them%20back%20into%20the%20group%20with%20the%20query.%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3EAnyone%20that%20can%20help%20me%20out%20here%3F%20Is%20what%20I%20am%20trying%20to%20do%20even%20possible%3F%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3EThanks%20in%20advance%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-289207%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EAzure%20AD%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EIdentity%20Management%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-289276%22%20slang%3D%22en-US%22%3ERE%3A%20Filtering%20users%20based%20on%20licenses%20for%20dynamic%20grouping%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-289276%22%20slang%3D%22en-US%22%3E%3CP%3EIt%20looks%20like%20I%20have%20made%20an%20error%20in%20my%20query%20and%20edited%20it.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIt%20works%20good%20now%20with%20the%20following%20queries%3A%3C%2FP%3E%3CP%3E%3CSTRONG%3Euser.assignedPlans%20-all%20(assignedPlan.servicePlanId%20-ne%20%22efb87545-963c-4e0d-99df-69c6916d9eb0%22)%3C%2FSTRONG%3E%20----%20This%20checks%20if%20a%20user%20is%20on%20Exchange%20Online%20Plan%202%2C%20if%20not%20it%20will%20be%20added%20to%20the%20group.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EYou%20can%20also%20use%20this%20to%20filter%20out%20E1%20licenses%3A%3C%2FP%3E%3CP%3E%3CSTRONG%3Euser.assignedPlans%20-all%20(assignedPlan.servicePlanId%20-ne%20%229aaf7827-d63c-4b61-89c3-182f06f82e5c%22)%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIt%20doesn't%20look%20to%20be%20possible%20to%20separate%20E3%20and%20E5%20at%20this%20moment%2C%20unless%20you%20find%20a%20serviceID%20for%20a%20service%20that%20doesn't%20come%20with%20both%20subscriptions.%20So%20all%20in%20all%20it%20is%20a%20semi%20workaround%20for%20filtering%20on%20licenses.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EWhen%20it%20comes%20to%20the%20problem%20I%20had%20concerning%20users%20being%20removed%20it%20sorted%20it%20out%20with%20the%20new%20query.%20It%20looked%20to%20be%20the%20query%20that%20checked%20if%20it%20was%20enabled%20or%20disabled%20that%20made%20them%20be%20removed%20and%20impossible%20to%20be%20added%20(this%20I%20have%20no%20idea%20how%20happened).%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks.%3C%2FP%3E%3C%2FLINGO-BODY%3E
Highlighted
Christopher_A
New Contributor

Hi,

 

I am trying to make a dynamic users query for a dynamic group in AAD. What I essentially want is to add every member that does not have a E3 license to the group for automatic licensing. I have figured out that the assignedLicense aren't supported and I have tried to do a call for Exchange Online Plan 2.

 

My current query:

user.assignedPlans -all (assignedPlan.servicePlanId -eq "efb87545-963c-4e0d-99df-69c6916d9eb0" -and assignedPlan.capabilityStatus -eq "Disabled")

 

This should look for everyone with Exchange Online Plan 2 disabled and add them to the group. That has worked so far. 

 

The problem I got now is when I am automatically assigning E1 licenses to everyone in the group they will be removed from the group and the license will be removed from the user. I am also experiencing that I can't add them back into the group with the query.

 

Anyone that can help me out here? Is what I am trying to do even possible?

 

Thanks in advance

1 Reply
Solution

It looks like I have made an error in my query and edited it.

 

It works good now with the following queries:

user.assignedPlans -all (assignedPlan.servicePlanId -ne "efb87545-963c-4e0d-99df-69c6916d9eb0") ---- This checks if a user is on Exchange Online Plan 2, if not it will be added to the group.

 

You can also use this to filter out E1 licenses:

user.assignedPlans -all (assignedPlan.servicePlanId -ne "9aaf7827-d63c-4b61-89c3-182f06f82e5c")

 

It doesn't look to be possible to separate E3 and E5 at this moment, unless you find a serviceID for a service that doesn't come with both subscriptions. So all in all it is a semi workaround for filtering on licenses.

 

When it comes to the problem I had concerning users being removed it sorted it out with the new query. It looked to be the query that checked if it was enabled or disabled that made them be removed and impossible to be added (this I have no idea how happened).

 

Thanks.

Related Conversations
Tabs and Dark Mode
cjc2112 in Discussions on
46 Replies
Extentions Synchronization
Deleted in Discussions on
3 Replies
Stable version of Edge insider browser
HotCakeX in Discussions on
35 Replies
flashing a white screen while open new tab
Deleted in Discussions on
14 Replies
How to Prevent Teams from Auto-Launch
chenrylee in Microsoft Teams on
29 Replies
Security Community Webinars
Valon_Kolica in Security, Privacy & Compliance on
13 Replies