0

I need to deploy Azure Container Instance with VNet connection using Azure CLI. Here's the command I'm using:

az container create -g My_RG --name ubuntu-aci-2 --image ubuntu --vnet /subscriptions/f2ees954-606e-4480-b05f-48c85c8c05cf/resourceGroups/My_RG/providers/Microsoft.Network/virtualNetworks/aci-vnet --subnet default

I'm getting the following error:

Resource /subscriptions/f2ees954-606e-4480-b05f-48c85c8c05cf/resourceGroups/My_RG/providers/Microsoft.Network/virtualNetworks/ACI-VNET referenced by resource /subscriptions/f2ees954-606e-4480-b05f-48c85c8c05cf/resourceGroups/My_RG/providers/Microsoft.Network/networkProfiles/aci-network-profile-aci-vnet-default was not found. Please make sure that the referenced resource exists, and that both resources are in the same region

What am I doing wrong?

// EDIT

The VNET "aci-vnet" and its subdomain "default" already exist before creating the container.

mnj
  • 2,539
  • 3
  • 29
  • 58

1 Answers1

2

You should deploy the container instance in the region that is the same as the Vnet in the region.

Nancy
  • 26,865
  • 3
  • 18
  • 34
  • I don't think this is the case. I am able to successfully deploy the container when using the Azure Portal (with the same settings). – mnj Apr 23 '20 at 09:28
  • 1
    Could you double-check? On the Azure portal, I only could select the VNet in the region which is the same as the region where the container instance will deploy. – Nancy Apr 23 '20 at 10:45
  • Ha, looks like you were right. The thing I missed was the "--location". It looks like by default it was deploying to US East, which a different region that my VNET. – mnj Apr 23 '20 at 11:03