简体   繁体   English

Azure 创建 ARM 模板以在现有 Vnet 和子网中创建 Vm

[英]Azure Create ARM Template To Create Vm In An Existing Vnet and Subnet

I want to deploy VM in the existing vnet and subnet.我想在现有的 vnet 和子网中部署 VM。 Instead of entering vnet and subnet name, can I get the list of vnet available in a Resource Group and make it as a user-selectable, same for subnet.我可以不输入 vnet 和子网名称,而是获取资源组中可用的 vnet 列表并将其设置为用户可选,子网也是如此。

no, this is not possible, you need to do this with powershell, for example, and then pass that as an input to the ARM template.不,这是不可能的,例如,您需要使用 powershell 执行此操作,然后将其作为输入传递给 ARM 模板。 it would something like this:它会是这样的:

$vnets = Get-AzVirtualNetwork
$vnet = $vnets | Out-GridView -PassThru
$subnet = $vnet.subnets | Out-GridView -PassThru
New-AzResourceGroupDeployment -param $subnet.id xxx

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

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