Error during adding Virtual Network Peering

Md Ariful Huq 96 Reputation points
2021-07-03T16:32:16.11+00:00

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".

111519-image.png

Can Anyone help where is the issue?

I am adding screenshot hiding the subscription ID.

Thanks
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,311 questions
{count} votes

Accepted answer
  1. Md Ariful Huq 96 Reputation points
    2021-07-03T16:58:47.27+00:00

    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