In this step-by-step guide, I will show you how to safely uninstall Microsoft Entra Connect from the server.
Microsoft Entra Connect (formerly known as Azure AD Connect) is an on-premises application that allows users to sign in to cloud and on-premises resources with the same passwords. Entra Connect Sync is the primary element of Microsoft Entra Connect that synchronizes identity information between an organization’s on-premises directory and Microsoft Entra ID.
Recently, I was contacted by an organization that wanted to move away from Microsoft Entra Connect and maintain two separate accounts, on-premises and in Entra. So they were looking to safely uninstall the Entra Connect without leaving any traces of it behind. If you are in a similar situation or have a similar requirement, allow me to share the procedure.
Disable MS Entra Connect Synchronization
The first step in removing Microsoft Entra Connect is to disable the synchronization of the objects between on-premises AD and Microsoft Entra.
This procedure requires running a set of commands and this information can be found in the Microsoft documentation and other good websites. I used the same commands when I encountered issues with removing objects that were synchronized through the Azure AD Sync tool.
Launch Windows PowerShell as an administrator and enter the following command to install the MSOnline module.
Install-Module MSOnline

Run the below command to connect to Entra AD (Azure AD). When you run this command, you must sign in to your organization with your credentials.
Connect-MsolService

Run the below command to check if the directory synchronization is activated or deactivated. If the command output shows True, it indicates that object synchronization is enabled or turned on. If its false, the sync is disabled, and you can proceed with removing the Microsoft Entra Connect.
(Get-MSOLCompanyInformation).DirectorySynchronizationEnabled

Since the MS Entra ID directory synchronization is turned on in this case, it needs to be stopped first. To do that, run the below command in the PowerShell window.
Set-MsolDirSyncEnabled -EnableDirSync $false

In the Microsoft Azure portal, we see that Microsoft Entra Connect shows Not enabled and Sync has never run. This confirms that directory synchronization is turned off successfully.

Uninstall Microsoft Entra Connect from Server
Once you have turned off the directory synchronization, you can now proceed with removing Microsoft Entra Connect from the server with the following steps:
On the server running Microsoft Entra Connect, navigate to Control Panel > Programs and Features. From the list of programs, select Microsoft Entra Connect and select Uninstall.

The following components are removed along with Microsoft Entra Connect.
- Microsoft Entra Connect Health Agent
- Azure AD Sync Engine / Microsoft Entra Connect Sync Engine
- Microsoft Command line utilities 15 for SQL Server
- Microsoft ODBC Driver and OLE DB Driver for SQL Server
- SQL Server 2019 LocalDB
Click Remove to proceed with uninstallation.

The Microsoft Entra Connect has been uninstalled from the server. If you discover any additional Entra ID components, such as health agents or others, simply uninstall them from the server.

Lastly, you may want to remove some leftover Microsoft Azure AD folders present in the C:\Program Files directory on the server. You can also delete those ADSyncMSA folders located in the C:\Users directory. Although this is an optional step, why keep those folders when you actually don’t need them?
One last thing: while deleting the ADSyncMSA folders, you may notice that you cannot remove all the files within them. These are folders that contain the ADSync service account, which is a managed domain account used to run the sync service in Microsoft Entra Connect. If you are unable to delete these folders, I recommend rebooting the server once and then removing them.

That’s it for this tutorial. I hope you were able to successfully remove the Microsoft Entra Connect from the server using the instructions provided in this guide.

Still Need Help?
If you need further assistance on the above article or want to discuss other technical issues, check out some of these options.