@Aleks Thanks for reaching out to Microsoft Q&A, apologize for any inconvenience caused on this.
Below are the SKU Id's for Azure Premium P1 and Aure Premium P2
Microsoft Entra ID P1 ~= AAD_PREMIUM_P1 -->41781fb2-bc02-4b7c-bd55-b576c07bb09d
Microsoft Entra ID P2 ~= AAD_PREMIUM_P2 -->eec0eb4f-6444-4f95-aba0-50c24d67f998
Refer to this documentation to know more information about different SKU ID's and their Product Names.
Instead of pulling the user list who are assigned with licenses Azure Premium P1 and Azure Premium P2 using Microsoft Graph. The easiest way to achieve this is by creating a Group and using the below expression in dynamic membership rule.
(user.assignedPlans -any (assignedPlan.servicePlanId -eq "41781fb2-bc02-4b7c-bd55-b576c07bb09d" -and assignedPlan.capabilityStatus -eq "Enabled")) -and (user.assignedPlans -any (assignedPlan.servicePlanId -eq "eec0eb4f-6444-4f95-aba0-50c24d67f998" -and assignedPlan.capabilityStatus -eq "Enabled"))
Note: In the above expression we are using -and
which is to pull the user list who has both licenses If you want to pull the user list who has any of the license then you need to use or
.
Refer to this documentation to know more about Dynamic group syntax.
Feel free to reach back to me if you have any further questions on this.