359 строки
13 KiB
JSON
359 строки
13 KiB
JSON
{
|
|
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
|
|
"contentVersion": "1.0.0.0",
|
|
"apiProfile": "2018-03-01-hybrid",
|
|
"parameters": {
|
|
"adminUsername": {
|
|
"type": "string",
|
|
"metadata": {
|
|
"description": "The name of the Administrator of the new VMs"
|
|
},
|
|
"defaultValue": "vmadmin"
|
|
},
|
|
"adminPassword": {
|
|
"type": "securestring",
|
|
"metadata": {
|
|
"description": "The password for the Administrator account of the new VMs. Default value is subscription id"
|
|
},
|
|
"defaultValue": "[concat('Subscription#',subscription().subscriptionId)]"
|
|
},
|
|
"windowsImageSKU": {
|
|
"type": "string",
|
|
"defaultValue": "2016-Datacenter",
|
|
"allowedValues": [
|
|
"2012-R2-Datacenter",
|
|
"2016-Datacenter-Server-Core",
|
|
"2016-Datacenter"
|
|
],
|
|
"metadata": {
|
|
"description": "The Windows version for the VM. This will pick a fully patched image of this given Windows version. Allowed values: 2008-R2-SP1, 2012-Datacenter, 2012-R2-Datacenter, 2016-Datacenter."
|
|
}
|
|
}
|
|
},
|
|
"variables": {
|
|
"storageAccountType": "Standard_LRS",
|
|
"vmName": "[tolower(concat('vm', resourceGroup().name))]",
|
|
"VMSize": "Standard_A3",
|
|
"dnsPrefix": "[tolower(concat('vmdns', resourceGroup().name))]",
|
|
"vmNetworkSubnet": "10.0.0.0/24",
|
|
"virtualNetworkAddressRange": "10.0.0.0/16",
|
|
"windowsImagePublisher": "MicrosoftWindowsServer",
|
|
"windowsImageOffer": "WindowsServer",
|
|
"windowsImageVersion": "latest",
|
|
"dataDiskSize": 2,
|
|
"assetLocation": "https://raw.githubusercontent.com/Azure/AzureStack-QuickStart-Templates/master/201-vm-windows-comprehensive",
|
|
"staticSubnetName": "vmstaticsubnet",
|
|
"virtualNetworkName": "[tolower(concat('vmvnet',resourceGroup().name))]",
|
|
"vnetID": "[resourceId('Microsoft.Network/virtualNetworks', variables('virtualNetworkName'))]",
|
|
"staticSubnetRef": "[concat(variables('vnetID'),'/subnets/',variables('staticSubnetName'))]",
|
|
"storageName": "[concat('sa', uniquestring(resourceGroup().id))]",
|
|
"publicLBName": "[tolower(concat('vmplb', resourceGroup().name))]",
|
|
"publicIPAddressName": "[tolower(concat('vmpip',resourceGroup().name))]",
|
|
"lbFE": "[tolower(concat('vmlbfe',resourceGroup().name))]",
|
|
"rpdNAT": "[tolower(concat('vmrdpnat',resourceGroup().name))]",
|
|
"publiclbID": "[resourceId('Microsoft.Network/loadBalancers',variables('publicLBName'))]",
|
|
"publiclbFEConfigID": "[concat(variables('publiclbID'),'/frontendIPConfigurations/',variables('lbFE'))]",
|
|
"rdpPort": 3389,
|
|
"rDPNATRuleID": "[concat(variables('publiclbID'),'/inboundNatRules/',variables('rpdNAT'))]",
|
|
"nsgName": "[tolower(concat('vmnsg',resourceGroup().name))]",
|
|
"nsgID": "[resourceId('Microsoft.Network/networkSecurityGroups',variables('nsgName'))]",
|
|
"NICPrefix": "[tolower(concat('vmnic', resourceGroup().name))]",
|
|
"vmContainerName": "vhds",
|
|
"WindowsFeatureName": "Web-Server",
|
|
"ModulesURL": "[concat(variables('assetLocation'),'/windowsFeature.zip')]",
|
|
"ConfigurationFunction": "windowsFeature.ps1\\EnalbeWindowsFeature",
|
|
"scriptFileName": "ValidateWindowsFeature.ps1",
|
|
"scriptFile": "[concat(variables('assetLocation'),'/',variables('scriptFileName'))]"
|
|
},
|
|
"resources": [
|
|
{
|
|
"type": "Microsoft.Network/networkSecurityGroups",
|
|
"name": "[variables('nsgName')]",
|
|
"location": "[resourceGroup().location]",
|
|
"properties": {
|
|
"securityRules": [
|
|
{
|
|
"name": "rule1",
|
|
"properties": {
|
|
"protocol": "*",
|
|
"sourcePortRange": "*",
|
|
"destinationPortRange": "*",
|
|
"sourceAddressPrefix": "*",
|
|
"destinationAddressPrefix": "*",
|
|
"access": "Allow",
|
|
"priority": 101,
|
|
"direction": "Inbound"
|
|
}
|
|
}
|
|
]
|
|
}
|
|
},
|
|
{
|
|
"type": "Microsoft.Network/virtualNetworks",
|
|
"name": "[variables('virtualNetworkName')]",
|
|
"location": "[resourceGroup().location]",
|
|
"properties": {
|
|
"addressSpace": {
|
|
"addressPrefixes": [
|
|
"[variables('virtualNetworkAddressRange')]"
|
|
]
|
|
},
|
|
"subnets": [
|
|
{
|
|
"name": "[variables('staticSubnetName')]",
|
|
"properties": {
|
|
"addressPrefix": "[variables('vmNetworkSubnet')]",
|
|
"networkSecurityGroup": {
|
|
"id": "[variables('nsgID')]"
|
|
}
|
|
}
|
|
}
|
|
]
|
|
},
|
|
"dependsOn": [
|
|
"[variables('nsgID')]"
|
|
]
|
|
},
|
|
{
|
|
"type": "Microsoft.Network/publicIPAddresses",
|
|
"name": "[variables('publicIPAddressName')]",
|
|
"location": "[resourceGroup().location]",
|
|
"properties": {
|
|
"publicIPAllocationMethod": "Dynamic",
|
|
"dnsSettings": {
|
|
"domainNameLabel": "[variables('dnsPrefix')]"
|
|
}
|
|
},
|
|
"dependsOn": [
|
|
"[variables('vnetID')]"
|
|
]
|
|
},
|
|
{
|
|
"type": "Microsoft.Network/loadBalancers",
|
|
"name": "[variables('publiclbName')]",
|
|
"location": "[resourceGroup().location]",
|
|
"properties": {
|
|
"frontendIPConfigurations": [
|
|
{
|
|
"name": "[variables('lbFE')]",
|
|
"properties": {
|
|
"publicIPAddress": {
|
|
"id": "[resourceId('Microsoft.Network/publicIPAddresses',variables('publicIPAddressName'))]"
|
|
}
|
|
}
|
|
}
|
|
],
|
|
"inboundNatRules": [
|
|
{
|
|
"name": "[variables('rpdNAT')]",
|
|
"properties": {
|
|
"frontendIPConfiguration": {
|
|
"id": "[variables('publiclbFEConfigID')]"
|
|
},
|
|
"protocol": "tcp",
|
|
"frontendPort": "[variables('rdpPort')]",
|
|
"backendPort": 3389,
|
|
"enableFloatingIP": false
|
|
}
|
|
}
|
|
]
|
|
},
|
|
"dependsOn": [
|
|
"[variables('publicIPAddressName')]"
|
|
]
|
|
},
|
|
{
|
|
"type": "Microsoft.Storage/storageAccounts",
|
|
"name": "[variables('storageName')]",
|
|
"location": "[resourceGroup().location]",
|
|
"sku": {
|
|
"name": "[variables('storageAccountType')]"
|
|
},
|
|
"kind": "Storage",
|
|
"dependsOn": [
|
|
"[variables('publiclbName')]"
|
|
]
|
|
},
|
|
{
|
|
"type": "Microsoft.Network/networkInterfaces",
|
|
"name": "[concat(variables('NICPrefix'), '0')]",
|
|
"location": "[resourceGroup().location]",
|
|
"properties": {
|
|
"ipConfigurations": [
|
|
{
|
|
"name": "ipconfig1",
|
|
"properties": {
|
|
"privateIPAllocationMethod": "Dynamic",
|
|
"subnet": {
|
|
"id": "[variables('staticSubnetRef')]"
|
|
},
|
|
"loadBalancerInboundNatRules": [
|
|
{
|
|
"id": "[variables('rDPNATRuleID')]"
|
|
}
|
|
]
|
|
}
|
|
}
|
|
]
|
|
},
|
|
"dependsOn": [
|
|
"[variables('vnetID')]",
|
|
"[variables('publiclbName')]"
|
|
]
|
|
},
|
|
{
|
|
"type": "Microsoft.Network/networkInterfaces",
|
|
"name": "[concat(variables('NICPrefix'), '1')]",
|
|
"location": "[resourceGroup().location]",
|
|
"properties": {
|
|
"ipConfigurations": [
|
|
{
|
|
"name": "ipconfig1",
|
|
"properties": {
|
|
"privateIPAllocationMethod": "Dynamic",
|
|
"subnet": {
|
|
"id": "[variables('staticSubnetRef')]"
|
|
}
|
|
}
|
|
}
|
|
]
|
|
},
|
|
"dependsOn": [
|
|
"[variables('vnetID')]",
|
|
"[variables('publiclbName')]"
|
|
]
|
|
},
|
|
{
|
|
"type": "Microsoft.Compute/virtualMachines",
|
|
"name": "[concat(variables('vmName'), '0')]",
|
|
"location": "[resourceGroup().location]",
|
|
"properties": {
|
|
"hardwareProfile": {
|
|
"vmSize": "[variables('vmSize')]"
|
|
},
|
|
"osProfile": {
|
|
"computerName": "[concat(variables('vmName'), '0')]",
|
|
"adminUsername": "[parameters('adminUsername')]",
|
|
"adminPassword": "[parameters('adminPassword')]"
|
|
},
|
|
"storageProfile": {
|
|
"imageReference": {
|
|
"publisher": "[variables('windowsImagePublisher')]",
|
|
"offer": "[variables('windowsImageOffer')]",
|
|
"sku": "[parameters('windowsImageSKU')]",
|
|
"version": "[variables('windowsImageVersion')]"
|
|
},
|
|
"osDisk": {
|
|
"name": "osdisk",
|
|
"vhd": {
|
|
"uri": "[concat(reference(concat('Microsoft.Storage/storageAccounts/', variables('storageName')),providers('Microsoft.Storage', 'storageAccounts').apiVersions[0]).primaryEndpoints.blob, variables('vmContainerName'),'/', variables('vmName'), '0','-osdisk.vhd')]"
|
|
},
|
|
"caching": "ReadWrite",
|
|
"createOption": "FromImage"
|
|
},
|
|
"dataDisks": [
|
|
{
|
|
"vhd": {
|
|
"uri": "[concat(reference(concat('Microsoft.Storage/storageAccounts/', variables('storageName')),providers('Microsoft.Storage', 'storageAccounts').apiVersions[0]).primaryEndpoints.blob, variables('vmContainerName'),'/', variables('vmName'), '0','data-1.vhd')]"
|
|
},
|
|
"name": "[concat(variables('vmName'), '0','-data-disk1')]",
|
|
"createOption": "Empty",
|
|
"caching": "None",
|
|
"diskSizeGB": "[variables('dataDiskSize')]",
|
|
"lun": 0
|
|
},
|
|
{
|
|
"vhd": {
|
|
"uri": "[concat(reference(concat('Microsoft.Storage/storageAccounts/', variables('storageName')),providers('Microsoft.Storage', 'storageAccounts').apiVersions[0]).primaryEndpoints.blob, variables('vmContainerName'),'/', variables('vmName'), '0','data-2.vhd')]"
|
|
},
|
|
"name": "[concat(variables('vmName'), '0','-data-disk2')]",
|
|
"createOption": "Empty",
|
|
"caching": "None",
|
|
"diskSizeGB": "[variables('dataDiskSize')]",
|
|
"lun": 1
|
|
}
|
|
]
|
|
},
|
|
"networkProfile": {
|
|
"networkInterfaces": [
|
|
{
|
|
"properties": {
|
|
"primary": true
|
|
},
|
|
"id": "[resourceId('Microsoft.Network/networkInterfaces',concat(variables('NICPrefix'), '0'))]"
|
|
},
|
|
{
|
|
"properties": {
|
|
"primary": false
|
|
},
|
|
"id": "[resourceId('Microsoft.Network/networkInterfaces',concat(variables('NICPrefix'), '1'))]"
|
|
}
|
|
]
|
|
}
|
|
},
|
|
"dependsOn": [
|
|
"[resourceId('Microsoft.Network/networkInterfaces',concat(variables('NICPrefix'), '0'))]",
|
|
"[resourceId('Microsoft.Network/networkInterfaces',concat(variables('NICPrefix'), '1'))]"
|
|
]
|
|
},
|
|
{
|
|
"type": "Microsoft.Compute/virtualMachines/extensions",
|
|
"name": "[concat(variables('vmName'), '0','/DSCExtension-EnableWindowsFeature')]",
|
|
"location": "[resourceGroup().location]",
|
|
"properties": {
|
|
"publisher": "Microsoft.Powershell",
|
|
"type": "DSC",
|
|
"typeHandlerVersion": "2.8",
|
|
"autoUpgradeMinorVersion": "true",
|
|
"settings": {
|
|
"modulesUrl": "[variables('ModulesURL')]",
|
|
"configurationFunction": "[variables('ConfigurationFunction')]",
|
|
"properties": {
|
|
"featureName": "[variables('WindowsFeatureName')]"
|
|
}
|
|
}
|
|
},
|
|
"dependsOn": [
|
|
"[concat(variables('vmName'), '0')]"
|
|
]
|
|
},
|
|
{
|
|
"type": "Microsoft.Compute/virtualMachines/extensions",
|
|
"name": "[concat(variables('vmName'), '0','/BGInfoExtension')]",
|
|
"location": "[resourceGroup().location]",
|
|
"properties": {
|
|
"publisher": "Microsoft.Compute",
|
|
"autoUpgradeMinorVersion": true,
|
|
"type": "BGInfo",
|
|
"typeHandlerVersion": "2.1",
|
|
"settings": {
|
|
"Properties": []
|
|
}
|
|
},
|
|
"dependsOn": [
|
|
"[concat('Microsoft.Compute/virtualMachines/',variables('vmName'), '0','/extensions/DSCExtension-EnableWindowsFeature')]"
|
|
]
|
|
},
|
|
{
|
|
"type": "Microsoft.Compute/virtualMachines/extensions",
|
|
"name": "[concat(variables('vmName'), '0','/CustomScriptExtension-VerifyWindowsFeature')]",
|
|
"location": "[resourceGroup().location]",
|
|
"properties": {
|
|
"publisher": "Microsoft.Compute",
|
|
"type": "CustomScriptExtension",
|
|
"typeHandlerVersion": "1.4",
|
|
"autoUpgradeMinorVersion": true,
|
|
"settings": {
|
|
"fileUris": [
|
|
"[variables('scriptFile')]"
|
|
],
|
|
"commandToExecute": "[concat('powershell -ExecutionPolicy Unrestricted -file ',variables('scriptFileName'), ' ', variables('WindowsFeatureName'))]"
|
|
}
|
|
},
|
|
"dependsOn": [
|
|
"[concat('Microsoft.Compute/virtualMachines/', variables('vmName'), '0','/extensions/BGInfoExtension')]"
|
|
]
|
|
}
|
|
],
|
|
"outputs": { }
|
|
} |