I'm unable to delete the DataSync table

Jean Rodriguez 0 Reputation points
2026-08-05T17:43:14.46+00:00

I have been unable to delete the DataSync table, the sync metadata database, which we are not using anymore as we moved away from DataSync groups. The data sync group was deleted, and then I've applied all cleanup scripts so we don't have any of the data sync schemas, users, etc. But I'm still getting the "Database xxxxxx' cannot be deleted because it is used as a sync metadata database which still contains sync groups and/or sync agents. (Code: CannotMoveOrDropSyncMetadataDatabase)" error everytime I tried deleting the db.

Azure SQL Database

1 answer

Sort by: Most helpful
  1. Ravi Kiran Pagidi 170 Reputation points
    2026-08-06T02:58:17.8733333+00:00

    Hi Jean,

    If the database still returns CannotMoveOrDropSyncMetadataDatabase, then Azure SQL still has that database registered in the SQL Data Sync service metadata, even if the Data Sync schemas/tables/users were already removed from inside the database.

    The important point is that deleting dss / TaskHosting objects from the database does not necessarily remove the Azure Data Sync resource registration. The sync groups, members, or agents must be removed from the Azure side.

    Please check these items:

    1. Go to the database in Azure portal and check: SQL database > Data Sync > Sync Groups / Sync Agents If the portal blade is empty or stuck, try checking with PowerShell or REST API for any remaining sync groups/agents. If you find any sync groups, delete them first and wait for deletion to fully complete. If there are on-premises sync agents, make sure they are removed/unregistered as well. If an agent is offline, bring it online if possible and then remove the sync group/agent cleanly. Do not manually drop more Data Sync objects in the database at this point. The issue is likely the service-side registration, not remaining user tables.

    If nothing is visible in the portal/PowerShell but the database still cannot be deleted, this is likely an orphaned SQL Data Sync metadata registration. In that case, Microsoft Support needs to clear/reset the backend Data Sync registration for the database.

    Please open a support request and include:

    Subscription ID

    SQL server name

    Database name

    Region

    Error code: CannotMoveOrDropSyncMetadataDatabase

    Confirmation that the sync group was deleted

    Any sync group/agent names, if known

    Approximate time when Data Sync was removed

    Docs:

    SQL Data Sync troubleshooting: https://learn.microsoft.com/en-us/azure/azure-sql/database/sql-data-sync-troubleshoot

    Sync Groups delete REST API: https://learn.microsoft.com/en-us/rest/api/sql/sync-groups/delete

    Sync Agents delete REST API: https://learn.microsoft.com/en-us/rest/api/sql/sync-agents/delete

    In short, this is usually not fixed by database cleanup scripts alone. If Azure still thinks the database is a sync metadata database, the remaining sync registration has to be removed from the SQL Data Sync service metadata, and Microsoft Support may need to do that if the objects are orphaned.

    Was this answer helpful?

    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.