Permalink
Branch: master
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
212 lines (211 sloc) 7.16 KB
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"hypervHostDnsName": {
"type": "string",
"defaultValue": "hypervhostupdateme",
"minLength": 1
},
"HyperVHostAdminUserName": {
"type": "string",
"defaultValue": "rootadmin",
"minLength": 1
},
"HyperVHostAdminPassword": {
"type": "string",
"defaultValue": "pass@123demo",
"minLength": 1
}
},
"variables": {
"OnPremVNETPrefix": "10.0.0.0/16",
"OnPremVNETSubnet1Name": "VMHOST",
"OnPremVNETSubnet1Prefix": "10.0.0.0/24",
"HyperVHostName": "HYPERVHOST",
"HyperVHostImagePublisher": "MicrosoftWindowsServer",
"HyperVHostImageOffer": "WindowsServer",
"HyperVHostWindowsOSVersion": "2016-Datacenter",
"HyperVHostOSDiskName": "[concat(variables('HyperVHostName'), '-OSDISK')]",
"HyperVHostVmSize": "Standard_E4s_v3",
"HyperVHostVnetID": "[resourceId('Microsoft.Network/virtualNetworks', 'OnPremVNET')]",
"HyperVHostSubnetRef": "[concat(variables('HyperVHostVnetID'), '/subnets/', variables('OnPremVNETSubnet1Name'))]",
"HyperVHostNicName": "[concat(variables('HyperVHostName'), '-NIC')]",
"HyperVHost-PUBIPName": "[concat(variables('HyperVHostName'), '-PIP')]",
"HyperVHostConfigArchiveFolder": ".",
"HyperVHostConfigArchiveFileName": "HyperVHostConfig.zip",
"HyperVHostConfigURL": "https://github.com/weeyin83/Lab-Deployment-in-Azure/blob/master/HyperVHostConfig.zip?raw=true",
"HyperVHostInstallHyperVScriptFolder": ".",
"HyperVHostInstallHyperVScriptFileName": "InstallHyperV.ps1",
"HyperVHostInstallHyperVURL": "https://raw.githubusercontent.com/weeyin83/Lab-Deployment-in-Azure/master/InstallHyperV.ps1"
},
"resources": [
{
"name": "OnPremVNET",
"type": "Microsoft.Network/virtualNetworks",
"location": "[resourceGroup().location]",
"apiVersion": "2018-12-01",
"dependsOn": [],
"tags": {
"displayName": "OnPremVNET"
},
"properties": {
"addressSpace": {
"addressPrefixes": [
"[variables('OnPremVNETPrefix')]"
]
},
"subnets": [
{
"name": "[variables('OnPremVNETSubnet1Name')]",
"properties": {
"addressPrefix": "[variables('OnPremVNETSubnet1Prefix')]"
}
}
]
}
},
{
"name": "[variables('HyperVHost-PUBIPName')]",
"type": "Microsoft.Network/publicIPAddresses",
"location": "[resourceGroup().location]",
"apiVersion": "2018-12-01",
"dependsOn": [],
"tags": {
"displayName": "HyperVHost-PUBIP"
},
"properties": {
"publicIPAllocationMethod": "Dynamic",
"dnsSettings": {
"domainNameLabel": "[parameters('hypervHostDnsName')]"
}
}
},
{
"name": "[variables('HyperVHostNicName')]",
"type": "Microsoft.Network/networkInterfaces",
"location": "[resourceGroup().location]",
"apiVersion": "2018-12-01",
"dependsOn": [
"[resourceId('Microsoft.Network/virtualNetworks', 'OnPremVNET')]",
"[resourceId('Microsoft.Network/publicIPAddresses', variables('HyperVHost-PUBIPName'))]"
],
"tags": {
"displayName": "HyperVHostNic"
},
"properties": {
"ipConfigurations": [
{
"name": "ipconfig1",
"properties": {
"privateIPAllocationMethod": "Dynamic",
"subnet": {
"id": "[variables('HyperVHostSubnetRef')]"
},
"publicIPAddress": {
"id": "[resourceId('Microsoft.Network/publicIPAddresses', variables('HyperVHost-PUBIPName'))]"
}
}
}
]
}
},
{
"name": "[variables('HyperVHostName')]",
"type": "Microsoft.Compute/virtualMachines",
"location": "[resourceGroup().location]",
"apiVersion": "2018-10-01",
"dependsOn": [
"[resourceId('Microsoft.Network/networkInterfaces', variables('HyperVHostNicName'))]"
],
"tags": {
"displayName": "HyperVHost"
},
"properties": {
"hardwareProfile": {
"vmSize": "[variables('HyperVHostVmSize')]"
},
"osProfile": {
"computerName": "[variables('HyperVHostName')]",
"adminUsername": "[parameters('HyperVHostAdminUsername')]",
"adminPassword": "[parameters('HyperVHostAdminPassword')]"
},
"storageProfile": {
"imageReference": {
"publisher": "[variables('HyperVHostImagePublisher')]",
"offer": "[variables('HyperVHostImageOffer')]",
"sku": "[variables('HyperVHostWindowsOSVersion')]",
"version": "latest"
},
"osDisk": {
"createOption": "FromImage",
"diskSizeGB": 500
}
},
"networkProfile": {
"networkInterfaces": [
{
"id": "[resourceId('Microsoft.Network/networkInterfaces', variables('HyperVHostNicName'))]"
}
]
}
},
"resources": [
{
"name": "InstallHyperV",
"type": "extensions",
"location": "[resourceGroup().location]",
"apiVersion": "2017-12-01",
"dependsOn": [
"[resourceId('Microsoft.Compute/virtualMachines', variables('HyperVHostName'))]"
],
"tags": {
"displayName": "Install Hyper-V"
},
"properties": {
"publisher": "Microsoft.Compute",
"type": "CustomScriptExtension",
"typeHandlerVersion": "1.4",
"autoUpgradeMinorVersion": true,
"settings": {
"fileUris": [
"[variables('HyperVHostInstallHyperVURL')]"
],
"commandToExecute": "[concat('powershell -ExecutionPolicy Unrestricted -File ', variables('HyperVHostInstallHyperVScriptFolder'), '/', variables('HyperVHostInstallHyperVScriptFileName'))]"
}
}
},
{
"name": "HyperVHostConfig",
"type": "extensions",
"location": "[resourceGroup().location]",
"apiVersion": "2017-12-01",
"dependsOn": [
"[resourceId('Microsoft.Compute/virtualMachines', variables('HyperVHostName'))]",
"[resourceId('Microsoft.Compute/virtualMachines/extensions', variables('HyperVHostName'), 'InstallHyperV')]"
],
"tags": {
"displayName": "HyperVHostConfig"
},
"properties": {
"publisher": "Microsoft.Powershell",
"type": "DSC",
"typeHandlerVersion": "2.9",
"autoUpgradeMinorVersion": true,
"settings": {
"configuration": {
"url": "[concat(variables('HyperVHostConfigURL'))]",
"script": "HyperVHostConfig.ps1",
"function": "Main"
},
"configurationArguments": {
"nodeName": "[variables('HyperVHostName')]"
}
}
}
}
]
}
],
"outputs": {}
}