{"id":1306,"date":"2014-01-28T18:52:15","date_gmt":"2014-01-28T17:52:15","guid":{"rendered":"http:\/\/sccmfaq.wordpress.com\/?p=1306"},"modified":"2014-01-28T18:52:15","modified_gmt":"2014-01-28T17:52:15","slug":"windows-azure-directory-remove-no-longer-synced-objects","status":"publish","type":"post","link":"https:\/\/blog.hosebei.ch\/?p=1306","title":{"rendered":"Windows Azure Directory &#8211; Remove no longer synced objects"},"content":{"rendered":"<p>In one of my last blog-post I described how to configure the initial synchronization of an Active Directory Service with Windows Azure Directory (http:\/\/blog.hosebei.ch\/2014\/01\/23\/azure-directory-sync-initial-configuration\/). But what if you have already synced your Domain, and you made your configuration afterwards? Yes, unfortunately, the Accounts in the Azure Directory will not be deleted. This is caused of the Forefront Identity Manager Metaverse. But we come to this later on.<!--more--><\/p>\n<p>First, if you try to delete an account through the web console, you are not able to:<br \/>\n<a href=\"http:\/\/hosebei.wordpress.com\/wp-content\/uploads\/2014\/01\/fim_azure-directory01.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/hosebei.wordpress.com\/wp-content\/uploads\/2014\/01\/fim_azure-directory01.png?w=300\" alt=\"Azure Directory delete user\" width=\"300\" height=\"190\" class=\"aligncenter size-medium wp-image-1307\" srcset=\"https:\/\/blog.hosebei.ch\/wp-content\/uploads\/2014\/01\/fim_azure-directory01.png 1030w, https:\/\/blog.hosebei.ch\/wp-content\/uploads\/2014\/01\/fim_azure-directory01-300x190.png 300w, https:\/\/blog.hosebei.ch\/wp-content\/uploads\/2014\/01\/fim_azure-directory01-1024x650.png 1024w, https:\/\/blog.hosebei.ch\/wp-content\/uploads\/2014\/01\/fim_azure-directory01-768x488.png 768w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>So, this means, you have to remove the object from the FIM Metaverse. Normally, you delete an object from Active Directory FIM recognize that the object is missing through the missing connector, and within Standard configuration, the object will be deleted in the Metaverse and when the next sync is scheduled also in the Windows Azure Directory. But in this case, the objects are still existing in Active Directory, but I will have to removed them from the metaverse. This means, we have to delete the connector from the object. You can achieve this through the gui.<br \/>\nNavigate to &#8220;Metaverse Search&#8221; and click on &#8220;Add Clause&#8221;:<br \/>\n<a href=\"http:\/\/hosebei.wordpress.com\/wp-content\/uploads\/2014\/01\/fim_azure-directory02.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/hosebei.wordpress.com\/wp-content\/uploads\/2014\/01\/fim_azure-directory02.png?w=300\" alt=\"Metaverse search\" width=\"300\" height=\"222\" class=\"aligncenter size-medium wp-image-1308\" srcset=\"https:\/\/blog.hosebei.ch\/wp-content\/uploads\/2014\/01\/fim_azure-directory02.png 1030w, https:\/\/blog.hosebei.ch\/wp-content\/uploads\/2014\/01\/fim_azure-directory02-300x223.png 300w, https:\/\/blog.hosebei.ch\/wp-content\/uploads\/2014\/01\/fim_azure-directory02-1024x761.png 1024w, https:\/\/blog.hosebei.ch\/wp-content\/uploads\/2014\/01\/fim_azure-directory02-768x570.png 768w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><br \/>\nBe sure that you choose Displayname as Attribute, and then configure your search, in my case Show all objects starting with svc:<br \/>\n<a href=\"http:\/\/hosebei.wordpress.com\/wp-content\/uploads\/2014\/01\/fim_azure-directory03.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/hosebei.wordpress.com\/wp-content\/uploads\/2014\/01\/fim_azure-directory03.png?w=300\" alt=\"Add clause\" width=\"300\" height=\"152\" class=\"aligncenter size-medium wp-image-1310\" srcset=\"https:\/\/blog.hosebei.ch\/wp-content\/uploads\/2014\/01\/fim_azure-directory03.png 706w, https:\/\/blog.hosebei.ch\/wp-content\/uploads\/2014\/01\/fim_azure-directory03-300x153.png 300w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><br \/>\nDouble click an entry, and open the tab connectors:<br \/>\n<a href=\"http:\/\/hosebei.wordpress.com\/wp-content\/uploads\/2014\/01\/fim_azure-directory04.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/hosebei.wordpress.com\/wp-content\/uploads\/2014\/01\/fim_azure-directory04.png?w=300\" alt=\"Object\" width=\"300\" height=\"234\" class=\"aligncenter size-medium wp-image-1311\" srcset=\"https:\/\/blog.hosebei.ch\/wp-content\/uploads\/2014\/01\/fim_azure-directory04.png 707w, https:\/\/blog.hosebei.ch\/wp-content\/uploads\/2014\/01\/fim_azure-directory04-300x234.png 300w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><br \/>\nActivate the line with the &#8220;Active Directory Connector&#8221; Management Agent and click on &#8220;Disconnect&#8230;&#8221;:<br \/>\n<a href=\"http:\/\/hosebei.wordpress.com\/wp-content\/uploads\/2014\/01\/fim_azure-directory05.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/hosebei.wordpress.com\/wp-content\/uploads\/2014\/01\/fim_azure-directory05.png?w=300\" alt=\"Metaverse object properties\" width=\"300\" height=\"232\" class=\"aligncenter size-medium wp-image-1313\" srcset=\"https:\/\/blog.hosebei.ch\/wp-content\/uploads\/2014\/01\/fim_azure-directory05.png 706w, https:\/\/blog.hosebei.ch\/wp-content\/uploads\/2014\/01\/fim_azure-directory05-300x233.png 300w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><br \/>\nIn the disconnect object accept question, choose &#8220;Disconnector (Default)&#8221; to remove the connector. Explicit Disconnector will lock the object to be a connector again.<br \/>\n<a href=\"http:\/\/hosebei.wordpress.com\/wp-content\/uploads\/2014\/01\/fim_azure-directory06.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/hosebei.wordpress.com\/wp-content\/uploads\/2014\/01\/fim_azure-directory06.png?w=300\" alt=\"Disconnect Object\" width=\"300\" height=\"185\" class=\"aligncenter size-medium wp-image-1314\" srcset=\"https:\/\/blog.hosebei.ch\/wp-content\/uploads\/2014\/01\/fim_azure-directory06.png 410w, https:\/\/blog.hosebei.ch\/wp-content\/uploads\/2014\/01\/fim_azure-directory06-300x185.png 300w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><br \/>\nYou can then rerun your search, and the specific account will not be shown anymore. And after a sync, the object will also be be removed from the azure Directory:<br \/>\n<a href=\"http:\/\/hosebei.wordpress.com\/wp-content\/uploads\/2014\/01\/fim_azure-directory07.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/hosebei.wordpress.com\/wp-content\/uploads\/2014\/01\/fim_azure-directory07.png?w=300\" alt=\"Azure Directory removed user\" width=\"300\" height=\"124\" class=\"aligncenter size-medium wp-image-1316\" srcset=\"https:\/\/blog.hosebei.ch\/wp-content\/uploads\/2014\/01\/fim_azure-directory07.png 1047w, https:\/\/blog.hosebei.ch\/wp-content\/uploads\/2014\/01\/fim_azure-directory07-300x124.png 300w, https:\/\/blog.hosebei.ch\/wp-content\/uploads\/2014\/01\/fim_azure-directory07-1024x423.png 1024w, https:\/\/blog.hosebei.ch\/wp-content\/uploads\/2014\/01\/fim_azure-directory07-768x318.png 768w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><br \/>\nFor more Information about deprovisioning I would recommend this Blog Post on TechNet: http:\/\/social.technet.microsoft.com\/wiki\/contents\/articles\/1270.understanding-deprovisioning-in-fim.aspx<\/p>\n<p>But if you have seen my list, and I can imagine that others will have longer lists to delete, you want to do this with Powershell. Well, there exist only a few cmdlets, and they are not very helpful: http:\/\/technet.microsoft.com\/en-us\/library\/ff394179.aspx<\/p>\n<p>So if you have to delete a huge amount of objects, and you don&#8217;t want to do this manually, we can&#8217;t use FIM for simplifying this. But you can then use this way to delete the object automatically, we achieve this, when we make changes to the FIM configuration and delete the object in Windows Azure Directory.<br \/>\nFirst you have to navigate to &#8220;Metaverse Designer&#8221; and select the object type you want to delete, in my case Groups, and click on &#8220;Configure Object Deletion Rule&#8221;:<br \/>\n<a href=\"http:\/\/hosebei.wordpress.com\/wp-content\/uploads\/2014\/01\/fim_azure-directory08.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/hosebei.wordpress.com\/wp-content\/uploads\/2014\/01\/fim_azure-directory08.png?w=300\" alt=\"FIM Metaverse Object Designer\" width=\"300\" height=\"180\" class=\"aligncenter size-medium wp-image-1325\" srcset=\"https:\/\/blog.hosebei.ch\/wp-content\/uploads\/2014\/01\/fim_azure-directory08.png 1028w, https:\/\/blog.hosebei.ch\/wp-content\/uploads\/2014\/01\/fim_azure-directory08-300x181.png 300w, https:\/\/blog.hosebei.ch\/wp-content\/uploads\/2014\/01\/fim_azure-directory08-1024x618.png 1024w, https:\/\/blog.hosebei.ch\/wp-content\/uploads\/2014\/01\/fim_azure-directory08-768x463.png 768w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><br \/>\nIn the &#8220;Configure Object Deletion Rule&#8221; select the Checkbox besides &#8220;Windows Azure Active Directory Connector&#8221;. FIM will delete the object in the metaverse, because the connector to the object in the Azure Directory object will be deleted, because we delete the object afterwards.<br \/>\n<a href=\"http:\/\/hosebei.wordpress.com\/wp-content\/uploads\/2014\/01\/fim_azure-directory09.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/hosebei.wordpress.com\/wp-content\/uploads\/2014\/01\/fim_azure-directory09.png?w=300\" alt=\"Windows Azure Active Directory Connector\" width=\"300\" height=\"271\" class=\"aligncenter size-medium wp-image-1326\" srcset=\"https:\/\/blog.hosebei.ch\/wp-content\/uploads\/2014\/01\/fim_azure-directory09.png 631w, https:\/\/blog.hosebei.ch\/wp-content\/uploads\/2014\/01\/fim_azure-directory09-300x271.png 300w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><br \/>\nNow we can open a powershell with the loaded Windows Azure Active Directory module and can delete our objects. To delete a user, you have to use the &#8220;Remove-MSOLUser&#8221; cmdlet, and for Groups &#8220;Remove-MSOLGroup&#8221;. In my case, I can delete all Groups, so I use this one-liner (The Switch -Force will suppress the deletion confirmation!):<br \/>\n<code>foreach($group in Get-MsolGroup){Remove-MsolGroup -ObjectId $group.objectID -Force}<\/code><br \/>\nThe Groups will ultimately removed from the Azure Directory, you can recognize this via the webconsole. When the directories get synced, you can find in the oprations console, that the Groups were deleted from the metaverse:<br \/>\n<a href=\"http:\/\/hosebei.wordpress.com\/wp-content\/uploads\/2014\/01\/fim_azure-directory10.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/hosebei.wordpress.com\/wp-content\/uploads\/2014\/01\/fim_azure-directory10.png?w=300\" alt=\"Deletion\" width=\"300\" height=\"158\" class=\"aligncenter size-medium wp-image-1327\" srcset=\"https:\/\/blog.hosebei.ch\/wp-content\/uploads\/2014\/01\/fim_azure-directory10.png 665w, https:\/\/blog.hosebei.ch\/wp-content\/uploads\/2014\/01\/fim_azure-directory10-300x158.png 300w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><br \/>\nIf you don&#8217;t want to delete all Groups or users, then you can create a more effective powershell script to delete the object in the metaverse. Perhaps in a future Version, it will be easier to get some poweshell cmdlets for FIM too.<br \/>\nWhen your work is done, don&#8217;t forget to remove the Checkbox in the Object Deletion Rule.<\/p>\n<p>Hope this helps!<\/p>\n<p>Martin<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In one of my last blog-post I described how to configure the initial synchronization of an Active Directory Service with Windows Azure Directory (http:\/\/blog.hosebei.ch\/2014\/01\/23\/azure-directory-sync-initial-configuration\/). But what if you have already synced your Domain, and you made your configuration afterwards? Yes, unfortunately, the Accounts in the Azure Directory will not be deleted. This is caused of [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[19],"tags":[],"class_list":["post-1306","post","type-post","status-publish","format-standard","hentry","category-general"],"_links":{"self":[{"href":"https:\/\/blog.hosebei.ch\/index.php?rest_route=\/wp\/v2\/posts\/1306","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=1306"}],"version-history":[{"count":0,"href":"https:\/\/blog.hosebei.ch\/index.php?rest_route=\/wp\/v2\/posts\/1306\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.hosebei.ch\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1306"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.hosebei.ch\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1306"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.hosebei.ch\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1306"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}