Azure 在具有多个子网的现有 VNET 上创建 VM
Azure creating VM on existing VNET with multiple subnets
我在同一 VNET 中已有多个 VM。当我创建一个尝试使用同一个 VNET 的新 VM 时,出现错误。我不想删除 vnet 中已有的现有子网 (4)。我想要做的就是将一个新的虚拟机添加到已经存在的 vnet 中,并附加一个新的子网。我看过类似的帖子,但 none 展示了如何处理多个现有子网。
这是错误
Subnet Foo2Subnet is in use by /subscriptions/<subid>/resourceGroups/foo-westus2/providers/Microsoft.Network/networkInterfaces/Foo2VMNic/ipConfigurations/Foo2
cannot be deleted. In order to delete the subnet, delete all the resources within the subnet. See aka.ms/deletesubnet.
这是我创建新虚拟机的方式。
'az vm create ' \
'--resource-group {resourceGroupName} ' \
'--name "{serverName}" ' \
'--image "UbuntuLTS" ' \
'--use-unmanaged-disk ' \
'--vnet-name foo2VNET ' \
'--subnet test1' \
'--public-ip-address "" ' \
'--storage-sku Standard_LRS ' \
'--admin-username {user_name} ' \
'--admin-password "{password}" ' \
'--size "{vm_size}" ' \
'--custom-data "" --no-wait'
发生了什么 - az vm create
正在尝试仅使用此子网执行创建 vnet(因此覆盖您现有的 vnet 配置)。您对此无能为力,您可以做的是 precreate the subnet in the vnet,之后您的命令将起作用。
我在同一 VNET 中已有多个 VM。当我创建一个尝试使用同一个 VNET 的新 VM 时,出现错误。我不想删除 vnet 中已有的现有子网 (4)。我想要做的就是将一个新的虚拟机添加到已经存在的 vnet 中,并附加一个新的子网。我看过类似的帖子,但 none 展示了如何处理多个现有子网。
这是错误
Subnet Foo2Subnet is in use by /subscriptions/<subid>/resourceGroups/foo-westus2/providers/Microsoft.Network/networkInterfaces/Foo2VMNic/ipConfigurations/Foo2
cannot be deleted. In order to delete the subnet, delete all the resources within the subnet. See aka.ms/deletesubnet.
这是我创建新虚拟机的方式。
'az vm create ' \
'--resource-group {resourceGroupName} ' \
'--name "{serverName}" ' \
'--image "UbuntuLTS" ' \
'--use-unmanaged-disk ' \
'--vnet-name foo2VNET ' \
'--subnet test1' \
'--public-ip-address "" ' \
'--storage-sku Standard_LRS ' \
'--admin-username {user_name} ' \
'--admin-password "{password}" ' \
'--size "{vm_size}" ' \
'--custom-data "" --no-wait'
发生了什么 - az vm create
正在尝试仅使用此子网执行创建 vnet(因此覆盖您现有的 vnet 配置)。您对此无能为力,您可以做的是 precreate the subnet in the vnet,之后您的命令将起作用。