{"id":2817,"date":"2019-01-20T20:02:58","date_gmt":"2019-01-20T18:02:58","guid":{"rendered":"http:\/\/blog.hosebei.ch\/?p=2817"},"modified":"2019-01-20T20:02:58","modified_gmt":"2019-01-20T18:02:58","slug":"azure-ad-create-dynamic-group-containing-all-windows-10-azure-ad-joined-devices-managed-by-intune","status":"publish","type":"post","link":"https:\/\/blog.hosebei.ch\/?p=2817","title":{"rendered":"Azure AD &#8211; Create dynamic group containing all Windows 10 Azure AD joined devices managed by Intune"},"content":{"rendered":"<p>Title says it all, and at first sight, simply to achieve, right?<br \/>\nLet me tell you: In my opinion, it is not quite as easy as it should be.<\/p>\n<p>Lets start by creating a new group within Azure AD, to do this, navigate to your Azure AD and open the Groups blade, where you can start the process by a click on &#8220;New Group&#8221;:<br \/>\n<a href=\"http:\/\/blog.hosebei.ch\/wp-content\/uploads\/2019\/01\/azuread_dynamicgroup01.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/blog.hosebei.ch\/wp-content\/uploads\/2019\/01\/azuread_dynamicgroup01.jpg?w=300\" alt=\"\" width=\"300\" height=\"103\" class=\"aligncenter size-medium wp-image-2818\" srcset=\"https:\/\/blog.hosebei.ch\/wp-content\/uploads\/2019\/01\/azuread_dynamicgroup01.jpg 893w, https:\/\/blog.hosebei.ch\/wp-content\/uploads\/2019\/01\/azuread_dynamicgroup01-300x103.jpg 300w, https:\/\/blog.hosebei.ch\/wp-content\/uploads\/2019\/01\/azuread_dynamicgroup01-768x265.jpg 768w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><br \/>\n<!--more--><\/p>\n<p>Within the opened group creation wizard, select Security as group type, give a proper name and select &#8220;Dynamic Device&#8221; as membership type for the group:<br \/>\n<a href=\"http:\/\/blog.hosebei.ch\/wp-content\/uploads\/2019\/01\/azuread_dynamicgroup02.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/blog.hosebei.ch\/wp-content\/uploads\/2019\/01\/azuread_dynamicgroup02.png?w=259\" alt=\"\" width=\"259\" height=\"300\" class=\"aligncenter size-medium wp-image-2819\" srcset=\"https:\/\/blog.hosebei.ch\/wp-content\/uploads\/2019\/01\/azuread_dynamicgroup02.png 472w, https:\/\/blog.hosebei.ch\/wp-content\/uploads\/2019\/01\/azuread_dynamicgroup02-259x300.png 259w\" sizes=\"auto, (max-width: 259px) 100vw, 259px\" \/><\/a><br \/>\nNow click on &#8220;Add dynamic Query&#8221; at the bottom of the creation wizard to open the query rule:<br \/>\n<a href=\"http:\/\/blog.hosebei.ch\/wp-content\/uploads\/2019\/01\/azuread_dynamicgroup03.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/blog.hosebei.ch\/wp-content\/uploads\/2019\/01\/azuread_dynamicgroup03.png?w=300\" alt=\"\" width=\"300\" height=\"161\" class=\"aligncenter size-medium wp-image-2821\" srcset=\"https:\/\/blog.hosebei.ch\/wp-content\/uploads\/2019\/01\/azuread_dynamicgroup03.png 881w, https:\/\/blog.hosebei.ch\/wp-content\/uploads\/2019\/01\/azuread_dynamicgroup03-300x161.png 300w, https:\/\/blog.hosebei.ch\/wp-content\/uploads\/2019\/01\/azuread_dynamicgroup03-768x413.png 768w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><br \/>\nYou can open the Dropbox at &#8220;Add devices where&#8221; to see all available &#8220;Attributes&#8221; of the device which can be used for the query:<br \/>\n<a href=\"http:\/\/blog.hosebei.ch\/wp-content\/uploads\/2019\/01\/azuread_dynamicgroup04.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/blog.hosebei.ch\/wp-content\/uploads\/2019\/01\/azuread_dynamicgroup04.png?w=300\" alt=\"\" width=\"300\" height=\"230\" class=\"aligncenter size-medium wp-image-2822\" srcset=\"https:\/\/blog.hosebei.ch\/wp-content\/uploads\/2019\/01\/azuread_dynamicgroup04.png 804w, https:\/\/blog.hosebei.ch\/wp-content\/uploads\/2019\/01\/azuread_dynamicgroup04-300x230.png 300w, https:\/\/blog.hosebei.ch\/wp-content\/uploads\/2019\/01\/azuread_dynamicgroup04-768x589.png 768w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><br \/>\nWe may be able to guess what these attributes contains, but which operators can used and so on is unclear. The following article of Microsoft tries to help how to use the device attributes:<br \/>\n<a href=\"https:\/\/docs.microsoft.com\/en-us\/azure\/active-directory\/users-groups-roles\/groups-dynamic-membership#rules-for-devices\" rel=\"noopener\" target=\"_blank\">Dynamic membership rules for groups in Azure Active Directory<\/a><\/p>\n<p>But it is still unclear, from where those attributes are coming. If I&#8217;m using Get-MSOLDevice or Get-AzureADDevice to check if the attributes are comparable, I have to consider that not even the attribute names corresponds to each other:<br \/>\n<a href=\"http:\/\/blog.hosebei.ch\/wp-content\/uploads\/2019\/01\/azuread_dynamicgroup06.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/blog.hosebei.ch\/wp-content\/uploads\/2019\/01\/azuread_dynamicgroup06.png?w=300\" alt=\"\" width=\"300\" height=\"219\" class=\"aligncenter size-medium wp-image-2825\" srcset=\"https:\/\/blog.hosebei.ch\/wp-content\/uploads\/2019\/01\/azuread_dynamicgroup06.png 953w, https:\/\/blog.hosebei.ch\/wp-content\/uploads\/2019\/01\/azuread_dynamicgroup06-300x219.png 300w, https:\/\/blog.hosebei.ch\/wp-content\/uploads\/2019\/01\/azuread_dynamicgroup06-768x561.png 768w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><br \/>\nSo unfortunately I was required to check which query will bring the result I was looking for: An Azure AD Device group with dynamic membership for Windows 10 Clients filtered on Azure AD joined and Intune managed. My solution is this &#8220;Advanced rule&#8221;:<br \/>\n<code>(device.deviceOSVersion -startsWith \"10.0\") -and (device.DeviceOSType -startsWith \"Windows\") -and (device.managementType -eq \"MDM\")<\/code><br \/>\nNow add this rule to the editor, and a click on &#8220;Add Query&#8221; will add the rule to the group:<br \/>\n<a href=\"http:\/\/blog.hosebei.ch\/wp-content\/uploads\/2019\/01\/azuread_dynamicgroup07-1.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/blog.hosebei.ch\/wp-content\/uploads\/2019\/01\/azuread_dynamicgroup07-1.png?w=228\" alt=\"\" width=\"228\" height=\"300\" class=\"aligncenter size-medium wp-image-2828\" srcset=\"https:\/\/blog.hosebei.ch\/wp-content\/uploads\/2019\/01\/azuread_dynamicgroup07-1.png 875w, https:\/\/blog.hosebei.ch\/wp-content\/uploads\/2019\/01\/azuread_dynamicgroup07-1-228x300.png 228w, https:\/\/blog.hosebei.ch\/wp-content\/uploads\/2019\/01\/azuread_dynamicgroup07-1-778x1024.png 778w, https:\/\/blog.hosebei.ch\/wp-content\/uploads\/2019\/01\/azuread_dynamicgroup07-1-768x1010.png 768w\" sizes=\"auto, (max-width: 228px) 100vw, 228px\" \/><\/a><br \/>\nAfter a click on &#8220;Create&#8221;, the group gets created, and a membership evaluation will start immediately. This will take some minutes, and afterwards you should be able to check, that the correct members are added to this group:<br \/>\n<a href=\"http:\/\/blog.hosebei.ch\/wp-content\/uploads\/2019\/01\/azuread_dynamicgroup08.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/blog.hosebei.ch\/wp-content\/uploads\/2019\/01\/azuread_dynamicgroup08.png?w=300\" alt=\"\" width=\"300\" height=\"176\" class=\"aligncenter size-medium wp-image-2831\" srcset=\"https:\/\/blog.hosebei.ch\/wp-content\/uploads\/2019\/01\/azuread_dynamicgroup08.png 1330w, https:\/\/blog.hosebei.ch\/wp-content\/uploads\/2019\/01\/azuread_dynamicgroup08-300x176.png 300w, https:\/\/blog.hosebei.ch\/wp-content\/uploads\/2019\/01\/azuread_dynamicgroup08-1024x600.png 1024w, https:\/\/blog.hosebei.ch\/wp-content\/uploads\/2019\/01\/azuread_dynamicgroup08-768x450.png 768w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><br \/>\nI really hope that Microsoft improves it&#8217;s documentation about the device attributes, or make it better to find the more detailed docs, if they already exists. And I&#8217;m aware of the option create an own solution with a PowerShell script executed locally or in Azure. But the dynamic membership feature is part of Azure AD Premium P1, and many customer will probably use it.<\/p>\n<p>Hope this helps someone to find quickly the required query.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Title says it all, and at first sight, simply to achieve, right? Let me tell you: In my opinion, it is not quite as easy as it should be. Lets start by creating a new group within Azure AD, to do this, navigate to your Azure AD and open the Groups blade, where you can [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7],"tags":[],"class_list":["post-2817","post","type-post","status-publish","format-standard","hentry","category-azure-ad"],"_links":{"self":[{"href":"https:\/\/blog.hosebei.ch\/index.php?rest_route=\/wp\/v2\/posts\/2817","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.hosebei.ch\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.hosebei.ch\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.hosebei.ch\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.hosebei.ch\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2817"}],"version-history":[{"count":0,"href":"https:\/\/blog.hosebei.ch\/index.php?rest_route=\/wp\/v2\/posts\/2817\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.hosebei.ch\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2817"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.hosebei.ch\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2817"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.hosebei.ch\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2817"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}