Hi @Aparna Manoharan,
Thanks for the question and using MS Q&A platform.
Yes, you should take a backup of the Data Sync metadata before refreshing the Azure SQL Database, especially if you're concerned about having to perform row-by-row comparisons after the environment is refreshed. When you refresh a database in Azure SQL, the metadata related to Azure Data Sync (such as synchronization settings, conflict resolution policies, and the state of syncs) might be lost or reset, so backing it up ensures that you can restore your sync configurations quickly after the refresh.
You can take a full backup of the Data Sync metadata by exporting the data from these tables. There are a couple of ways to do this:
# This script exports the sync configuration of your Sync Group:
Export-AzSqlSyncGroup -ResourceGroupName "your-resource-group" `
-ServerName "your-server-name" `
-DatabaseName "your-database-name" `
-SyncGroupName "your-sync-group-name" `
-ExportFilePath "path-to-save-the-configuration"
# This script imports the sync configuration to your Sync Group:
Import-AzSqlSyncGroup -ResourceGroupName "your-resource-group" `
-ServerName "your-server-name" `
-DatabaseName "your-database-name" `
-SyncGroupName "your-sync-group-name" `
-ImportFilePath "path-of-the-exported-configuration"
These steps ensure that your sync group configuration is restored without needing row-by-row comparisons again.
Hope this helps. Do let us know if you any further queries. If this answers your query, do click Accept Answer
and Yes
for was this answer helpful. And, if you have any further query do let us know.