简体   繁体   English

将VM添加到现有的vnet和子网

[英]Add VM to existing vnet and subnet

I am using a json file to create a VM. 我正在使用json文件创建虚拟机。 Everything works good with exception of the vnet and subnet, every time I created a new VM, it creates a new vnet and subnet, how can I create VMs and assign them to an existing vnet and subnet using a json template? 除了vnet和子网以外,其他所有东西都运行良好,每次创建新的VM时,它都会创建一个新的vnet和子网,如何使用json模板创建VM并将它们分配给现有的vnet和子网?

am assuming by json, you mean an ARM Template. 由json假设,您的意思是一个ARM模板。

you should be able to do that by grabbing a subnet reference to the existing subnet on your existing VNET and then associating your new VM's NIC to the subnet reference you obtained. 您应该能够做到这一点,方法是获取现有VNET上现有子网的子网引用,然后将新VM的NIC与您获得的子网引用关联。 have a look at sample here 这里看看样品

Have you tried below sample template 您是否尝试过以下示例模板

https://github.com/Azure/azure-quickstart-templates/tree/master/201-vm-different-rg-vnet https://github.com/Azure/azure-quickstart-templates/tree/master/201-vm-different-rg-vnet

you should be able to update your ARM template to create your VM into an existing VNet. 您应该能够更新ARM模板以将VM创建到现有VNet中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM