Delete user from Office 365 with DirSync

First you need to remove the user from DirSync:

Open the “Synchronization Service Manager” (cn be fount at “C:Program FilesWindowsAzureActiveDirectorySyncSYNCBUSSynchronization ServiceUIShellmiisclient.exe”)

Navigate to “Metaverse Search” and click on “Add Clause”

Be sure that you choose Displayname as Attribute, and then configure your search, in my case Show all objects starting with svc

Double click an entry, and open the tab connectors

Activate the line with the “Active Directory Connector” Management Agent and click on “Disconnect…

In the disconnect object accept question, choose “Disconnector (Default)” to remove the connector. Explicit Disconnector will lock the object to be a connector again.

Disconnect Object

You 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

Then you need to remove the user object from the Office 365 portal using the PowerShell

Open PowerShell “Windows Azure Active Directory Module”

$msolcred = get-credential

connect-msolservice -credential $msolcred

Get-MsolUser -ReturnDeletedUsers | FT UserP*,ObjectId

Remove-MsolUser -ObjectId abc1234-12abc-123a-ab12-a12b3c4d5f6gah -RemoveFromRecycleBin -Force

Get-MsolUser -ReturnDeletedUsers | Remove-MsolUser -RemoveFromRecycleBin -Force

Then at the next scheduled sync of te DirSync the user will be recreated. Also you can force the DirSync to creaate the user faster.

Share

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.