【问题标题】:Azure creating VM on existing VNET with multiple subnetsAzure 在具有多个子网的现有 VNET 上创建 VM
【发布时间】:2019-07-25 17:17:29
【问题描述】:

我在同一个 VNET 中已有多个 VM。当我创建一个尝试使用同一个 VNET 的新 VM 时,我收到一个错误。我不想删除 vnet 中已经存在的子网 (4)。我想要做的就是在已经存在的 vnet 中添加一个新的虚拟机,并附加一个新的子网。我看过类似的帖子,但没有一个显示如何处理多个现有子网。

这是错误

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'

【问题讨论】:

    标签: azure azure-virtual-machine azure-virtual-network


    【解决方案1】:

    发生了什么 - az vm create 正在尝试仅使用此子网执行创建 vnet(因此覆盖您现有的 vnet 配置)。对此您无能为力,您可以做的是precreate the subnet in the vnet,之后您的命令将起作用。

    【讨论】:

    • 当我尝试使用 cli az network vnet subnet create -g {resourceGroupName} --vnet-name {vnet} -n {subnet_name} --address-prefixes 10.0.0.0/24' 我得到 Subnet '&lt;subnet&gt;' is not valid in virtual network '&lt;vnet&gt;'.
    • 是的,这就是问题所在。
    猜你喜欢
    • 1970-01-01
    • 2019-03-01
    • 1970-01-01
    • 2016-08-18
    • 1970-01-01
    • 2021-09-07
    • 2015-12-17
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多