March 28, 2024
102020 1925 Howtoremove1 1 - How to remove Users (Objects) that were synchronized through the Azure active directory connect tool
Have you been tried to delete users from Azure active directory or office 365 but failed? The error shows couldn't delete this user because the account is synchronized with your on-premises server. You can delete the user from your on-premise server. If your Azure AD connect server still alive, that's easy to solve, you can delete the user from on-premise domain controller, it will remove the user atomically. If the on-promise Azure AD connect server is no longer available, you can't manage or delete the user (object) from the on-premises environment, please follow steps as below to delete it.

Have you been tried to delete users from Azure active directory or office 365 but failed? The error shows couldn’t delete this user because the account is synchronized with your on-premises server. You can delete the user from your on-premise server. If your Azure AD connect server still alive, that’s easy to solve, you can delete the user from on-premise domain controller, it will remove the user atomically. If the on-promise Azure AD connect server is no longer available, you can’t manage or delete the user (object) from the on-premises environment, please follow steps as below to delete it.

102020 1925 Howtoremove1 - How to remove Users (Objects) that were synchronized through the Azure active directory connect tool

102020 1925 Howtoremove2 - How to remove Users (Objects) that were synchronized through the Azure active directory connect tool

1.Open PowerShell run as administrator, run below cmdlet to Install Windows Azure Active Directory module.



Install-Module -Name MSOnline


102020 1925 Howtoremove3 - How to remove Users (Objects) that were synchronized through the Azure active directory connect tool

2.Click A to allow installation.

102020 1925 Howtoremove4 - How to remove Users (Objects) that were synchronized through the Azure active directory connect tool

3.Type follow cmdlet to connect Azure Active Directory.



Connect-MsolService


102020 1925 Howtoremove5 - How to remove Users (Objects) that were synchronized through the Azure active directory connect tool

4.Type office 365 global admin email, click Next.

102020 1925 Howtoremove6 - How to remove Users (Objects) that were synchronized through the Azure active directory connect tool

5.Type the global admin account password, click Sign in.

102020 1925 Howtoremove7 - How to remove Users (Objects) that were synchronized through the Azure active directory connect tool

6.Run below cmdlet to disable directory synchronization, click Y to confirm.



Set-MsolDirSyncEnabled -EnableDirSync $false


102020 1925 Howtoremove8 - How to remove Users (Objects) that were synchronized through the Azure active directory connect tool

7.Run below cmdlet to verify the directory synchronization was fully disabled.



(Get-MSOLCompanyInformation).DirectorySynchronizationEnabled


102020 1925 Howtoremove9 - How to remove Users (Objects) that were synchronized through the Azure active directory connect tool

8.Login to Microsoft office 365 admin center, select Active users.

102020 1925 Howtoremove10 - How to remove Users (Objects) that were synchronized through the Azure active directory connect tool

9.On the Active users page, select the user and click Delete user.

102020 1925 Howtoremove11 - How to remove Users (Objects) that were synchronized through the Azure active directory connect tool

10.On the Delete this user? page, click Delete User.

102020 1925 Howtoremove12 - How to remove Users (Objects) that were synchronized through the Azure active directory connect tool

11.Verify the user has been deleted successfully, click Close.

102020 1925 Howtoremove13 - How to remove Users (Objects) that were synchronized through the Azure active directory connect tool

12.If you cannot remove it from Microsoft 365 admin center, in my case, I cannot remove the Directory synchronization account.

102020 1925 Howtoremove14 - How to remove Users (Objects) that were synchronized through the Azure active directory connect tool

12.Open PowerShell run as administrator, run below cmdlet, click Y to confirm.

In my case.



Remove-MsolUser -UserPrincipalName <a href="mailto:Sync_GDMDC01_1dafc196bf6e@gooddealmart.onmicrosoft.com">Sync_GDMDC01_1dafc196bf6e@gooddealmart.onmicrosoft.com</a>
	

102020 1925 Howtoremove15 - How to remove Users (Objects) that were synchronized through the Azure active directory connect tool

13.Refresh Microsoft 365 admin center, verify the account have been deleted successfully.

102020 1925 Howtoremove16 - How to remove Users (Objects) that were synchronized through the Azure active directory connect tool

This steps also wok for Azure AD connect server still live but happen unexpected behavior, when You deleted user (object) from the on-premises AD DS. However, the user (object) wasn’t deleted from the Azure AD or Office 365.

You just need to run below cmdlet to reenable active directory synchronization after removed user (Object).



Set-MsolDirSyncEnabled -EnableDirSync $true


Hope you enjoy this post.

Cary Sun

Twitter: @SifuSun

Web Site: carysun.com

Blog Site: checkyourlogs.net

Blog Site: gooddealmart.com

ca16fbd3199de5f66b829b87082fb970?s=80&d=retro&r=g - How to remove Users (Objects) that were synchronized through the Azure active directory connect tool

Author: Cary Sun

Cary Sun has a wealth of knowledge and expertise in data center and deployment solutions. As a Principal Consultant, he likely works closely with clients to help them design, implement, and manage their data center infrastructure and deployment strategies.
With his background in data center solutions, Cary Sun may have experience in server and storage virtualization, network design and optimization, backup and disaster recovery planning, and security and compliance management. He holds CISCO CERTIFIED INTERNETWORK EXPERT (CCIE No.4531) from 1999. Cary is also a Microsoft Most Valuable Professional (MVP), Microsoft Azure MVP, Veeam Vanguard and Cisco Champion. He is a published author with several titles, including blogs on Checkyourlogs.net, and the author of many books.
Cary is a very active blogger at checkyourlogs.net and is permanently available online for questions from the community. His passion for technology is contagious, improving everyone around him at what they do.

Blog site: https://www.checkyourlogs.net
Web site: https://carysun.com
Blog site: https://gooddealmart.com
Twitter: @SifuSun
in: https://www.linkedin.com/in/sifusun/
Amazon Author: https://Amazon.com/author/carysun