これはかなり単純ですが、参照しているリソースのIDを指定するだけで済みます。
のは、既存のサブネットを使用したいとしましょう:
"parameters": {
...
"existingVirtualNetworkName": {
"type": "string",
"metadata": {
"description": "Name of the existing VNET"
}
},
"existingVirtualNetworkResourceGroup": {
"type": "string",
"metadata": {
"description": "Name of the existing VNET resource group"
}
},
"subnetName": {
"type": "string",
"metadata": {
"description": "Name of the subnet in the virtual network you want to use"
}
},
...
},
"variables": {
...
"vnetID": "[resourceId(parameters('existingVirtualNetworkResourceGroup'), 'Microsoft.Network/virtualNetworks', parameters('existingVirtualNetworkName'))]",
"subnetRef": "[concat(variables('vnetID'),'/subnets/', parameters('subnetName'))]",
...
}
"resources": [
...
{
"apiVersion": "[variables('api-version')]",
"type": "Microsoft.Network/networkInterfaces",
"name": "[variables('nicName')]",
"location": "[resourceGroup().location]",
"dependsOn": [
"[concat('Microsoft.Network/publicIPAddresses/', variables('publicIPAddressName'))]"
],
"tags": {
"displayName": "NetworkInterface"
},
"properties": {
"ipConfigurations": [{
"name": "ipconfig1",
"properties": {
"privateIPAllocationMethod": "Dynamic",
"publicIPAddress": {
"id": "[resourceId('Microsoft.Network/publicIPAddresses',variables('publicIPAddressName'))]"
},
"subnet": {
"id": "[variables('subnetRef')]"
}
}
}]
}
},
あなたはネットワークセキュリティグループに同じアプローチを使用します。
詳細はこちらをご覧ください。https://github.com/Azure/azure-quickstart-templates/blob/master/201-vm-specialized-vhd-existing-vnet/azuredeploy.json
ありがとうございました!私の既存のVNETがstuartVNETと呼ばれていた場合、 "既存のVNETの名前":{ "タイプ": "文字列"、 "メタデータ":{ "description": "既存のVNETの名前" } (既存のVirtualNetworkName)Azureに既存のリソースを追加するように指示する何らかの種類のキーワードで、記述値の名前と一致するかどうかを指定します。 –
また、 CLIを使用してテンプレートをデプロイするときにexistingVirtualNetworkName、existingVirtualNetworkResourceGroupなどのパラメータを設定します。これらの値を入力するように求められます。たとえば、 'info:次のパラメータの値を設定します' 'existingVirtualNetworkName:' –
1.いいえ、 ARMテンプレートの仕組みを理解しておいてください - 読み込んでください2.はい、すべてのパラメータに値を指定する必要があります展開時に@StuartBrown – 4c74356b41