From 5f90accd1c173b9ef311a0df451ec63d6101f9fa Mon Sep 17 00:00:00 2001 From: alecbain <70780720+alecbain@users.noreply.github.com> Date: Thu, 5 Nov 2020 17:28:38 -0800 Subject: [PATCH 1/3] Fix PartnerServerName check Fix check for PartnerServerName param check to look for string literal instead of value of variable. --- .../Replication/Cmdlet/GetAzureSqlDatabaseReplicationLink.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Sql/Sql/Replication/Cmdlet/GetAzureSqlDatabaseReplicationLink.cs b/src/Sql/Sql/Replication/Cmdlet/GetAzureSqlDatabaseReplicationLink.cs index af92fcbfa7f2..193b0891e6eb 100644 --- a/src/Sql/Sql/Replication/Cmdlet/GetAzureSqlDatabaseReplicationLink.cs +++ b/src/Sql/Sql/Replication/Cmdlet/GetAzureSqlDatabaseReplicationLink.cs @@ -73,7 +73,7 @@ protected override IEnumerable GetEntity() { ICollection results; - if (MyInvocation.BoundParameters.ContainsKey(PartnerServerName) && !WildcardPattern.ContainsWildcardCharacters(PartnerServerName)) + if (MyInvocation.BoundParameters.ContainsKey("PartnerServerName") && !WildcardPattern.ContainsWildcardCharacters(PartnerServerName)) { results = new List(); results.Add(ModelAdapter.GetLink(this.ResourceGroupName, this.ServerName, this.DatabaseName, this.PartnerResourceGroupName, this.PartnerServerName)); From 75bd0ca7e9ae66d3b4fb4635263ae2531e5ba513 Mon Sep 17 00:00:00 2001 From: alecbain <70780720+alecbain@users.noreply.github.com> Date: Thu, 5 Nov 2020 17:31:22 -0800 Subject: [PATCH 2/3] Update ChangeLog.md --- src/Sql/Sql/ChangeLog.md | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Sql/Sql/ChangeLog.md b/src/Sql/Sql/ChangeLog.md index 96d4e23819a9..db1242c1eb63 100644 --- a/src/Sql/Sql/ChangeLog.md +++ b/src/Sql/Sql/ChangeLog.md @@ -20,6 +20,7 @@ ## Upcoming Release * Fixed issues where Set-AzSqlDatabaseAudit were not support Hyperscale database and database edition cannot be determined * Added MaintenanceConfigurationId to 'New-AzSqlInstance' and 'Set-AzSqlInstance' +* Fixed a bug in GetAzureSqlDatabaseReplicationLink.cs where PartnerServerName parameter was being checked for by value instead of key ## Version 2.11.1 * Fixed issue where New-AzSqlDatabaseExport fails if networkIsolation not specified [#13097] From 3f95a21003e18e73a6a9d4522dadcf2109d38655 Mon Sep 17 00:00:00 2001 From: alecbain <70780720+alecbain@users.noreply.github.com> Date: Thu, 5 Nov 2020 22:09:44 -0800 Subject: [PATCH 3/3] Use nameof to avoid magic string Co-authored-by: Yeming Liu --- .../Replication/Cmdlet/GetAzureSqlDatabaseReplicationLink.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Sql/Sql/Replication/Cmdlet/GetAzureSqlDatabaseReplicationLink.cs b/src/Sql/Sql/Replication/Cmdlet/GetAzureSqlDatabaseReplicationLink.cs index 193b0891e6eb..809a8e71e3cd 100644 --- a/src/Sql/Sql/Replication/Cmdlet/GetAzureSqlDatabaseReplicationLink.cs +++ b/src/Sql/Sql/Replication/Cmdlet/GetAzureSqlDatabaseReplicationLink.cs @@ -73,7 +73,7 @@ protected override IEnumerable GetEntity() { ICollection results; - if (MyInvocation.BoundParameters.ContainsKey("PartnerServerName") && !WildcardPattern.ContainsWildcardCharacters(PartnerServerName)) + if (MyInvocation.BoundParameters.ContainsKey(nameof(PartnerServerName)) && !WildcardPattern.ContainsWildcardCharacters(PartnerServerName)) { results = new List(); results.Add(ModelAdapter.GetLink(this.ResourceGroupName, this.ServerName, this.DatabaseName, this.PartnerResourceGroupName, this.PartnerServerName));