How to Create Azure AD Dynamic Groups for Managing Devices using Intune

How to Create Azure AD Dynamic Groups for Managing Devices using Intune? In this post, we will see how to create Dynamic device groups and User Groups in Azure Active Directory. Azure AD groups are similar to collections (in the SCCM world) for Intune device management solutions.

These AAD groups can be intern used to target different policies to a specific group of devices. Latest postValidate Azure AD Dynamic Group Rules | Intune.

So this is very important in the world of modern management of devices using Microsoft Intune. If you are an SCCM admin, the AAD dynamic group is similar to creating a dynamic collection using WQL query rules. AAD groups don’t have that granularity in creating dynamic query rules if you compare it with WQL query rules.

Patch My PC

However, the new Azure portal has loads of options to create dynamic query rules. The video tutorial will help you get more inside of AAD Dynamic groups.

Create Azure AD Dynamic Groups

AAD Dynamic membership advanced rules are based on binary expressions. One Azure AD dynamic query can have more than one binary expression. Each binary expression in the AAD dynamic membership rule query must have 3 parts Left parameter, Binary operator, and Right constant.

A left parameter in the query rule is one of the attributes of the AAD object (either user or device). In case, you want to query users in a particular department then the user is the object and the department is the attribute (user.department).

1E Nomad

A binary operator is nothing other than a conditional operator like “-ne,-eq, -contains -match”. The right constant is a constant value specific to your requirement for example if you want to create a group for all IT users, then the right constant value is “IT”.

(user.department -startsWith "IT")
(user.department -match "IT")
(user.department -eq "IT")

Maximum supported words/characters

I did a test to understand what is the maximum supported words/characters in Azure AD dynamic advanced membership rule and I found that we could save a query with a maximum of 311 words and 3045 characters.

When I increased the numbers to 315 words and 3085 characters, it started giving an error “Failed to create Group_Maxi. Undefined” where MAXI is the group name.

How to Create Azure AD Dynamic Groups for Managing Devices using Intune
How to Create Azure AD Dynamic Groups for Managing Devices using Intune

Now back to Intune and device management. I will create 3 basic groups for device management and these AAD dynamic device groups (All Windows Devices, All iOS Device and All Android Devices) will be used to deploy different configuration policies.

Dynamic Query

First I wanted to group for all windows devices in my Intune environment.  There are two ways to create AAD group with dynamic membership query rules 1. Simple rule and 2. Advanced Rule. To group windows devices based on operating system it’s better to use simple query via Azure portal GUI.

In case you want to use advance membership, then the following is the query “(device.deviceOSType -contains “Windows”)”. When you create an Azure AD dynamic device group, it’s going to take time 1 or 2 minutes (depending upon the complexity of the query and the size of the database) to populate the devices into the group.

How to Create Azure AD Dynamic Groups for Managing Devices using Intune
How to Create Azure AD Dynamic Groups for Managing Devices using Intune

It’s time to find out iOS devices (iPhone or iPad) in my environment via AAD Dynamic query and group those devices into a AAD dynamic group. Unlike Windows device group, iOS device AAD dynamic Device group can’t be created using simple membership rule rather we should use Advanced membership rule.

This is because we need to have two constant values like iPhone and iPad.  Following is the query which I used to fetch iOS devices (device.deviceOSType -contains “iPhone”) -or (device.deviceOSType -contains “iPad”).

How to Create Azure AD Dynamic Groups for Managing Devices using Intune
How to Create Azure AD Dynamic Groups for Managing Devices using Intune

OK, here we go with grouping of Android devices. In this scenario, I want to create AAD dynamic device group using simple membership rule. Because I don’t have more than one constant value in AAD group binary expression. Following is the dynamic query for Android device group “(device.deviceOSType -contains “Android”)”.

How to Create Azure AD Dynamic Groups for Managing Devices using Intune
How to Create Azure AD Dynamic Groups for Managing Devices using Intune

Reference

TechNet document about Azure AD dynamic group here

New Azure portal – This will directly take you to all Groups blade https://portal.azure.com/#blade/Microsoft_AAD_IAM/UserManagementMenuBlade/All%20groups/menuId/