Skip to content

Commit e467f9c

Browse files
fanglfangl
authored andcommitted
resolve comments
1 parent cf01bba commit e467f9c

File tree

2 files changed

+20
-13
lines changed

2 files changed

+20
-13
lines changed

src/ResourceManager/Sql/Commands.Sql.Test/ScenarioTests/Common.ps1

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -501,10 +501,10 @@ Gets the values of the parameters used by the sync group tests
501501
#>
502502
function Get-SqlSyncGroupTestEnvironmentParameters ($testSuffix)
503503
{
504-
return @{
505-
intervalInSeconds = 300;
506-
conflictResolutionPolicy = "HubWin";
507-
}
504+
return @{
505+
intervalInSeconds = 300;
506+
conflictResolutionPolicy = "HubWin";
507+
}
508508
}
509509

510510
<#
@@ -513,8 +513,8 @@ Gets the values of the parameters used by the sync member tests
513513
#>
514514
function Get-SqlSyncMemberTestEnvironmentParameters ($testSuffix)
515515
{
516-
return @{
517-
syncDirection = "Bidirectional";
518-
databaseType = "AzureSqlDatabase";
519-
}
516+
return @{
517+
syncDirection = "Bidirectional";
518+
databaseType = "AzureSqlDatabase";
519+
}
520520
}

src/ResourceManager/Sql/Commands.Sql/Data Sync/Cmdlet/NewAzureSqlSyncAgent.cs

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,15 @@ public class NewAzureSqlSyncAgent : AzureSqlSyncAgentCmdletBase
4545
/// <summary>
4646
/// Gets or sets the name of the server on which syncDB is hosted
4747
/// </summary>
48-
[Parameter(Mandatory = true,
48+
[Parameter(Mandatory = false,
4949
HelpMessage = "The server on which syncDB is hosted.")]
5050
[ValidateNotNullOrEmpty]
5151
public string SyncDatabaseServerName { get; set; }
5252

5353
/// <summary>
5454
/// Gets or sets the name of the resource group the syncDB belongs to
5555
/// </summary>
56-
[Parameter(Mandatory = true,
56+
[Parameter(Mandatory = false,
5757
HelpMessage = "The resource group syncDB belongs to.")]
5858
[ValidateNotNullOrEmpty]
5959
public string SyncDatabaseResourceGroupName { get; set; }
@@ -107,10 +107,17 @@ protected override IEnumerable<AzureSqlSyncAgentModel> ApplyUserInputToModel(IEn
107107
SyncAgentName = this.SyncAgentName
108108
});
109109

110-
if (MyInvocation.BoundParameters.ContainsKey("SyncDatabaseResourceGroupName")
111-
&& MyInvocation.BoundParameters.ContainsKey("SyncDatabaseServerName")
112-
&& MyInvocation.BoundParameters.ContainsKey("SyncDatabaseName"))
110+
if (MyInvocation.BoundParameters.ContainsKey("SyncDatabaseName"))
113111
{
112+
if (!MyInvocation.BoundParameters.ContainsKey("SyncDatabaseResourceGroupName"))
113+
{
114+
this.SyncDatabaseResourceGroupName = this.ResourceGroupName;
115+
}
116+
if (!MyInvocation.BoundParameters.ContainsKey("SyncDatabaseServerName"))
117+
{
118+
this.SyncDatabaseServerName = this.ServerName;
119+
}
120+
// "/subscriptions/{id}/" will be added in AzureSqlDataSyncCommunicator
114121
this.syncDatabaseId = string.Format("resourceGroups/{0}/providers/Microsoft.Sql/servers/{1}/databases/{2}",
115122
this.SyncDatabaseResourceGroupName, this.SyncDatabaseServerName, this.SyncDatabaseName);
116123
}

0 commit comments

Comments
 (0)