"Cannot convert the "System.Object[]" valu
e of type "System.Object[]" to type "Microsoft.Azure.Commands.Network.Models.PSSecurityRule"."
Went through this example got above error:
. .\Copy-AzNSGSecurityRules.ps1
PS C:> $nsg1 = Get-AzNetworkSecurityGroup -ResourceGroupName 'rg1' -Name 'nsg1'
PS C:> $nsg2 = Get-AzNetworkSecurityGroup -ResourceGroupName 'rg2' -Name 'nsg2'
PS C:> Copy-AzNSGSecurityRules -SourceNSG $nsg1 -TargetNSG $nsg2
"Cannot convert the "System.Object[]" valu
e of type "System.Object[]" to type "Microsoft.Azure.Commands.Network.Models.PSSecurityRule"."
Went through this example got above error:
. .\Copy-AzNSGSecurityRules.ps1
PS C:> $nsg1 = Get-AzNetworkSecurityGroup -ResourceGroupName 'rg1' -Name 'nsg1'
PS C:> $nsg2 = Get-AzNetworkSecurityGroup -ResourceGroupName 'rg2' -Name 'nsg2'
PS C:> Copy-AzNSGSecurityRules -SourceNSG $nsg1 -TargetNSG $nsg2