The Resource 'Microsoft.Network/expressRouteGateways/hk-ergw-eastasia' under resource group 'someResourcegroup' was not found.
- Dominant language
- Python
- Stars
- 4.6k
- Forks
- 3.5k
- Avg merge
- 3d 2h
- Merged PRs (30d)
- 60
Description
> ### `az feedback` auto-generates most of the information requested below, as of CLI version 2.0.62
**Related command**
```
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
```
**Describe the bug**
* The resource should accept the ExpressRouteGateway ID as copied from the the properties panel in the Azure Portal, which has the following format:
```
/subscriptions/319b5c03-xxxxxxxxxx/resourceGroups/hk-connectivity-eastasia/providers/Microsoft.Network/virtualNetworkGateways/hk-ergw-eastasia
```
* However, E.R gateway uses the descriptor "virtualNetworkGateways" but the provider is expecting "expressRouteGateways" in the ER Gateway ID:
```
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
```
**To Reproduce**
* Run the following command on an exist ER connection which has not yet been configured with a "connection". Ensure there is an existing Azure ER gateway deployed:
```
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
```
**Expected behavior**
Running the following command with an existing ER Circuit, Gateway and peering established should result in the connection being created:
```
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
```
**Environment summary**
- MacOS:
```
Darwin My-MacBook-Pro.local 21.5.0 Darwin Kernel Version 21.5.0: Tue Apr 26 21:08:22 PDT 2022; root:xnu-8020.121.3~4/RELEASE_X86_64 x86_64
```
- az cli version
```
{
"azure-cli": "2.36.0",
"azure-cli-core": "2.36.0",
"azure-cli-telemetry": "1.0.6",
"extensions": {
"account": "0.2.3",
"aks-preview": "0.5.82",
"azure-firewall": "0.14.3",
"resource-graph": "2.1.0",
"subscription": "0.1.5"
}
}
```
**Additional context**
When attempting the same operation using Terraform, the result is the same. This seems to indicate a problem with either the API or the MS documentation:
```
resource "azurerm_express_route_connection" "hk_caf_level1_network_hub00_expressroute_connection" {
name = format("%s-%s", azurecaf_name.hk_caf_level1_network_hub00_expressroute_circuit_name.result, "connection")
express_route_gateway_id = var.express_route_gateway_id //from hub vnet, therefore obtained from variable because no data source available
express_route_circuit_peering_id = azurerm_express_route_circuit_peering.hk_caf_level1_network_hub00_expressroute_circuit_peering.id
}
```
The expressroute gw id is as follows:
```
variable "express_route_gateway_id" {
type = string
default = "/subscriptions/319b5c03-xxxxxxxxxx/resourceGroups/hk-connectivity-eastasia/providers/Microsoft.Network/virtualNetworkGateways/hk-ergw-eastasia"
}
```
Contributor guide
Assessment
This issue has not been assessed yet.