Skip to content

Get-AzSqlDatabaseReplicationLink errors out when not specifying -PartnerServerName #10485

@isra-fel

Description

@isra-fel

Description

One of our customer ran Get-AzSqlDatabaseReplicationLink without specifying -PartnerServerName, he got an error:
PS screenshot

Original issue: #10350

Steps to reproduce

Get-AzSqlDatabaseReplicationLink -ResourceGroupName "rg1" -ServerName "sv1" -DatabaseName "db1" -PartnerResourceGroupName "prg1"

Root cause

https://github.com/Azure/azure-powershell/blob/master/src/Sql/Sql/Replication/Cmdlet/GetAzureSqlDatabaseReplicationLink.cs#L76

if (MyInvocation.BoundParameters.ContainsKey(PartnerServerName) && !WildcardPattern.ContainsWildcardCharacters(PartnerServerName))

ContainsKey(PartnerServerName) should be ContainsKey(nameof(PartnerServerName))

Module versions

Az.Sql 1.15.0 and 2.0.0 both have the issue.

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions