How to delete a user "correctly" in AD hybrid mode properly with exchange online account

Edmund Lee 1 Reputation point
2021-01-09T05:29:38.003+00:00

Hello All: We are currently running AzureADConnect with our on premAD and we also have Exchange hybrid mode configured. I need to rewrite some scripts to delete user with these new settings in place. What is the "proper" order to delete a user from these services? I am thinking: 1.) Remove MSOL license from the user object first 2.) Then call disable-remotemailbox to disable the exchange online object. 3.) remove-msoluser 4.) Then finally clean up the on premises side of things such as remove user from membership groups, manager, reports and finally disabling the AD object and deleting it.

Microsoft Security | Microsoft Entra | Microsoft Entra ID
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. SAGOHIL-MSFT 456 Reputation points Microsoft Employee
    2021-01-11T09:06:38.683+00:00

    Hi @Edmund Lee , Thank you for reaching out to us.

    I have reviewed the above query and I understand that you'd like to confirm if the above steps/ process is the appropriate way of permanently removed the user as well as the mailbox in the Hybrid scenario.

    I an confirm that the below process is good to go.

    1. Remove the mailbox license
    2. disable the exchange online object by calling the command - Disable-remotemailbox
      Ref.: https://learn.microsoft.com/en-us/powershell/module/exchange/disable-remotemailbox?view=exchange-ps
    3. Once the mailbox and the details are remove, we can safely remove the MSOL user object.

    However, I have seen some issues with Disable-remotemailbox sometimes, hence, I would recommend you to test out the script/ commands on test users first.

    Please let us know if you have any further queries.

    -----------------------------------------------------------------------------------------------------------

    Please "Accept the answer" if the information helped you. This will help us and others in the community as well.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.