简体   繁体   English

通过 CLI 创建 Azure ExpressRoute 连接:错误:ID 缺少 expressRouteGateways 元素

[英]Creating Azure ExpressRoute Connections via CLI: Error: ID was missing the expressRouteGateways element

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:我正在尝试使用 Azure CLI 创建 azure expressroute 连接,但是 API 所需的 ExpressRoute 网关 ID 与通过门户提供的 ExpressRoute 网关 ID 之间似乎存在差异:

The portal provides the ER gw id as:该门户将 ER gw id 提供为:

"/subscriptions/319b5c03-xxxxxxxxxx/resourceGroups/hk-connectivity-eastasia/providers/Microsoft.Network/virtualNetworkGateways/hk-ergw-eastasia"

However the azure cli seems to want:然而 azure cli 似乎想要:

"/subscriptions/319b5c03-xxxxxxxxxx/resourceGroups/hk-connectivity-eastasia/providers/Microsoft.Network/expressRouteGateways/hk-ergw-eastasia"

(or at least something containing "expressRouteGateways" ) (或至少包含“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.不过,我似乎无法将其视为已知错误或相关问题。

In order to create azure network express route to gateway connection, use below script.为了创建到网关连接的 azure network express 路由,请使用以下脚本。

You can get the Azure Gateway Name in Portal, like below.您可以在 Portal 中获取Azure 网关名称,如下所示。

Azure Portal > Virtual network gateways > Select your Gate Way Azure 门户 > 虚拟网络网关 > 选择您的网关

在此处输入图像描述

Here is the script to create a Azure ExpressRoute Connections这是创建 Azure ExpressRoute 连接的脚本

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

Reference: https://learn.microsoft.com/en-us/cli/azure/network/express-route/gateway/connection?view=azure-cli-latest#az-network-express-route-gateway-connection-create参考: https ://learn.microsoft.com/en-us/cli/azure/network/express-route/gateway/connection?view=azure-cli-latest#az-network-express-route-gateway-connection- 创造

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM