How to stop syncing Windows Server with Azure Active Directory

I have a Windows Server 2016 on-premise which is being used to manage devices on a local network. We create and manage users for this local network.

One of our guys has accidentally synced our server with our online Office365 E3 Azure Active Directory. This is a problem because every time we make a new user in the server, it gets synced to office365 and a user is created there also. (we don't want this to happen).

How can I unlink our Windows server with our online office365 ?


Solution 1:

You should be able to:

Uninstall AzureAD Connect from the server then run the following (AzureAD PowerShell V1 command)

Set-MsolDirSyncEnabled –EnableDirSync $false

This should convert your users that are synced to cloud accounts and keep existing passwords (assuming password hash sync is enabled).

If you don't need the synced user objects in Office365, you can leverage the sync to help you clean up. Before disabling AzureAD Connect, create an empty OU, re-run the AzureAD Connect wizard then select the empty OU to sync with. When the sync runs it will not see any users, and it will delete the synced accounts in AzureAD/Office365. Once the directory is cleaned up you can execute the steps above to disable syncing on the directory.

REF: https://docs.microsoft.com/en-us/powershell/module/msonline/set-msoldirsyncenabled?view=azureadps-1.0