我在 Azure 中具有完全权限的管理员运行命令来检索我们正在使用的已部署虚拟网络和子网的网络配置文件 ID,但该命令始终返回空响应:
az network profile list --resource-group myResourceGroup \
--query [0].id --output tsv
有权限,resourceGroup值正确应该是什么情况? 为什么它得到空响应?检索这个值对我们来说非常重要。
输出应包含以下格式的值:
/subscriptions/<Subscription ID>/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkProfiles/aci-network-profile-aci-vnet-aci-subnet
谢谢
最佳答案
您可以验证是否已在该 VNet(而不是仅标准 VNet)中部署 ACI。使用时az network profile , 目前仅支持 Azure 容器实例。
当您首次使用 az container create
命令将容器组部署到子网(以及虚拟网络)时,Azure 会为您创建一个网络配置文件。然后,您可以使用该网络配置文件来将来部署到子网。
例如,如果您在新 VNet 或引用 this 的现有 VNet 中创建容器组.
az container create \
--name appcontainer \
--resource-group myResourceGroup \
--image mcr.microsoft.com/azuredocs/aci-helloworld \
--vnet aci-vnet \
--vnet-address-prefix 10.0.0.0/16 \
--subnet aci-subnet \
--subnet-address-prefix 10.0.0.0/24
然后您将列出该资源组中的网络配置文件。
更新
如果要在现有 VNet 中部署容器,可以使用 --vnet NAME --subnet NAME | 进行部署。 --vnet ID --子网名称| --子网ID
:
az container create --name appcontainer --resource-group nancylab --image mcr.microsoft.com/azuredocs/aci-helloworld --vnet aci-vnet --subnet subnet1
关于Azure - 无法获取 "Network Profile",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65992601/