Reputation: 846
I'm trying to create an azure expressroute connection using the Azure CLI, however there appears to be a discrepancy between the ExpressRoute Gateway Id as required by the API and the ExpresRoute Gateway ID as provided via the portal:
The portal provides the ER gw id as:
"/subscriptions/319b5c03-xxxxxxxxxx/resourceGroups/hk-connectivity-eastasia/providers/Microsoft.Network/virtualNetworkGateways/hk-ergw-eastasia"
However the azure cli seems to want:
"/subscriptions/319b5c03-xxxxxxxxxx/resourceGroups/hk-connectivity-eastasia/providers/Microsoft.Network/expressRouteGateways/hk-ergw-eastasia"
(or at least something containing "expressRouteGateways" )
So we get the error:
**az network express-route gateway connection create --gateway-name /subscriptions/REDACTED/resourceGroups/hk-connectivity-eastasia/providers/Microsoft.Network/virtualNetworkGateways/hk-ergw-eastasia --name hk-nprd-erc-000 --resource-group hk-connectivity-eastasia --circuit-name er-expressroute-ea-nprd-erc-hub00-net --peering AzurePrivatePeering
ERROR: (ResourceNotFound)
The Resource 'Microsoft.Network/expressRouteGateways/subscriptions'
under resource group 'hk-connectivity-eastasia' was not found. For more details please go to https://aka.ms/ARMResourceNotFoundFix
Code: ResourceNotFound
Message: The Resource 'Microsoft.Network/expressRouteGateways/subscriptions' under resource group 'hk-connectivity-eastasia' was not found. For more details please go to https://aka.ms/ARMResourceNotFoundFix
+ OUT=
+ printf 'connection creation result: \n'
connection creation result:
I can't seem to find this as a known bug or related issue though.
Attempt #2:
CLI:
az network express-route gateway connection create \
--gateway-name hk-ergw-eastasia \
--name hk-nonprod-erconn-000 \
--peering /subscriptions/REDACTED/resourceGroups/hk-connectivity-eastasia/providers/Microsoft.Network/expressRouteCircuits/hk-nonprod/peerings/AzurePrivatePeering \
--resource-group hk-connectivity-eastasia
Result:
++ az network express-route gateway connection create --gateway-name hk-ergw-eastasia --name hk-nonprod-erconn-000 --peering /subscriptions/REDACTED/resourceGroups/hk-connectivity-eastasia/providers/Microsoft.Network/expressRouteCircuits/hk-nonprod/peerings/AzurePrivatePeering --resource-group hk-connectivity-eastasia
ERROR: (ResourceNotFound) The Resource 'Microsoft.Network/expressRouteGateways/hk-ergw-eastasia' under resource group 'hk-connectivity-eastasia' was not found. For more details please go to https://aka.ms/ARMResourceNotFoundFix
Code: ResourceNotFound
Message: The Resource 'Microsoft.Network/expressRouteGateways/hk-ergw-eastasia' under resource group 'hk-connectivity-eastasia' was not found. For more details please go to https://aka.ms/ARMResourceNotFoundFix
Troubleshooting notes:
Upvotes: 1
Views: 384
Reputation: 1083
In order to create azure network express route to gateway connection, use below script.
You can get the Azure Gateway Name in Portal, like below.
Azure Portal > Virtual network gateways > Select your Gate Way
Here is the script to create a Azure ExpressRoute Connections
az network express-route gateway connection create --gateway-name MyGateway --name MyExpressRouteConnection --peering /subscriptions/MySub/resourceGroups/MyResourceGroup/provi ders/Microsoft.Network/expressRouteCircuits/MyCircuit/peerings/AzurePrivatePeering --resource-group MyResourceGroup
Upvotes: 0