如何使用 Azure CLI 将 Azure 容器实例部署到 VNET

How to deploy Azure Container Instance to VNET using Azure CLI

我需要使用 Azure CLI 通过 VNet 连接部署 Azure 容器实例。 这是我正在使用的命令:

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

我收到以下错误:

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

我做错了什么?

// 编辑

VNET "aci-vnet" 及其子域 "default" 在创建容器之前已经存在。

您应该将容器实例部署在与该区域中的 Vnet 相同的区域中。