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
Install the Azure AD module
Install the Azure AD module

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
Connect to Entra ID (Azure AD)
Connect to Entra ID (Azure AD)

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
Check the synchronization status
Check the synchronization status

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
Disable Directory synchronization with Microsoft Entra ID
Disable Directory synchronization with Microsoft Entra ID

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.

Microsoft Entra ID directory sync disabled
Microsoft Entra ID directory sync disabled

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.

Uninstall Microsoft Entra Connect
Uninstall Microsoft Entra Connect

The following components are removed along with Microsoft Entra Connect.

  1. Microsoft Entra Connect Health Agent
  2. Azure AD Sync Engine / Microsoft Entra Connect Sync Engine
  3. Microsoft Command line utilities 15 for SQL Server
  4. Microsoft ODBC Driver and OLE DB Driver for SQL Server
  5. SQL Server 2019 LocalDB

Click Remove to proceed with uninstallation.

Uninstall Microsoft Entra Connect
Uninstall Microsoft Entra Connect

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.

Uninstall Microsoft Entra Connect
Uninstall Microsoft Entra Connect

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.

Install and Update Third Party Applications with Patch My PC
Install and Update Third Party Applications with Patch My PC

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.

Remove Microsoft Azure AD Folders
Remove Microsoft Azure AD Folders

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.

Prajwal Desai

Prajwal Desai is a technology expert and 10 time Dual Microsoft MVP (Most Valuable Professional) with a strong focus on Microsoft Intune, SCCM, Windows 365, Enterprise Mobility, and Windows. He is a renowned author, speaker, & community leader, known for sharing his expertise & knowledge through his blog, YouTube, conferences, webinars etc.