Azure / Azure/azure-powershell
Az.Sql Data Sync documentation improvements
- Dominant language
- C#
- Stars
- 4.8k
- Forks
- 4.3k
- Avg merge
- 3d 14h
- Merged PRs (30d)
- 54
Description
Recently I've been looking at the docs to try to get Data Sync working solely in Powershell, and I've noticed a few things I was confused by. These are all separate issues, but they're all relatively minor. If you could point me to which files I should edit to fix these I can try to make a PR.
Currently, the "Related Links" section in `New-AzSqlSyncMember` refers to `Set-AzSqlSyncMember`, but this doesn't exist. It likely means to refer to `Update-AzSqlSyncMember`
It would be nice to have a link between `Get-AzSqlSyncSchema` and `Update-AzSqlSyncSchema`. Additionally, it would be clearer if it were more immediately called out (e.g. in the first sentence) that `Update-AzSqlSyncSchema` invokes a refresh of the master / hub schema on the server (so that `Get-AzSqlSyncSchema` can actually return something), instead of updating the schema on the sync group from passed-in parameters (that is, the "Update" is more similar to `Update-FormatData` than `Update-AzSqlSyncMember` or any other `Update-AzSql*` cmdlet). The way to actually update the schema of a sync group is to use the `SchemaFile` parameter on `Update-AzSqlSyncGroup`. Creating a sync group / member doesn't invoke a refresh the schema by default to begin with, so the first call of `Get-AzSqlSyncSchema` returns nothing, which I found very confusing considering all the examples have it just work.
For `Update-AzSqlSyncGroup`, I believe the SchemaFile example should have "DataSize" and "DataType" parameters for the columns -- I couldn't get it to work without that. I'd also like to have some documentation on what "MasterSyncMemberName" is supposed to do -- every example I've seen has it set to null. The QuotedNames should also likely be surrounded by square brackets, as they will be if the schema is generated.
Some method of generating schema.json might be nice to have in the examples section -- to include all tables, I used
```
Update-AzSqlSyncSchema -ResourceGroupName $destResourceGroupName -ServerName $destServerName -DatabaseName $destDbName -SyncGroupName $syncGroupName
$schema = Get-AzSqlSyncSchema -ResourceGroupName $destResourceGroupName -ServerName $destServerName -DatabaseName $destDbName -SyncGroupName $syncGroupName
$tables = $schema.Tables | Select-Object QuotedName,Columns | %{[PSCustomObject]@{QuotedName = $_.QuotedName; Columns = ($_.Columns | select-object QuotedName,DataSize,DataType)}}
Set-Content schema.json ([PSCustomObject]@{Tables = $tables; MasterSyncMemberName = $null} | ConvertTo-Json -Depth 5 -Compress)
```
A more nuanced approach is available at https://docs.microsoft.com/en-us/azure/sql-database/scripts/sql-database-sync-data-between-sql-databases
Contributor guide
Assessment
This issue has not been assessed yet.