Disconnecting Microsoft 365 from Entra AD Connect

If you need to disconnect Entra AD Connect, there is a simple set of commands to do it.

Connect to Microsoft Graph with the appropriate permissions scopes.

Connect-MgGraph -Scopes "DeviceManagementServiceConfig.Read.All","DeviceManagementServiceConfig.ReadWrite.All","DeviceManagementConfiguration.ReadWrite.All","DeviceManagementConfiguration.Read.All","User.Read","Organization.ReadWrite.All","Organization.Read.All","Directory.ReadWrite.All","Directory.Read.All"

Check the current status.

Get-MgOrganization | Select-Object DisplayName, OnPremisesSyncEnabled

Disconnect Entra AD Connect.

$OrgID = (Get-MgOrganization).Id
$params = @{
    onPremisesSyncEnabled = $false
}
Update-MgOrganization -OrganizationId $OrgID -BodyParameter $params