none
Unable to Delete Active Directory Users

    Question

  • I'm hoping someone can help me on this and I'm giving you the story on what happened. I was cleaning up our users on an Domain Server that is on an Azure VM. After doing so and not realizing there was an issue where the Azure Active Directory Connect was having errors and not Syncing with my Azure AD.  I then noticed it and could not figure out what was causing the error.  Later I figured it was not able to log in to Azure AD, and I didn't change any of my credentials.  I then uninstalled, rebooted, reinstalled Azure AD Connect.  After a few Syncs I noticed the users I deleted from the Domain are still showing up on the Azure AD side and I the option to delete in the Azure AD is greyed due to them being synced to the Domain Controller on the VM.  I thought adding the user in the Domain Controller and waiting for the Sync to happen would restore it.  This is not the case, I get a second ID with the non primary Domain name from Azure AD.  Here is an example, what should be dthomas@***software.com is now  dthomas3687@chapmxhotmail058.onmicrosoft.com.  I also see the old dthomas@***software.com, but cannot delete due to the button being greyed out.  It's as if the connection go severed and cannot make the connection to get rid of it.  Is there anything I can do ? 

    Thank you,

    Dave Thomas

    Sunday, March 19, 2017 5:06 PM

Answers

  • The issue was from the UserID that was the admin ID.  After restoring it through Powershell, this worked fine.  The script below was quick.  After you login, I ran the get to find the Object ID of the user that got deleted, and then restored it.

    Get-MsolUser -ReturnDeletedUsers | fl DisplayName,UserPrincipalName, ObjectID

    Restore-MsolUser -ObjectId

    • Marked as answer by D Thomas CDC Friday, May 5, 2017 5:29 PM
    Friday, May 5, 2017 5:29 PM

All replies