Remove the configuration, the agents' cloud account, any lab groups and the agents themselves.
Delete the configuration
In the old tenant, open Cloud sync › Configurations, select it and choose Delete.
Remove the leftover cloud objects
PowerShell
Get-MgUser -Filter "startswith(userPrincipalName,'ADToAADSyncServiceAccount')" |
Select-Object UserPrincipalName, Id, OnPremisesSyncEnabled
# when it shows the old sync account, delete it:
Get-MgUser -Filter "startswith(userPrincipalName,'ADToAADSyncServiceAccount')" | ForEach-Object { Remove-MgUser -UserId $_.Id }Delete any cloud-only groups or app registrations you made for testing, after noting what you need to rebuild in the new tenant.
Uninstall the agent on each server
CON-SYNC-01 and 02
Get-Package | Where-Object Name -match "Provisioning Agent|Agent Updater" | Uninstall-Package -Force
# The installer bundle often stays behind. Remove it too:
$p = Get-Package "Microsoft Entra Provisioning Agent Package" -ErrorAction SilentlyContinue
if ($p) {
$cmd = $p.Meta.Attributes["QuietUninstallString"]
if (-not $cmd) { $cmd = $p.Meta.Attributes["UninstallString"] + " /quiet" }
Start-Process cmd.exe -ArgumentList "/c $cmd" -Wait
}
Get-Package | Where-Object Name -match "Provisioning Agent|Agent Updater" # nothing
Restart-ComputerRestart one server at a time. To sync to a new tenant, follow Install the agent and sign in to the new tenant.


