{"id":2581,"date":"2017-08-18T13:56:52","date_gmt":"2017-08-18T12:56:52","guid":{"rendered":"https:\/\/www.lieben.nu\/liebensraum\/?p=2581"},"modified":"2017-08-18T13:56:52","modified_gmt":"2017-08-18T12:56:52","slug":"creating-a-dynamic-group-using-the-graph-api","status":"publish","type":"post","link":"https:\/\/lieben.nu\/liebensraum\/2017\/08\/creating-a-dynamic-group-using-the-graph-api\/","title":{"rendered":"Creating a Dynamic Group using the Graph API"},"content":{"rendered":"<p>Azure has a very nice feature called &#8216;<a href=\"https:\/\/docs.microsoft.com\/en-us\/azure\/active-directory\/active-directory-accessmanagement-groups-with-advanced-rules\" target=\"_blank\" rel=\"noopener\">Dynamic Groups<\/a>&#8216;. We use these in our customer tenants to dynamically generate a group with actual users, excluding Guest accounts (marked with #EXT#).<\/p>\n<p>As I couldn&#8217;t find any articles detailing how to create a Dynamic Group through the Graph API, I&#8217;m posting this for whoever it helps \ud83d\ude42<\/p>\n<pre class=\"brush: powershell; title: ; notranslate\" title=\"\">\n$dynamicGroupProperties = @{\n    &quot;description&quot; = &quot;Dynamic Group Created through the Graph API&quot;;\n    &quot;displayName&quot; = &quot;Dynamic Group Created through the Graph API&quot;;\n    &quot;groupTypes&quot; = @(&quot;DynamicMembership&quot;);\n    &quot;mailEnabled&quot; = $False;\n    &quot;mailNickname&quot; = &quot;testnickname&quot;;\n    &quot;membershipRule&quot; = &quot;(user.userPrincipalName -notContains `&quot;#EXT#@`&quot;) -and (user.userType -ne `&quot;Guest`&quot;)&quot;;\n    &quot;membershipRuleProcessingState&quot; = &quot;On&quot;;\n    &quot;securityEnabled&quot; = $True\n}\n\ninvoke-webrequest -Headers $headerParams -uri &quot;https:\/\/graph.microsoft.com\/beta\/groups&quot; -Body (ConvertTo-Json $dynamicGroupProperties) -method POST -Verbose\n<\/pre>\n<p>If you&#8217;re not yet used to working with the Graph API, read up on <a href=\"https:\/\/docs.microsoft.com\/en-us\/intune\/intune-graph-apis\" target=\"_blank\" rel=\"noopener\">how to connect to the Graph API using Powershell<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Azure has a very nice feature called &#8216;Dynamic Groups&#8216;. We use these in our customer tenants to dynamically generate a group with actual users, excluding Guest accounts (marked with #EXT#). As I couldn&#8217;t find any articles detailing how to create a Dynamic Group through the Graph API, I&#8217;m posting this for whoever it helps \ud83d\ude42 &hellip; <a href=\"https:\/\/lieben.nu\/liebensraum\/2017\/08\/creating-a-dynamic-group-using-the-graph-api\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Creating a Dynamic Group using the Graph API<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_crdt_document":"","footnotes":""},"categories":[5,39],"tags":[],"class_list":["post-2581","post","type-post","status-publish","format-standard","hentry","category-azure","category-powershell"],"_links":{"self":[{"href":"https:\/\/lieben.nu\/liebensraum\/wp-json\/wp\/v2\/posts\/2581","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lieben.nu\/liebensraum\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lieben.nu\/liebensraum\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lieben.nu\/liebensraum\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lieben.nu\/liebensraum\/wp-json\/wp\/v2\/comments?post=2581"}],"version-history":[{"count":0,"href":"https:\/\/lieben.nu\/liebensraum\/wp-json\/wp\/v2\/posts\/2581\/revisions"}],"wp:attachment":[{"href":"https:\/\/lieben.nu\/liebensraum\/wp-json\/wp\/v2\/media?parent=2581"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lieben.nu\/liebensraum\/wp-json\/wp\/v2\/categories?post=2581"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lieben.nu\/liebensraum\/wp-json\/wp\/v2\/tags?post=2581"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}