{"id":327,"date":"2022-07-16T15:33:56","date_gmt":"2022-07-16T03:33:56","guid":{"rendered":"https:\/\/www.howdoiuseacomputer.com\/?p=327"},"modified":"2022-08-13T19:42:44","modified_gmt":"2022-08-13T07:42:44","slug":"gal-separation-with-address-book-policies","status":"publish","type":"post","link":"https:\/\/www.howdoiuseacomputer.com\/index.php\/2022\/07\/16\/gal-separation-with-address-book-policies\/","title":{"rendered":"GAL separation with Address Book Policies"},"content":{"rendered":"\n<p>Just a quick one on ABPs &#8211; there are many posts about this topic now, but there are few that mention how to resolve issues such as recipients not appearing in the list when they should be.  In this case you need to &#8216;tickle&#8217; (yes that&#8217;s the official Microsoft term) the objects to get them to play ball.<\/p>\n\n\n\n<p>ABPs seemed complex when I first looked at them, and my first introduction was with a tenant that had 20,000 user objects!  We don&#8217;t get many opportunities to work with environments of this size in New Zealand, so it was a great job to get involved with.  #dontmessitupmaaate!<\/p>\n\n\n\n<p>ABPs are most commonly used in large environments though, or where separation is needed.  Examples of this are:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Multiple schools under one tenant &#8211; you don&#8217;t want students from one school seeing students from other schools in the Global Address List.<\/li><li>Multiple companies under one tenant.  You don&#8217;t want Fabrikam users seeing Contoso users.<\/li><li>In both of these scenarios, you may want management or executive level staff to see all recipients in their GAL. <\/li><\/ul>\n\n\n\n<p>Here is the code to create each ABP&#8230; I&#8217;m using my fictional company SB Enterprises which exists in a large multi-company tenant.  Customattribute1 is used across the tenant to identify the objects related to a particular company with a three-letter-acronym. (this could be the Company attribute, or any other attribute as long as we can use it for filtering in the commands).  For Meeting Room, Equipment, or Contact objects, those are created with the company TLA at the front e.g. SBE_MeetingRoom1. <\/p>\n\n\n\n<p>Firstly let&#8217;s connect to Exchange Online powershell:<\/p>\n\n\n\n<pre class=\"wp-block-code has-small-font-size\"><code>Connect-ExchangeOnline -UserPrincipalName insertadminupnhere<\/code><\/pre>\n\n\n\n<p>Now let&#8217;s create some address lists to include in our policy:<\/p>\n\n\n\n<pre class=\"wp-block-code has-small-font-size\"><code># this one contains all our recipients (users, groups, and shared mailboxes)\nNew-AddressList -Name \"SBE_AddressList\" -RecipientFilter \"(CustomAttribute1 -eq 'SBE')\"\n\n# this one contains our groups\nNew-AddressList -Name \"SBE_Groups\" -RecipientFilter \"(ObjectClass -like 'group') -and (CustomAttribute1 -eq 'SBE')\"\n\n# this one contains our shared mailboxes\nNew-AddressList -Name \"SBE_Shared Mailboxes\" -RecipientFilter \"(RecipientTypeDetails -eq 'SharedMailbox') -and (CustomAttribute1 -eq 'SBE')\"\n\n# this one contains our rooms\nNew-AddressList -Name \"SBE_Rooms\" -RecipientFilter \"(RecipientTypeDetails -eq 'RoomMailbox') -and (Name -like 'SBE_*')\"\n\n# this one contains our contacts\nNew-AddressList -Name \"SBE_Contacts\" -RecipientFilter \"(RecipientType -eq 'MailContact') -and (Name -like 'SBE_*')\"\n<\/code><\/pre>\n\n\n\n<p>Sweet as lemon pie!  Now let&#8217;s get a list of all the objects that should be included in each list: <\/p>\n\n\n\n<pre class=\"wp-block-code has-small-font-size\"><code>\n$filter = (Get-AddressList \"SBE_AddressList\").recipientfilter\nGet-Recipient -ResultSize unlimited -RecipientPreviewFilter $filter | Out-GridView\n\n$filter = (Get-AddressList \"SBE_Groups\").recipientfilter\nGet-Recipient -ResultSize unlimited -RecipientPreviewFilter $filter | Out-GridView\n\n$filter = (Get-AddressList \"SBE_Shared Mailboxes\").recipientfilter\nGet-Recipient -ResultSize unlimited -RecipientPreviewFilter $filter | Out-GridView\n\n$filter = (Get-AddressList \"SBE_Rooms\").recipientfilter\nGet-Recipient -ResultSize unlimited -RecipientPreviewFilter $filter | Out-GridView\n\n$filter = (Get-AddressList \"SBE_Contacts\").recipientfilter\nGet-Recipient -ResultSize unlimited -RecipientPreviewFilter $filter | Out-GridView<\/code><\/pre>\n\n\n\n<p>Looking good?  Now let&#8217;s create the Global Address List and the Offline Global Address List:<\/p>\n\n\n\n<pre class=\"wp-block-code has-small-font-size\"><code># the global address list has it's own filter for all SBE objects\nNew-GlobalAddressList -Name \"SBE_GlobalAddressList\" -RecipientFilter \"(CustomAttribute1 -eq 'SBE') -or (Name -like 'SBE_*')\"\n\n# the offline address list includes the address lists we created\nNew-OfflineAddressBook -Name \"SBE_OfflineAddressList\" -AddressLists \"SBE_AddressList\",\"SBE_Groups\",\"SBE_Shared Mailboxes\",\"SBE_Rooms\",\"SBE_Contacts\"\n<\/code><\/pre>\n\n\n\n<p>Great!  Now we can create the Address Book Policy using all of the above:<\/p>\n\n\n\n<pre class=\"wp-block-code has-small-font-size\"><code>New-AddressBookPolicy -Name \"SBE_ABP\" -AddressLists \"SBE_AddressList\",\"SBE_Groups\",\"SBE_Shared Mailboxes\",\"SBE_Contacts\" -OfflineAddressBook \"\\SBE_OfflineAddressList\" -GlobalAddressList \"\\SBE_GlobalAddressList\" -RoomList \"\\SBE_Rooms\"<\/code><\/pre>\n\n\n\n<p>Done!  Well almost &#8211; we have to assign it to the users&#8230; I recommend assigning to a pilot group first to get some feedback in case of any issues.  When ready, use this command to assign the ABP to all applicable users:<\/p>\n\n\n\n<pre class=\"wp-block-code has-small-font-size\"><code>$SBE_ABP = Get-Mailbox -ResultSize unlimited -Filter \"(RecipientTypeDetails -eq 'UserMailbox') -and (CustomAttribute1 -eq 'SBE')\"; $SBE_ABP | foreach {Set-Mailbox -Identity $_.Identity -AddressBookPolicy 'SBE_ABP'}<\/code><\/pre>\n\n\n\n<p>Now, there are several things that can make it seem like things are not working, but I can tell you 99% of the time you just have to wait.  It&#8217;s the old &#8216;cloud time phenomenon&#8217; where things may take from 1 to 48 hours to take effect &#x1f923;&#x1f923;&#x1f923;.<\/p>\n\n\n\n<p><strong>The most common issue I have come across <\/strong>is someone in the pilot group pointing out that someone or something is missing from the GAL.  This is due to the object not being processed when the Address List was created.  It should be a member of the filter; and it is upon object creation or update that membership of address list filters is determined. <\/p>\n\n\n\n<p>This is where &#8216;tickling&#8217; comes in.  You need to change something i.e. any attribute of the offending object, then change it back again.<\/p>\n\n\n\n<p>You can do this in the portal for a single object (e.g. change the last name one letter, save, then change it back again)&#8230; but seeing as I know this problem exists, I now do this as part of the initial setup so I don&#8217;t have to deal with it later.  <\/p>\n\n\n\n<p>Let&#8217;s run this to change an attribute &#8211; I&#8217;ve checked all objects Customattribute5 is blank, so I can use it for this purpose (you don&#8217;t have to use tickle obviously, any value will do):<\/p>\n\n\n\n<pre class=\"wp-block-code has-small-font-size\"><code>\n# get the users we want to 'tickle'\n$users = Get-User -ResultSize unlimited -Filter \"Customattribute1 -eq 'SBE'\"\n\n# tickle them by modifying a value (make sure the value was null for all objects beforehand)\nforeach ($user in $users) {\n\n    $id = $user.DistinguishedName\n    Set-Mailbox $id -CustomAttribute5 \"tickled\"\n}\n\n# then return the value to null\nforeach ($user in $users) {\n\n    $id = $user.DistinguishedName\n    Set-Mailbox $id -CustomAttribute5 $null\n}<\/code><\/pre>\n\n\n\n<p>And voila, the object now appears on the list (taking into account the &#8216;cloud time phenomenon&#8217; mentioned above).<\/p>\n\n\n\n<p>As always, thanks for coming dudes &amp; dudettes! &#x270c;&#x1f37b;&#x270c;<\/p>\n<div class=\"pvc_clear\"><\/div><p id=\"pvc_stats_327\" class=\"pvc_stats all  \" data-element-id=\"327\" style=\"\"><i class=\"pvc-stats-icon small\" aria-hidden=\"true\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" version=\"1.0\" viewBox=\"0 0 502 315\" preserveAspectRatio=\"xMidYMid meet\"><g transform=\"translate(0,332) scale(0.1,-0.1)\" fill=\"\" stroke=\"none\"><path d=\"M2394 3279 l-29 -30 -3 -207 c-2 -182 0 -211 15 -242 39 -76 157 -76 196 0 15 31 17 60 15 243 l-3 209 -33 29 c-26 23 -41 29 -80 29 -41 0 -53 -5 -78 -31z\"\/><path d=\"M3085 3251 c-45 -19 -58 -50 -96 -229 -47 -217 -49 -260 -13 -295 52 -53 146 -42 177 20 16 31 87 366 87 410 0 70 -86 122 -155 94z\"\/><path d=\"M1751 3234 c-13 -9 -29 -31 -37 -50 -12 -29 -10 -49 21 -204 19 -94 39 -189 45 -210 14 -50 54 -80 110 -80 34 0 48 6 76 34 21 21 34 44 34 59 0 14 -18 113 -40 219 -37 178 -43 195 -70 221 -36 32 -101 37 -139 11z\"\/><path d=\"M1163 3073 c-36 -7 -73 -59 -73 -102 0 -56 133 -378 171 -413 34 -32 83 -37 129 -13 70 36 67 87 -16 290 -86 209 -89 214 -129 231 -35 14 -42 15 -82 7z\"\/><path d=\"M3689 3066 c-15 -9 -33 -30 -42 -48 -48 -103 -147 -355 -147 -375 0 -98 131 -148 192 -74 13 15 57 108 97 206 80 196 84 226 37 273 -30 30 -99 39 -137 18z\"\/><path d=\"M583 2784 c-38 -19 -67 -74 -58 -113 9 -42 211 -354 242 -373 16 -10 45 -18 66 -18 51 0 107 52 107 100 0 39 -1 41 -124 234 -80 126 -108 162 -133 173 -41 17 -61 16 -100 -3z\"\/><path d=\"M4250 2784 c-14 -9 -74 -91 -133 -183 -95 -150 -107 -173 -107 -213 0 -55 33 -94 87 -104 67 -13 90 8 211 198 130 202 137 225 78 284 -27 27 -42 34 -72 34 -22 0 -50 -8 -64 -16z\"\/><path d=\"M2275 2693 c-553 -48 -1095 -270 -1585 -649 -135 -104 -459 -423 -483 -476 -23 -49 -22 -139 2 -186 73 -142 361 -457 571 -626 285 -228 642 -407 990 -497 242 -63 336 -73 660 -74 310 0 370 5 595 52 535 111 1045 392 1455 803 122 121 250 273 275 326 19 41 19 137 0 174 -41 79 -309 363 -465 492 -447 370 -946 591 -1479 653 -113 14 -422 18 -536 8z m395 -428 c171 -34 330 -124 456 -258 112 -119 167 -219 211 -378 27 -96 24 -300 -5 -401 -72 -255 -236 -447 -474 -557 -132 -62 -201 -76 -368 -76 -167 0 -236 14 -368 76 -213 98 -373 271 -451 485 -162 444 86 934 547 1084 153 49 292 57 452 25z m909 -232 c222 -123 408 -262 593 -441 76 -74 138 -139 138 -144 0 -16 -233 -242 -330 -319 -155 -123 -309 -223 -461 -299 l-81 -41 32 46 c18 26 49 83 70 128 143 306 141 649 -6 957 -25 52 -61 116 -79 142 l-34 47 45 -20 c26 -10 76 -36 113 -56z m-2057 25 c-40 -58 -105 -190 -130 -263 -110 -324 -59 -707 132 -981 25 -35 42 -64 37 -64 -19 0 -241 119 -326 174 -188 122 -406 314 -532 468 l-58 71 108 103 c185 178 428 349 672 473 66 33 121 60 123 61 2 0 -10 -19 -26 -42z\"\/><path d=\"M2375 1950 c-198 -44 -350 -190 -395 -379 -18 -76 -8 -221 19 -290 114 -284 457 -406 731 -260 98 52 188 154 231 260 27 69 37 214 19 290 -38 163 -166 304 -326 360 -67 23 -215 33 -279 19z\"\/><\/g><\/svg><\/i> <img loading=\"lazy\" decoding=\"async\" width=\"16\" height=\"16\" alt=\"Loading\" src=\"https:\/\/www.howdoiuseacomputer.com\/wp-content\/plugins\/page-views-count\/ajax-loader-2x.gif\" border=0 \/><\/p><div class=\"pvc_clear\"><\/div>","protected":false},"excerpt":{"rendered":"<p>Just a quick one on ABPs &#8211; there are many posts about this topic now, but there are few that mention how to resolve issues such as recipients not appearing in the list when they should be. In this case you need to &#8216;tickle&#8217; (yes that&#8217;s the official Microsoft term) the objects to get them [&hellip;]<\/p>\n<div class=\"pvc_clear\"><\/div>\n<p id=\"pvc_stats_327\" class=\"pvc_stats all  \" data-element-id=\"327\" style=\"\"><i class=\"pvc-stats-icon small\" aria-hidden=\"true\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" version=\"1.0\" viewBox=\"0 0 502 315\" preserveAspectRatio=\"xMidYMid meet\"><g transform=\"translate(0,332) scale(0.1,-0.1)\" fill=\"\" stroke=\"none\"><path d=\"M2394 3279 l-29 -30 -3 -207 c-2 -182 0 -211 15 -242 39 -76 157 -76 196 0 15 31 17 60 15 243 l-3 209 -33 29 c-26 23 -41 29 -80 29 -41 0 -53 -5 -78 -31z\"\/><path d=\"M3085 3251 c-45 -19 -58 -50 -96 -229 -47 -217 -49 -260 -13 -295 52 -53 146 -42 177 20 16 31 87 366 87 410 0 70 -86 122 -155 94z\"\/><path d=\"M1751 3234 c-13 -9 -29 -31 -37 -50 -12 -29 -10 -49 21 -204 19 -94 39 -189 45 -210 14 -50 54 -80 110 -80 34 0 48 6 76 34 21 21 34 44 34 59 0 14 -18 113 -40 219 -37 178 -43 195 -70 221 -36 32 -101 37 -139 11z\"\/><path d=\"M1163 3073 c-36 -7 -73 -59 -73 -102 0 -56 133 -378 171 -413 34 -32 83 -37 129 -13 70 36 67 87 -16 290 -86 209 -89 214 -129 231 -35 14 -42 15 -82 7z\"\/><path d=\"M3689 3066 c-15 -9 -33 -30 -42 -48 -48 -103 -147 -355 -147 -375 0 -98 131 -148 192 -74 13 15 57 108 97 206 80 196 84 226 37 273 -30 30 -99 39 -137 18z\"\/><path d=\"M583 2784 c-38 -19 -67 -74 -58 -113 9 -42 211 -354 242 -373 16 -10 45 -18 66 -18 51 0 107 52 107 100 0 39 -1 41 -124 234 -80 126 -108 162 -133 173 -41 17 -61 16 -100 -3z\"\/><path d=\"M4250 2784 c-14 -9 -74 -91 -133 -183 -95 -150 -107 -173 -107 -213 0 -55 33 -94 87 -104 67 -13 90 8 211 198 130 202 137 225 78 284 -27 27 -42 34 -72 34 -22 0 -50 -8 -64 -16z\"\/><path d=\"M2275 2693 c-553 -48 -1095 -270 -1585 -649 -135 -104 -459 -423 -483 -476 -23 -49 -22 -139 2 -186 73 -142 361 -457 571 -626 285 -228 642 -407 990 -497 242 -63 336 -73 660 -74 310 0 370 5 595 52 535 111 1045 392 1455 803 122 121 250 273 275 326 19 41 19 137 0 174 -41 79 -309 363 -465 492 -447 370 -946 591 -1479 653 -113 14 -422 18 -536 8z m395 -428 c171 -34 330 -124 456 -258 112 -119 167 -219 211 -378 27 -96 24 -300 -5 -401 -72 -255 -236 -447 -474 -557 -132 -62 -201 -76 -368 -76 -167 0 -236 14 -368 76 -213 98 -373 271 -451 485 -162 444 86 934 547 1084 153 49 292 57 452 25z m909 -232 c222 -123 408 -262 593 -441 76 -74 138 -139 138 -144 0 -16 -233 -242 -330 -319 -155 -123 -309 -223 -461 -299 l-81 -41 32 46 c18 26 49 83 70 128 143 306 141 649 -6 957 -25 52 -61 116 -79 142 l-34 47 45 -20 c26 -10 76 -36 113 -56z m-2057 25 c-40 -58 -105 -190 -130 -263 -110 -324 -59 -707 132 -981 25 -35 42 -64 37 -64 -19 0 -241 119 -326 174 -188 122 -406 314 -532 468 l-58 71 108 103 c185 178 428 349 672 473 66 33 121 60 123 61 2 0 -10 -19 -26 -42z\"\/><path d=\"M2375 1950 c-198 -44 -350 -190 -395 -379 -18 -76 -8 -221 19 -290 114 -284 457 -406 731 -260 98 52 188 154 231 260 27 69 37 214 19 290 -38 163 -166 304 -326 360 -67 23 -215 33 -279 19z\"\/><\/g><\/svg><\/i> <img loading=\"lazy\" decoding=\"async\" width=\"16\" height=\"16\" alt=\"Loading\" src=\"https:\/\/www.howdoiuseacomputer.com\/wp-content\/plugins\/page-views-count\/ajax-loader-2x.gif\" border=0 \/><\/p>\n<div class=\"pvc_clear\"><\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[8,9],"tags":[13,86,85,88,25,5,87],"class_list":["post-327","post","type-post","status-publish","format-standard","hentry","category-powershell","category-ramblings","tag-13","tag-abp","tag-address-book-policy","tag-address-list","tag-exchange-online","tag-powershell","tag-tickle"],"post_mailing_queue_ids":[],"_links":{"self":[{"href":"https:\/\/www.howdoiuseacomputer.com\/index.php\/wp-json\/wp\/v2\/posts\/327"}],"collection":[{"href":"https:\/\/www.howdoiuseacomputer.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.howdoiuseacomputer.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.howdoiuseacomputer.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.howdoiuseacomputer.com\/index.php\/wp-json\/wp\/v2\/comments?post=327"}],"version-history":[{"count":4,"href":"https:\/\/www.howdoiuseacomputer.com\/index.php\/wp-json\/wp\/v2\/posts\/327\/revisions"}],"predecessor-version":[{"id":434,"href":"https:\/\/www.howdoiuseacomputer.com\/index.php\/wp-json\/wp\/v2\/posts\/327\/revisions\/434"}],"wp:attachment":[{"href":"https:\/\/www.howdoiuseacomputer.com\/index.php\/wp-json\/wp\/v2\/media?parent=327"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.howdoiuseacomputer.com\/index.php\/wp-json\/wp\/v2\/categories?post=327"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.howdoiuseacomputer.com\/index.php\/wp-json\/wp\/v2\/tags?post=327"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}