Friday, March 21, 2025

How to uninstall Entra AAD Sync (and disable it/convert all users to cloud only)

How to disable Active Directory synchronization in Microsoft Entra ID

Step 1. Install the Microsoft Graph PowerShell module

Install-Module Microsoft.Graph -Force

Step 2. Connect to Microsoft Graph

Connect-MgGraph -Scopes "Organization.ReadWrite.All"

Step 3. Check on-premise sync status

Get-MgOrganization | Select-Object DisplayName, OnPremisesSyncEnabled
DisplayName OnPremisesSyncEnabled
----------- ---------------------
EXOIP                        True

Step 4. Disable on-premise directory synchronization

$OrgID = (Get-MgOrganization).Id

$params = @{
    onPremisesSyncEnabled = $false
}

Update-MgOrganization -OrganizationId $OrgID -BodyParameter $params

Step 5. Verify on-premise sync status - It should be empty.

Get-MgOrganization | Select-Object DisplayName, OnPremisesSyncEnabled
DisplayName OnPremisesSyncEnabled
----------- ---------------------
EXOIP


The Sync status should have a picture of a cloud-



Step 6. Uninstall Entra AD Sync




Unable to connect to Office 365 / Exchange online, or Entra ID - Microsoft.Online.Administration.Automation.MicrosoftOnlineException was thrown.

Forget all of the former connection to 365. Microsoft broke it as of ... 3/2025. 

You'll get-powershell 'Microsoft.Online.Administration.Automation.MicrosoftOnlineException' was thrown.

For Entra ID, you need to upgrade to the latest version. That's it.

For powershell, you need to install the latest Exchange online management -
Find-Module ExchangeOnlineManagement -AllVersions
If you already have it installed, remove it so you can install the latest version -     
Remove-Module ExchangeOnlineManagement
Uninstall-Module ExchangeOnlineManagement -AllVersions -Force
Install the latest version, click "Y" for Yes, NOT "A" for all.
Install-Module ExchangeOnlineManagement -RequiredVersion 3.7.2 -Scope AllUsers
Now Import the module - 
Import-Module ExchangeOnlineManagement -RequiredVersion 3.7.2
Now you can connect to Exchange Online -
Connect-ExchangeOnline
That's it!