azure-cli icon indicating copy to clipboard operation
azure-cli copied to clipboard

SDN create NIC problem

Open malopMSFT opened this issue 10 years ago • 2 comments

When using the following command az network nic create

With required fields by documentation

 az network nic create -g "IMDS_Demo" --subnet "Mysubnet" -n "MyNIC"
Referenced resource /subscriptions/23a27f7b-7bd9-4ef6-91f5-9bf25ea00d6a/resourceGroups/IMDS_Demo/providers/Microsoft.Network/virtualNetworks/None/subnets/Mysubnet does not exist. Please create the required resource and try again.

With subnet ID instead

az network nic create -g "IMDS_Demo" --subnet "/subscriptions/23a27f7b-7bd9-4ef6-91f5-9bf25ea00d6a/resourceGroups/IMDS_Demo/providers/Microsoft.Network/virtualNetworks/MyVnet2/subnets/Mysubnet" -n "MyNIC"
At least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/arm-debug for usage details. {
  "error": {
    "code": "InvalidResourceReference",
    "message": "Resource /subscriptions/23a27f7b-7bd9-4ef6-91f5-9bf25ea00d6a/resourceGroups/IMDS_DEMO/providers/Microsoft.Network/virtualNetworks/MYVNET2 referenced by resource /subscriptions/23a27f7b-7bd9-4ef6-91f5-9bf25ea00d6a/resourceGroups/IMDS_Demo/providers/Microsoft.Network/networkInterfaces/MyNIC was not found. Please make sure that the referenced resource exists, and that both resources are in the same region.",
    "details": [
      {
        "code": "NotFound",
        "message": "Resource /subscriptions/23a27f7b-7bd9-4ef6-91f5-9bf25ea00d6a/resourceGroups/IMDS_DEMO/providers/Microsoft.Network/virtualNetworks/MYVNET2 not found."
      }
    ]
  }
}  Correlation ID: 18a90c60-1258-4a63-aad5-18057df8c6c2

With Vnet name

az network nic create -g "IMDS_Demo" -n "MyNIC" --subnet "Mysubnet" --vnet-name "MyVnet2"
At least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/arm-debug for usage details. {
  "error": {
    "code": "InvalidResourceReference",
    "message": "Resource /subscriptions/23a27f7b-7bd9-4ef6-91f5-9bf25ea00d6a/resourceGroups/IMDS_DEMO/providers/Microsoft.Network/virtualNetworks/MYVNET2 referenced by resource /subscriptions/23a27f7b-7bd9-4ef6-91f5-9bf25ea00d6a/resourceGroups/IMDS_Demo/providers/Microsoft.Network/networkInterfaces/MyNIC was not found. Please make sure that the referenced resource exists, and that both resources are in the same region.",
    "details": [
      {
        "code": "NotFound",
        "message": "Resource /subscriptions/23a27f7b-7bd9-4ef6-91f5-9bf25ea00d6a/resourceGroups/IMDS_DEMO/providers/Microsoft.Network/virtualNetworks/MYVNET2 not found."
      }
    ]
  }
}  Correlation ID: 04dc6b21-1fbc-4bf3-9060-11fcdb0d3879

Workaround to make it work location must be provided

az network nic create -g "IMDS_Demo" -n "MyNIC3" --subnet "Mysubnet" --vnet-name "MyVnet2" -l "centralus"
{
  "newNIC": {
    "dnsSettings": {
      "appliedDnsServers": [],
      "dnsServers": []
    },
    "enableIPForwarding": false,
    "ipConfigurations": [
      {
        "etag": "W/\"a17c57d5-3494-4373-80e0-6a9bc85c1566\"",
        "id": "/subscriptions/23a27f7b-7bd9-4ef6-91f5-9bf25ea00d6a/resourceGroups/IMDS_Demo/providers/Microsoft.Network/networkInterfaces/MyNIC3/ipConfigurations/ipconfig1",
        "name": "ipconfig1",
        "properties": {
          "primary": true,
          "privateIPAddress": "10.1.0.5",
          "privateIPAllocationMethod": "Dynamic",
          "provisioningState": "Succeeded",
          "subnet": {
            "id": "/subscriptions/23a27f7b-7bd9-4ef6-91f5-9bf25ea00d6a/resourceGroups/IMDS_Demo/providers/Microsoft.Network/virtualNetworks/MyVnet2/subnets/Mysubnet",
            "resourceGroup": "IMDS_Demo"
          }
        },
        "resourceGroup": "IMDS_Demo"
      }
    ],
    "provisioningState": "Succeeded",
    "resourceGuid": "84408cbd-8a09-4a33-9217-4613e29f2c7a"
  }
}

All previous errors are hard to determinate how to fix/work around them, on the documentation -h please add all required and work on the error descriptions

malopMSFT avatar Nov 04 '16 18:11 malopMSFT

Related to #920.

tjprescott avatar Nov 04 '16 18:11 tjprescott

Moving to Spring 7 as the original fairly trivial fix has become part of a larger refactoring.

tjprescott avatar Nov 15 '16 18:11 tjprescott