Skip to content

az network express-route peering connection create does not work for cross resource group and cross subscription scenario #7596

@dedhar

Description

@dedhar

Describe the bug
currently az network express-route peering connection create assumes that both initiating and peered circuit are from same resource group. The command accepts only name of peer express route circuit and forms the resource id by using resource group and subscription of the circuit initiating connection. This fails when peered circuit is in different resource group or subscription.
The command also fails to accept resource ID as input for peer circuit.
az network express-route peering connection create -g MSIT-ER --circuit-name Perftest --peering-name AzurePrivatePeering -n Perftest2BFD --peer-circuit "/subscriptions/ae4fd9c1-f57f-4077-8cb5-e9c0a1bb8796/resourceGroups/BFD/providers/Microsoft.Network/expressRouteCircuits/BFDTest" --address-prefix 10.83.0.0/29
usage: az network express-route peering connection create [-h] [--verbose]
[--debug]
[--output {json,jsonc,table,tsv,yaml}]
[--query JMESPATH]
--resource-group
RESOURCE_GROUP_NAME
--circuit-name NAME
--peering-name NAME
--name
CONNECTION_NAME
--peer-circuit
PEER_CIRCUIT
--address-prefix
ADDRESS_PREFIX
[--authorization-key AUTHORIZATION_KEY]
[--subscription _SUBSCRIPTION]
az network express-route peering connection create: error: local variable 'peer_id' referenced before assignment

To Reproduce
Create two express route circuits in different subscriptions or same subscription but different resource group.
az network express-route peering connection create -g MSIT-ER --circuit-name Perftest --peering-name AzurePrivatePeering -n Perftest2BFD --peer-circuit BFDTest --address-prefix 10.83.0.0/29

Expected behavior
The command either needs to accept subscription and resource group for peer circuit or enforce passing complete resource ID as done in PowerShell module

Environment summary
https://docs.microsoft.com/en-us/cli/azure/network/express-route/peering/connection?view=azure-cli-latest#az-network-express-route-peering-connection-create

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

Labels

bugThis issue requires a change to an existing behavior in the product in order to be resolved.

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions