Share via

Can't uninstall Entra AD Sync

Alan Auld 0 Reputation points
2026-03-10T19:26:43.95+00:00

Our on premises AD server is no longer available. Therefore, I can't uninstall ADSync. I've tried to disable it supplied PowerShell scripts but it doesn't work. I now have accounts and groups from the on-prem server living in the cloud that I cannot remove.

Windows for business | Windows Server | Directory services | Active Directory

1 answer

Sort by: Most helpful
  1. Raja Pothuraju 47,165 Reputation points Microsoft External Staff Moderator
    2026-03-17T19:27:40.72+00:00

    Hello @Alan Auld,

    Based on your description, I understand that you want to completely disable synchronization and you would like to remove the synced users and group from Cloud. To do that you should first convert synced users into cloud-only users without any on-premises attributes and post that you can delete the accounts from cloud. Additionally, you mentioned that you no longer have access to on-premises server as you decommissioned and no longer available.

    To proceed with converting synced users into cloud-only users, please follow the steps below using Microsoft Graph Explorer to disable directory synchronization:

    • Open Microsoft Graph Explorer.
    • Sign in using a Global Administrator account.
    • Use the following PATCH request (replace {organization-id} with your actual Tenant ID):

    YAML

    PATCH https://graph.microsoft.com/beta/organization/{organization-id} (Replace org id with Tenant ID)
    
    • Navigate to the Modify Permissions tab and grant Organization.ReadWrite.All permission (consent on behalf of the organization).
    • In the Request Body, enter the following JSON:

    JSON

    {
      "onPremisesSyncEnabled": false
    }
    
    • Click Run Query.

    Note: It may take 4–5 minutes for the changes to reflect in the Azure portal. The maximum time to disable directory sync is 72 hours, but it may vary based on the object size.

    User's image

    Once completed, the previously synced users will be converted to cloud-only users. Then if you want to have those users you can keep it like that if not you can delete those users as per your needs.

    Alternatively, you can also use PowerShell to disable directory synchronization. Please refer to the official Microsoft documentation below for detailed steps:

    Turn off directory synchronization for Microsoft 365

    You can use Microsoft Graph PowerShell SDK. This is the modern, unified PowerShell module built on the Microsoft Graph API.

    # Install v1.0 and beta Microsoft Graph PowerShell modules 
      Install-Module Microsoft.Graph -Force
      Install-Module Microsoft.Graph.Beta -AllowClobber -Force 
      
      # Connect With Hybrid Identity Administrator Account
      Connect-MgGraph -scopes "Organization.ReadWrite.All,Directory.ReadWrite.All" 
      
      # Verify the current status of the DirSync Type
      Get-MgOrganization | Select OnPremisesSyncEnabled 
      
      # Store the Tenant ID in a variable named organizationId
      $organizationId = (Get-MgOrganization).Id 
      
      # Store the False value for the DirSyncEnabled Attribute
      $params = @{
      	onPremisesSyncEnabled = $false
      }
      
      # Perform the update
      Update-MgOrganization -OrganizationId $organizationId -BodyParameter $params 
      
      # Check that the command worked
      Get-MgOrganization | Select OnPremisesSyncEnabled
    

    Let me know if you need assistance with any of the steps.

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.