手臂模板创建动态属性

时间:2019-11-15 22:47:50

标签: azure templates

我正在尝试根据特定参数创建网络接口: 如果参数“ networkSecurityGroupId”存在,我想将其用于networkSecurityGroup,如果不存在,我不希望networkSecurityGroup出现在模板中。最好的方法是什么?我在azure文档中看到可以在没有nsg的情况下创建nic。

多数民众赞成在模板的屏幕截图: {     “ $ schema”:“ https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#”,     “ contentVersion”:“ 1.0.0.0”,     “参数”:{
        “ networkSecurityGroupId”:{             “ type”:“ string”,             “元数据”:{                 “ description”:“网络安全组的资源ID”             }         },                 “ subnetId”:{             “ type”:“ string”,             “元数据”:{                 “ description”:“要与此ONTAP Cloud实例一起使用的子网的资源ID”             }         }         “ marketplaceSKU”:{             “ type”:“ string”,             “元数据”:{                 “ description”:“ Azure Marketplace SKU”。             }             }     },     “资源”:[         {             “ apiVersion”:“ 2017-04-01”,             “ type”:“ Microsoft.Network/networkInterfaces”,             “ name”:“ a”,             “ location”:“ [parameters('location')]”,             “属性”:{                 “ enableAcceleratedNetworking”:是的,                 “ ipConfigurations”:[                     {                         “ name”:“ a1”,                         “属性”:{                             “ privateIPAllocationMethod”:“动态”,                             “子网”:{                                 “ id”:“ [parameters('subnetId')]”                             }                         }                     }                 ],                 “ networkSecurityGroup”:{                     “ id”:“ [parameters('networkSecurityGroupId')]”                 }             }         }     ] }

0 个答案:

没有答案