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

cbwuti44  于 2022-12-24  发布在  其他
关注(0)|答案(1)|浏览(91)

我正在尝试使用Azure CLI创建Azure expressroute连接,但API要求的ExpressRoute网关ID与通过门户提供的ExpressRoute网关ID之间似乎存在差异:
门户提供的ER gw id为:

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

然而,蔚蓝色的克利似乎想要:

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

(or至少包含“快速路由网关”)
因此,我们得到了错误:

**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:

我似乎找不到这是一个已知的错误或相关的问题,虽然。

e5njpo68

e5njpo681#

要创建Azure Network快速路由到网关连接,请使用以下脚本。
你可以在门户中获取Azure网关名称,如下所示。

Azure门户〉虚拟网络网关〉选择网关

以下是用于创建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

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

相关问题