Error during adding Virtual Network Peering

Ariful Huq Piyal 96 Reputation points

Hello All,

While adding a peering to one of my test Virtual network peering using azure powershell, I am getting below error:

Add-AzVirtualNetworkPeering: Cannot bind parameter 'VirtualNetwork'. Cannot convert the "/subscriptions/XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/resourceGroups/az104-05-rg1/providers/Microsoft.Network/virtualNetworks/az104-05-vnet0" value of type "System.String" to type "Microsoft.Azure.Commands.Network.Models.PSVirtualNetwork".


Can Anyone help where is the issue?

I am adding screenshot hiding the subscription ID.

Md Ariful Huq

Azure Virtual Network
Azure Virtual Network
An Azure networking service that is used to provision private networks and optionally to connect to on-premises datacenters.
2,138 questions
{count} votes

Accepted answer
  1. Ariful Huq Piyal 96 Reputation points

    I have solved it myself. I t was my mistake and I have changed the variable to this. Now it's going good.

    PS /home/ariful> $vnet1=Get-AzVirtualNetwork -Name 'az104-05-vnet1' -ResourceGroupName 'az104-05-rg1'
    PS /home/ariful> $vnet0=Get-AzVirtualNetwork -Name 'az104-05-vnet0' -ResourceGroupName 'az104-05-rg1'

    0 comments No comments

0 additional answers

Sort by: Most helpful