azuredeploy.json•34.9 kB
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"metadata": {
"_generator": {
"name": "bicep",
"version": "0.14.6.61914",
"templateHash": "5838866399297439210"
}
},
"parameters": {
"_artifactsLocation": {
"type": "string",
"defaultValue": "[deployment().properties.templateLink.uri]",
"metadata": {
"description": "The base URI where artifacts required by this template are located including a trailing '/'"
}
},
"_artifactsLocationSasToken": {
"type": "securestring",
"defaultValue": "",
"metadata": {
"description": "The sasToken required to access _artifactsLocation. When the template is deployed using the accompanying scripts, a sasToken will be automatically generated. Use the defaultValue if the staging location is not secured."
}
},
"location": {
"type": "string",
"defaultValue": "[resourceGroup().location]",
"metadata": {
"description": "Location for all resources."
}
},
"HostPublicIPAddressName": {
"type": "string",
"defaultValue": "HVHOSTPIP",
"metadata": {
"description": "Resource Name for Public IP address attached to Hyper-V Host"
}
},
"virtualNetworkName": {
"type": "string",
"defaultValue": "VirtualNetwork",
"metadata": {
"description": "Hyper-V Host and Guest VMs Virtual Network"
}
},
"virtualNetworkAddressPrefix": {
"type": "string",
"defaultValue": "10.0.0.0/22",
"metadata": {
"description": "Virtual Network Address Space"
}
},
"NATSubnetName": {
"type": "string",
"defaultValue": "NAT",
"metadata": {
"description": "NAT Subnet Name"
}
},
"NATSubnetPrefix": {
"type": "string",
"defaultValue": "10.0.0.0/24",
"metadata": {
"description": "NAT Subnet Address Space"
}
},
"hyperVSubnetName": {
"type": "string",
"defaultValue": "Hyper-V-LAN",
"metadata": {
"description": "Hyper-V Host Subnet Name"
}
},
"hyperVSubnetPrefix": {
"type": "string",
"defaultValue": "10.0.1.0/24",
"metadata": {
"description": "Hyper-V Host Subnet Address Space"
}
},
"ghostedSubnetName": {
"type": "string",
"defaultValue": "Ghosted",
"metadata": {
"description": "Ghosted Subnet Name"
}
},
"ghostedSubnetPrefix": {
"type": "string",
"defaultValue": "10.0.2.0/24",
"metadata": {
"description": "Ghosted Subnet Address Space"
}
},
"azureVMsSubnetName": {
"type": "string",
"defaultValue": "Azure-VMs",
"metadata": {
"description": "Azure VMs Subnet Name"
}
},
"azureVMsSubnetPrefix": {
"type": "string",
"defaultValue": "10.0.3.0/24",
"metadata": {
"description": "Azure VMs Address Space"
}
},
"HostNetworkInterface1Name": {
"type": "string",
"defaultValue": "HVHOSTNIC1",
"metadata": {
"description": "Hyper-V Host Network Interface 1 Name, attached to NAT Subnet"
}
},
"HostNetworkInterface2Name": {
"type": "string",
"defaultValue": "HVHOSTNIC2",
"metadata": {
"description": "Hyper-V Host Network Interface 2 Name, attached to Hyper-V LAN Subnet"
}
},
"HostVirtualMachineName": {
"type": "string",
"defaultValue": "HVHOST",
"maxLength": 15,
"metadata": {
"description": "Name of Hyper-V Host Virtual Machine, Maximum of 15 characters, use letters and numbers only."
}
},
"HostVirtualMachineSize": {
"type": "string",
"defaultValue": "Standard_D4s_v3",
"allowedValues": [
"Standard_D2_v3",
"Standard_D4_v3",
"Standard_D8_v3",
"Standard_D16_v3",
"Standard_D32_v3",
"Standard_D2s_v3",
"Standard_D4s_v3",
"Standard_D8s_v3",
"Standard_D16s_v3",
"Standard_D32s_v3",
"Standard_D64_v3",
"Standard_E2_v3",
"Standard_E4_v3",
"Standard_E8_v3",
"Standard_E16_v3",
"Standard_E32_v3",
"Standard_E64_v3",
"Standard_D64s_v3",
"Standard_E2s_v3",
"Standard_E4s_v3",
"Standard_E8s_v3",
"Standard_E16s_v3",
"Standard_E32s_v3",
"Standard_E64s_v3"
],
"metadata": {
"description": "Size of the Host Virtual Machine"
}
},
"HostAdminUsername": {
"type": "string",
"metadata": {
"description": "Admin Username for the Host Virtual Machine"
}
},
"HostAdminPassword": {
"type": "securestring",
"metadata": {
"description": "Admin User Password for the Host Virtual Machine"
}
}
},
"variables": {
"NATSubnetNSGName": "[format('{0}NSG', parameters('NATSubnetName'))]",
"hyperVSubnetNSGName": "[format('{0}NSG', parameters('hyperVSubnetName'))]",
"ghostedSubnetNSGName": "[format('{0}NSG', parameters('ghostedSubnetName'))]",
"azureVMsSubnetNSGName": "[format('{0}NSG', parameters('azureVMsSubnetName'))]",
"azureVMsSubnetUDRName": "[format('{0}UDR', parameters('azureVMsSubnetName'))]",
"DSCInstallWindowsFeaturesUri": "[uri(parameters('_artifactsLocation'), format('dsc/dscinstallwindowsfeatures.zip{0}', parameters('_artifactsLocationSasToken')))]",
"HVHostSetupScriptUri": "[uri(parameters('_artifactsLocation'), format('hvhostsetup.ps1{0}', parameters('_artifactsLocationSasToken')))]"
},
"resources": [
{
"type": "Microsoft.Network/publicIPAddresses",
"apiVersion": "2021-02-01",
"name": "[parameters('HostPublicIPAddressName')]",
"location": "[parameters('location')]",
"sku": {
"name": "Basic"
},
"properties": {
"publicIPAllocationMethod": "Dynamic",
"dnsSettings": {
"domainNameLabel": "[toLower(format('{0}-{1}', parameters('HostVirtualMachineName'), uniqueString(resourceGroup().id)))]"
}
}
},
{
"type": "Microsoft.Network/networkSecurityGroups",
"apiVersion": "2021-02-01",
"name": "[variables('NATSubnetNSGName')]",
"location": "[parameters('location')]",
"properties": {}
},
{
"type": "Microsoft.Network/networkSecurityGroups",
"apiVersion": "2021-02-01",
"name": "[variables('hyperVSubnetNSGName')]",
"location": "[parameters('location')]",
"properties": {}
},
{
"type": "Microsoft.Network/networkSecurityGroups",
"apiVersion": "2021-02-01",
"name": "[variables('ghostedSubnetNSGName')]",
"location": "[parameters('location')]",
"properties": {}
},
{
"type": "Microsoft.Network/networkSecurityGroups",
"apiVersion": "2021-02-01",
"name": "[variables('azureVMsSubnetNSGName')]",
"location": "[parameters('location')]",
"properties": {}
},
{
"type": "Microsoft.Network/virtualNetworks",
"apiVersion": "2021-02-01",
"name": "[parameters('virtualNetworkName')]",
"location": "[parameters('location')]",
"properties": {
"addressSpace": {
"addressPrefixes": [
"[parameters('virtualNetworkAddressPrefix')]"
]
},
"subnets": [
{
"name": "[parameters('NATSubnetName')]",
"properties": {
"addressPrefix": "[parameters('NATSubnetPrefix')]",
"networkSecurityGroup": {
"id": "[resourceId('Microsoft.Network/networkSecurityGroups', variables('NATSubnetNSGName'))]"
}
}
},
{
"name": "[parameters('hyperVSubnetName')]",
"properties": {
"addressPrefix": "[parameters('hyperVSubnetPrefix')]",
"networkSecurityGroup": {
"id": "[resourceId('Microsoft.Network/networkSecurityGroups', variables('hyperVSubnetNSGName'))]"
}
}
},
{
"name": "[parameters('ghostedSubnetName')]",
"properties": {
"addressPrefix": "[parameters('ghostedSubnetPrefix')]",
"networkSecurityGroup": {
"id": "[resourceId('Microsoft.Network/networkSecurityGroups', variables('ghostedSubnetNSGName'))]"
}
}
},
{
"name": "[parameters('azureVMsSubnetName')]",
"properties": {
"addressPrefix": "[parameters('azureVMsSubnetPrefix')]",
"networkSecurityGroup": {
"id": "[resourceId('Microsoft.Network/networkSecurityGroups', variables('azureVMsSubnetNSGName'))]"
},
"routeTable": {
"id": "[reference(resourceId('Microsoft.Resources/deployments', 'udrDeploy'), '2020-10-01').outputs.udrId.value]"
}
}
}
]
},
"dependsOn": [
"[resourceId('Microsoft.Network/networkSecurityGroups', variables('azureVMsSubnetNSGName'))]",
"[resourceId('Microsoft.Resources/deployments', 'udrDeploy')]",
"[resourceId('Microsoft.Network/networkSecurityGroups', variables('ghostedSubnetNSGName'))]",
"[resourceId('Microsoft.Network/networkSecurityGroups', variables('hyperVSubnetNSGName'))]",
"[resourceId('Microsoft.Network/networkSecurityGroups', variables('NATSubnetNSGName'))]"
]
},
{
"type": "Microsoft.Compute/virtualMachines",
"apiVersion": "2021-03-01",
"name": "[parameters('HostVirtualMachineName')]",
"location": "[parameters('location')]",
"properties": {
"hardwareProfile": {
"vmSize": "[parameters('HostVirtualMachineSize')]"
},
"storageProfile": {
"imageReference": {
"publisher": "MicrosoftWindowsServer",
"offer": "WindowsServer",
"sku": "2016-Datacenter",
"version": "latest"
},
"osDisk": {
"name": "[format('{0}OsDisk', parameters('HostVirtualMachineName'))]",
"createOption": "FromImage",
"managedDisk": {
"storageAccountType": "Premium_LRS"
},
"caching": "ReadWrite"
},
"dataDisks": [
{
"lun": 0,
"name": "[format('{0}DataDisk1', parameters('HostVirtualMachineName'))]",
"createOption": "Empty",
"diskSizeGB": 1024,
"caching": "ReadOnly",
"managedDisk": {
"storageAccountType": "Premium_LRS"
}
}
]
},
"osProfile": {
"computerName": "[parameters('HostVirtualMachineName')]",
"adminUsername": "[parameters('HostAdminUsername')]",
"adminPassword": "[parameters('HostAdminPassword')]"
},
"networkProfile": {
"networkInterfaces": [
{
"id": "[reference(resourceId('Microsoft.Resources/deployments', 'createNic1'), '2020-10-01').outputs.nicId.value]",
"properties": {
"primary": true
}
},
{
"id": "[reference(resourceId('Microsoft.Resources/deployments', 'createNic2'), '2020-10-01').outputs.nicId.value]",
"properties": {
"primary": false
}
}
]
}
},
"dependsOn": [
"[resourceId('Microsoft.Resources/deployments', 'createNic1')]",
"[resourceId('Microsoft.Resources/deployments', 'createNic2')]"
]
},
{
"type": "Microsoft.Compute/virtualMachines/extensions",
"apiVersion": "2021-03-01",
"name": "[format('{0}/{1}', parameters('HostVirtualMachineName'), 'InstallWindowsFeatures')]",
"location": "[parameters('location')]",
"properties": {
"publisher": "Microsoft.Powershell",
"type": "DSC",
"typeHandlerVersion": "2.77",
"autoUpgradeMinorVersion": true,
"settings": {
"wmfVersion": "latest",
"configuration": {
"url": "[variables('DSCInstallWindowsFeaturesUri')]",
"script": "DSCInstallWindowsFeatures.ps1",
"function": "InstallWindowsFeatures"
}
}
},
"dependsOn": [
"[resourceId('Microsoft.Compute/virtualMachines', parameters('HostVirtualMachineName'))]"
]
},
{
"type": "Microsoft.Compute/virtualMachines/extensions",
"apiVersion": "2021-03-01",
"name": "[format('{0}/{1}', parameters('HostVirtualMachineName'), 'HVHOSTSetup')]",
"location": "[parameters('location')]",
"properties": {
"publisher": "Microsoft.Compute",
"type": "CustomScriptExtension",
"typeHandlerVersion": "1.9",
"autoUpgradeMinorVersion": true,
"settings": {
"fileUris": [
"[variables('HVHostSetupScriptUri')]"
],
"commandToExecute": "[format('powershell -ExecutionPolicy Unrestricted -File HVHostSetup.ps1 -NIC1IPAddress {0} -NIC2IPAddress {1} -GhostedSubnetPrefix {2} -VirtualNetworkPrefix {3}', reference(resourceId('Microsoft.Resources/deployments', 'createNic1'), '2020-10-01').outputs.assignedIp.value, reference(resourceId('Microsoft.Resources/deployments', 'createNic2'), '2020-10-01').outputs.assignedIp.value, parameters('ghostedSubnetPrefix'), parameters('virtualNetworkAddressPrefix'))]"
}
},
"dependsOn": [
"[resourceId('Microsoft.Resources/deployments', 'createNic1')]",
"[resourceId('Microsoft.Resources/deployments', 'createNic2')]",
"[resourceId('Microsoft.Compute/virtualMachines', parameters('HostVirtualMachineName'))]",
"[resourceId('Microsoft.Compute/virtualMachines/extensions', parameters('HostVirtualMachineName'), 'InstallWindowsFeatures')]"
]
},
{
"type": "Microsoft.Resources/deployments",
"apiVersion": "2020-10-01",
"name": "createNic1",
"properties": {
"expressionEvaluationOptions": {
"scope": "inner"
},
"mode": "Incremental",
"parameters": {
"location": {
"value": "[parameters('location')]"
},
"nicName": {
"value": "[parameters('HostNetworkInterface1Name')]"
},
"subnetId": {
"value": "[format('{0}/subnets/{1}', resourceId('Microsoft.Network/virtualNetworks', parameters('virtualNetworkName')), parameters('NATSubnetName'))]"
},
"pipId": {
"value": "[resourceId('Microsoft.Network/publicIPAddresses', parameters('HostPublicIPAddressName'))]"
}
},
"template": {
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"metadata": {
"_generator": {
"name": "bicep",
"version": "0.14.6.61914",
"templateHash": "16183731589303102049"
}
},
"parameters": {
"nicName": {
"type": "string"
},
"location": {
"type": "string"
},
"subnetId": {
"type": "string"
},
"pipId": {
"type": "string",
"defaultValue": ""
},
"ipAllocationMethod": {
"type": "string",
"defaultValue": "Dynamic",
"allowedValues": [
"Dynamic",
"Static"
]
},
"staticIpAddress": {
"type": "string",
"defaultValue": ""
},
"enableIPForwarding": {
"type": "bool",
"defaultValue": false
}
},
"resources": [
{
"type": "Microsoft.Network/networkInterfaces",
"apiVersion": "2020-06-01",
"name": "[parameters('nicName')]",
"location": "[parameters('location')]",
"properties": {
"ipConfigurations": [
{
"name": "ipconfig",
"properties": {
"primary": true,
"privateIPAllocationMethod": "[parameters('ipAllocationMethod')]",
"privateIPAddress": "[parameters('staticIpAddress')]",
"subnet": {
"id": "[parameters('subnetId')]"
},
"publicIPAddress": "[if(equals(parameters('pipId'), ''), null(), createObject('id', parameters('pipId')))]"
}
}
],
"enableIPForwarding": "[parameters('enableIPForwarding')]"
}
}
],
"outputs": {
"nicId": {
"type": "string",
"value": "[resourceId('Microsoft.Network/networkInterfaces', parameters('nicName'))]"
},
"assignedIp": {
"type": "string",
"value": "[reference(resourceId('Microsoft.Network/networkInterfaces', parameters('nicName')), '2020-06-01').ipConfigurations[0].properties.privateIPAddress]"
}
}
}
},
"dependsOn": [
"[resourceId('Microsoft.Network/publicIPAddresses', parameters('HostPublicIPAddressName'))]",
"[resourceId('Microsoft.Network/virtualNetworks', parameters('virtualNetworkName'))]"
]
},
{
"type": "Microsoft.Resources/deployments",
"apiVersion": "2020-10-01",
"name": "createNic2",
"properties": {
"expressionEvaluationOptions": {
"scope": "inner"
},
"mode": "Incremental",
"parameters": {
"location": {
"value": "[parameters('location')]"
},
"nicName": {
"value": "[parameters('HostNetworkInterface2Name')]"
},
"enableIPForwarding": {
"value": true
},
"subnetId": {
"value": "[format('{0}/subnets/{1}', resourceId('Microsoft.Network/virtualNetworks', parameters('virtualNetworkName')), parameters('hyperVSubnetName'))]"
}
},
"template": {
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"metadata": {
"_generator": {
"name": "bicep",
"version": "0.14.6.61914",
"templateHash": "16183731589303102049"
}
},
"parameters": {
"nicName": {
"type": "string"
},
"location": {
"type": "string"
},
"subnetId": {
"type": "string"
},
"pipId": {
"type": "string",
"defaultValue": ""
},
"ipAllocationMethod": {
"type": "string",
"defaultValue": "Dynamic",
"allowedValues": [
"Dynamic",
"Static"
]
},
"staticIpAddress": {
"type": "string",
"defaultValue": ""
},
"enableIPForwarding": {
"type": "bool",
"defaultValue": false
}
},
"resources": [
{
"type": "Microsoft.Network/networkInterfaces",
"apiVersion": "2020-06-01",
"name": "[parameters('nicName')]",
"location": "[parameters('location')]",
"properties": {
"ipConfigurations": [
{
"name": "ipconfig",
"properties": {
"primary": true,
"privateIPAllocationMethod": "[parameters('ipAllocationMethod')]",
"privateIPAddress": "[parameters('staticIpAddress')]",
"subnet": {
"id": "[parameters('subnetId')]"
},
"publicIPAddress": "[if(equals(parameters('pipId'), ''), null(), createObject('id', parameters('pipId')))]"
}
}
],
"enableIPForwarding": "[parameters('enableIPForwarding')]"
}
}
],
"outputs": {
"nicId": {
"type": "string",
"value": "[resourceId('Microsoft.Network/networkInterfaces', parameters('nicName'))]"
},
"assignedIp": {
"type": "string",
"value": "[reference(resourceId('Microsoft.Network/networkInterfaces', parameters('nicName')), '2020-06-01').ipConfigurations[0].properties.privateIPAddress]"
}
}
}
},
"dependsOn": [
"[resourceId('Microsoft.Network/virtualNetworks', parameters('virtualNetworkName'))]"
]
},
{
"type": "Microsoft.Resources/deployments",
"apiVersion": "2020-10-01",
"name": "updateNic1",
"properties": {
"expressionEvaluationOptions": {
"scope": "inner"
},
"mode": "Incremental",
"parameters": {
"location": {
"value": "[parameters('location')]"
},
"ipAllocationMethod": {
"value": "Static"
},
"staticIpAddress": {
"value": "[reference(resourceId('Microsoft.Resources/deployments', 'createNic1'), '2020-10-01').outputs.assignedIp.value]"
},
"nicName": {
"value": "[parameters('HostNetworkInterface1Name')]"
},
"subnetId": {
"value": "[format('{0}/subnets/{1}', resourceId('Microsoft.Network/virtualNetworks', parameters('virtualNetworkName')), parameters('NATSubnetName'))]"
},
"pipId": {
"value": "[resourceId('Microsoft.Network/publicIPAddresses', parameters('HostPublicIPAddressName'))]"
}
},
"template": {
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"metadata": {
"_generator": {
"name": "bicep",
"version": "0.14.6.61914",
"templateHash": "16183731589303102049"
}
},
"parameters": {
"nicName": {
"type": "string"
},
"location": {
"type": "string"
},
"subnetId": {
"type": "string"
},
"pipId": {
"type": "string",
"defaultValue": ""
},
"ipAllocationMethod": {
"type": "string",
"defaultValue": "Dynamic",
"allowedValues": [
"Dynamic",
"Static"
]
},
"staticIpAddress": {
"type": "string",
"defaultValue": ""
},
"enableIPForwarding": {
"type": "bool",
"defaultValue": false
}
},
"resources": [
{
"type": "Microsoft.Network/networkInterfaces",
"apiVersion": "2020-06-01",
"name": "[parameters('nicName')]",
"location": "[parameters('location')]",
"properties": {
"ipConfigurations": [
{
"name": "ipconfig",
"properties": {
"primary": true,
"privateIPAllocationMethod": "[parameters('ipAllocationMethod')]",
"privateIPAddress": "[parameters('staticIpAddress')]",
"subnet": {
"id": "[parameters('subnetId')]"
},
"publicIPAddress": "[if(equals(parameters('pipId'), ''), null(), createObject('id', parameters('pipId')))]"
}
}
],
"enableIPForwarding": "[parameters('enableIPForwarding')]"
}
}
],
"outputs": {
"nicId": {
"type": "string",
"value": "[resourceId('Microsoft.Network/networkInterfaces', parameters('nicName'))]"
},
"assignedIp": {
"type": "string",
"value": "[reference(resourceId('Microsoft.Network/networkInterfaces', parameters('nicName')), '2020-06-01').ipConfigurations[0].properties.privateIPAddress]"
}
}
}
},
"dependsOn": [
"[resourceId('Microsoft.Resources/deployments', 'createNic1')]",
"[resourceId('Microsoft.Network/publicIPAddresses', parameters('HostPublicIPAddressName'))]",
"[resourceId('Microsoft.Network/virtualNetworks', parameters('virtualNetworkName'))]"
]
},
{
"type": "Microsoft.Resources/deployments",
"apiVersion": "2020-10-01",
"name": "updateNic2",
"properties": {
"expressionEvaluationOptions": {
"scope": "inner"
},
"mode": "Incremental",
"parameters": {
"location": {
"value": "[parameters('location')]"
},
"ipAllocationMethod": {
"value": "Static"
},
"staticIpAddress": {
"value": "[reference(resourceId('Microsoft.Resources/deployments', 'createNic2'), '2020-10-01').outputs.assignedIp.value]"
},
"nicName": {
"value": "[parameters('HostNetworkInterface2Name')]"
},
"enableIPForwarding": {
"value": true
},
"subnetId": {
"value": "[format('{0}/subnets/{1}', resourceId('Microsoft.Network/virtualNetworks', parameters('virtualNetworkName')), parameters('hyperVSubnetName'))]"
}
},
"template": {
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"metadata": {
"_generator": {
"name": "bicep",
"version": "0.14.6.61914",
"templateHash": "16183731589303102049"
}
},
"parameters": {
"nicName": {
"type": "string"
},
"location": {
"type": "string"
},
"subnetId": {
"type": "string"
},
"pipId": {
"type": "string",
"defaultValue": ""
},
"ipAllocationMethod": {
"type": "string",
"defaultValue": "Dynamic",
"allowedValues": [
"Dynamic",
"Static"
]
},
"staticIpAddress": {
"type": "string",
"defaultValue": ""
},
"enableIPForwarding": {
"type": "bool",
"defaultValue": false
}
},
"resources": [
{
"type": "Microsoft.Network/networkInterfaces",
"apiVersion": "2020-06-01",
"name": "[parameters('nicName')]",
"location": "[parameters('location')]",
"properties": {
"ipConfigurations": [
{
"name": "ipconfig",
"properties": {
"primary": true,
"privateIPAllocationMethod": "[parameters('ipAllocationMethod')]",
"privateIPAddress": "[parameters('staticIpAddress')]",
"subnet": {
"id": "[parameters('subnetId')]"
},
"publicIPAddress": "[if(equals(parameters('pipId'), ''), null(), createObject('id', parameters('pipId')))]"
}
}
],
"enableIPForwarding": "[parameters('enableIPForwarding')]"
}
}
],
"outputs": {
"nicId": {
"type": "string",
"value": "[resourceId('Microsoft.Network/networkInterfaces', parameters('nicName'))]"
},
"assignedIp": {
"type": "string",
"value": "[reference(resourceId('Microsoft.Network/networkInterfaces', parameters('nicName')), '2020-06-01').ipConfigurations[0].properties.privateIPAddress]"
}
}
}
},
"dependsOn": [
"[resourceId('Microsoft.Resources/deployments', 'createNic2')]",
"[resourceId('Microsoft.Network/virtualNetworks', parameters('virtualNetworkName'))]"
]
},
{
"type": "Microsoft.Resources/deployments",
"apiVersion": "2020-10-01",
"name": "udrDeploy",
"properties": {
"expressionEvaluationOptions": {
"scope": "inner"
},
"mode": "Incremental",
"parameters": {
"location": {
"value": "[parameters('location')]"
},
"udrName": {
"value": "[variables('azureVMsSubnetUDRName')]"
}
},
"template": {
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"metadata": {
"_generator": {
"name": "bicep",
"version": "0.14.6.61914",
"templateHash": "17425263381365403251"
}
},
"parameters": {
"udrName": {
"type": "string"
},
"location": {
"type": "string"
},
"addressPrefix": {
"type": "string",
"defaultValue": ""
},
"nextHopAddress": {
"type": "string",
"defaultValue": ""
}
},
"resources": [
{
"type": "Microsoft.Network/routeTables",
"apiVersion": "2020-06-01",
"name": "[parameters('udrName')]",
"location": "[parameters('location')]",
"properties": {
"routes": "[if(equals(parameters('addressPrefix'), ''), null(), createArray(createObject('name', 'Nested-VMs', 'properties', createObject('addressPrefix', parameters('addressPrefix'), 'nextHopType', 'VirtualAppliance', 'nextHopIpAddress', parameters('nextHopAddress')))))]"
}
}
],
"outputs": {
"udrId": {
"type": "string",
"value": "[resourceId('Microsoft.Network/routeTables', parameters('udrName'))]"
}
}
}
}
},
{
"type": "Microsoft.Resources/deployments",
"apiVersion": "2020-10-01",
"name": "udrUpdate",
"properties": {
"expressionEvaluationOptions": {
"scope": "inner"
},
"mode": "Incremental",
"parameters": {
"location": {
"value": "[parameters('location')]"
},
"udrName": {
"value": "[variables('azureVMsSubnetUDRName')]"
},
"addressPrefix": {
"value": "[parameters('ghostedSubnetPrefix')]"
},
"nextHopAddress": {
"value": "[reference(resourceId('Microsoft.Resources/deployments', 'createNic2'), '2020-10-01').outputs.assignedIp.value]"
}
},
"template": {
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"metadata": {
"_generator": {
"name": "bicep",
"version": "0.14.6.61914",
"templateHash": "17425263381365403251"
}
},
"parameters": {
"udrName": {
"type": "string"
},
"location": {
"type": "string"
},
"addressPrefix": {
"type": "string",
"defaultValue": ""
},
"nextHopAddress": {
"type": "string",
"defaultValue": ""
}
},
"resources": [
{
"type": "Microsoft.Network/routeTables",
"apiVersion": "2020-06-01",
"name": "[parameters('udrName')]",
"location": "[parameters('location')]",
"properties": {
"routes": "[if(equals(parameters('addressPrefix'), ''), null(), createArray(createObject('name', 'Nested-VMs', 'properties', createObject('addressPrefix', parameters('addressPrefix'), 'nextHopType', 'VirtualAppliance', 'nextHopIpAddress', parameters('nextHopAddress')))))]"
}
}
],
"outputs": {
"udrId": {
"type": "string",
"value": "[resourceId('Microsoft.Network/routeTables', parameters('udrName'))]"
}
}
}
},
"dependsOn": [
"[resourceId('Microsoft.Resources/deployments', 'createNic2')]"
]
}
]
}