419 строки
13 KiB
JSON
419 строки
13 KiB
JSON
{
|
|
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
|
|
"contentVersion": "1.0.0.0",
|
|
"parameters": {
|
|
"adminPassword": {
|
|
"type": "securestring",
|
|
"metadata": {
|
|
"description": "Local admin password for the Virtual Machine."
|
|
}
|
|
},
|
|
"adminUsername": {
|
|
"type": "string",
|
|
"metadata": {
|
|
"description": "Local admin username for the Virtual Machine."
|
|
}
|
|
},
|
|
"apiVersion": {
|
|
"type": "string",
|
|
"metadata": {
|
|
"description": "The ARM Template API Version"
|
|
}
|
|
},
|
|
"deploymentApiVersion": {
|
|
"type": "string",
|
|
"metadata": {
|
|
"description": "The ARM Template API Version for deployments"
|
|
}
|
|
},
|
|
"diagnosticsStorageName": {
|
|
"type": "string",
|
|
"metadata": {
|
|
"description": "The diagnostics storage name."
|
|
}
|
|
},
|
|
"DiskSelectionTemplateURL": {
|
|
"type": "string",
|
|
"metadata": {
|
|
"description": "The template url for disk selection."
|
|
}
|
|
},
|
|
"publicIPAddressType": {
|
|
"type": "string",
|
|
"metadata": {
|
|
"description": "The type of the Public IP address"
|
|
},
|
|
"defaultValue": "Dynamic",
|
|
"allowedValues": [
|
|
"Dynamic",
|
|
"Static"
|
|
]
|
|
},
|
|
"SQLDnsNameForPublicIPPrefix": {
|
|
"type": "string",
|
|
"metadata": {
|
|
"description": "Globally unique DNS Name for the Public IP used to access the SQL Server Virtual Machine."
|
|
}
|
|
},
|
|
"SQLLoadBalancerPrivateIPAddress": {
|
|
"type": "string",
|
|
"metadata": {
|
|
"description": "The SQL load balancer private IP address."
|
|
}
|
|
},
|
|
"SQLVMDataDiskSize": {
|
|
"type": "int",
|
|
"metadata": {
|
|
"description": "The SQL Server Virtual Machine Data disk size."
|
|
},
|
|
"defaultValue": 1023
|
|
},
|
|
"SQLVMNamePrefix": {
|
|
"type": "string",
|
|
"metadata": {
|
|
"description": "The VM name for the SQL Server Virtual Machine."
|
|
},
|
|
"defaultValue": "SQLVM"
|
|
},
|
|
"SQLVMNumberOfDataDisk": {
|
|
"type": "string",
|
|
"allowedValues": [
|
|
"1",
|
|
"2",
|
|
"3",
|
|
"4",
|
|
"5",
|
|
"6",
|
|
"7",
|
|
"8",
|
|
"9",
|
|
"10",
|
|
"11",
|
|
"12",
|
|
"13",
|
|
"14",
|
|
"15",
|
|
"16",
|
|
"32"
|
|
],
|
|
"metadata": {
|
|
"description": "The SQL Server Virtual Machine number of data disk."
|
|
}
|
|
},
|
|
"SQLVMSize": {
|
|
"type": "string",
|
|
"metadata": {
|
|
"description": "The VM size for the SQL Server Virtual Machine."
|
|
},
|
|
"allowedValues": [
|
|
"Standard_D1",
|
|
"Standard_DS1",
|
|
"Standard_D2",
|
|
"Standard_DS2",
|
|
"Standard_D3",
|
|
"Standard_DS3",
|
|
"Standard_D4",
|
|
"Standard_DS4",
|
|
"Standard_D11",
|
|
"Standard_DS11",
|
|
"Standard_D12",
|
|
"Standard_DS12",
|
|
"Standard_D13",
|
|
"Standard_DS13",
|
|
"Standard_D14",
|
|
"Standard_DS14"
|
|
]
|
|
},
|
|
"StorageName": {
|
|
"type": "string",
|
|
"metadata": {
|
|
"description": "The storage name."
|
|
}
|
|
},
|
|
"subnetRef": {
|
|
"type": "string",
|
|
"metadata": {
|
|
"description": "The reference of the subnet resource for the network interface."
|
|
}
|
|
},
|
|
"vhdStorageContainerName": {
|
|
"type": "string",
|
|
"metadata": {
|
|
"description": "The vhd storage container name."
|
|
}
|
|
}
|
|
},
|
|
"variables": {
|
|
"ResourceGroupUniqueString": "[uniquestring(resourceGroup().id)]",
|
|
"SQLAvailabilitySetName": "SQLAvailabilitySet",
|
|
"SQLLoadBalancerName": "SQLLoadBalancer",
|
|
"SQLNICNamePrefix": "SQLVMNic",
|
|
"SQLNumberOfInstances": 2,
|
|
"SQLPublicIPAddressNamePrefix": "SQLPublicIP",
|
|
"SQLVMDataDiskCaching": "None",
|
|
"SQLVMDataDiskNamePrefix": "[concat(variables('ResourceGroupUniqueString'), '-', 'sqldata') ]",
|
|
"SQLVMImageOffer": "SQL2016SP1-WS2016", //"SQL2014SP2-WS2012R2",
|
|
"SQLVMImagePublisher": "MicrosoftSQLServer",
|
|
"SQLVMImageSKU": "Enterprise",
|
|
"SQLVMOSDiskNamePrefix": "[concat(variables('ResourceGroupUniqueString'), '-', 'sqlos') ]"
|
|
},
|
|
"resources": [
|
|
|
|
{
|
|
"apiVersion": "[parameters('deploymentApiVersion')]",
|
|
"type": "Microsoft.Resources/deployments",
|
|
"name": "DiskSelection0",
|
|
"dependsOn": [ ],
|
|
"properties": {
|
|
"mode": "Incremental",
|
|
"templateLink": {
|
|
"uri": "[parameters('DiskSelectionTemplateURL')]",
|
|
"contentVersion": "1.0.0.0"
|
|
},
|
|
"parameters": {
|
|
"diskCaching": {
|
|
"value": "[variables('SQLVMDataDiskCaching')]"
|
|
},
|
|
"diskNamePrefix": {
|
|
"value": "[concat(variables('SQLVMDataDiskNamePrefix'), '0')]"
|
|
},
|
|
"diskSizeGB": {
|
|
"value": "[parameters('SQLVMDataDiskSize')]"
|
|
},
|
|
"diskStorageAccountName": {
|
|
"value": "[parameters('StorageName')]"
|
|
},
|
|
"numDataDisks": {
|
|
"value": "[parameters('SQLVMNumberOfDataDisk')]"
|
|
},
|
|
"vhdStorageContainerName": {
|
|
"value": "[parameters('vhdStorageContainerName')]"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"apiVersion": "[parameters('deploymentApiVersion')]",
|
|
"type": "Microsoft.Resources/deployments",
|
|
"name": "DiskSelection1",
|
|
"dependsOn": [ ],
|
|
"properties": {
|
|
"mode": "Incremental",
|
|
"templateLink": {
|
|
"uri": "[parameters('DiskSelectionTemplateURL')]",
|
|
"contentVersion": "1.0.0.0"
|
|
},
|
|
"parameters": {
|
|
"diskCaching": {
|
|
"value": "[variables('SQLVMDataDiskCaching')]"
|
|
},
|
|
"diskNamePrefix": {
|
|
"value": "[concat(variables('SQLVMDataDiskNamePrefix'), '1')]"
|
|
},
|
|
"diskSizeGB": {
|
|
"value": "[parameters('SQLVMDataDiskSize')]"
|
|
},
|
|
"diskStorageAccountName": {
|
|
"value": "[parameters('StorageName')]"
|
|
},
|
|
"numDataDisks": {
|
|
"value": "[parameters('SQLVMNumberOfDataDisk')]"
|
|
},
|
|
"vhdStorageContainerName": {
|
|
"value": "[parameters('vhdStorageContainerName')]"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"apiVersion": "[parameters('apiVersion')]",
|
|
"type": "Microsoft.Compute/availabilitySets",
|
|
"name": "[variables('SQLAvailabilitySetName')]",
|
|
"location": "[resourceGroup().location]",
|
|
"tags": {
|
|
"displayName": "SQLAvailabilitySet"
|
|
},
|
|
"properties": { }
|
|
},
|
|
{
|
|
"apiVersion": "[parameters('apiVersion')]",
|
|
"type": "Microsoft.Network/loadBalancers",
|
|
"name": "[variables('SQLLoadBalancerName')]",
|
|
"location": "[resourceGroup().location]",
|
|
"tags": {
|
|
"displayName": "SQLLoadBalancer"
|
|
},
|
|
"dependsOn": [ ],
|
|
"properties": {
|
|
"frontendIPConfigurations": [
|
|
{
|
|
"name": "LoadBalancerFrontend",
|
|
"properties": {
|
|
"privateIPAllocationMethod": "Static",
|
|
"privateIPAddress": "[parameters('SQLLoadBalancerPrivateIPAddress')]",
|
|
"subnet": {
|
|
"id": "[parameters('subnetRef')]"
|
|
}
|
|
}
|
|
}
|
|
],
|
|
"backendAddressPools": [
|
|
{
|
|
"name": "LoadBalancerBackend"
|
|
}
|
|
],
|
|
"probes": [
|
|
{
|
|
"name": "lbprobe",
|
|
"properties": {
|
|
"protocol": "Tcp",
|
|
"port": 59999,
|
|
"intervalInSeconds": 5,
|
|
"numberOfProbes": 2
|
|
}
|
|
}
|
|
],
|
|
"loadBalancingRules": [
|
|
{
|
|
"name": "lbrule",
|
|
"properties": {
|
|
"frontendIPConfiguration": {
|
|
"id": "[concat(resourceId('Microsoft.Network/loadBalancers', variables('SQLLoadBalancerName')), '/frontendIpConfigurations/LoadBalancerFrontend')]"
|
|
},
|
|
"backendAddressPool": {
|
|
"id": "[concat(resourceId('Microsoft.Network/loadBalancers', variables('SQLLoadBalancerName')), '/backendAddressPools/LoadBalancerBackend')]"
|
|
},
|
|
"probe": {
|
|
"id": "[concat(resourceId('Microsoft.Network/loadBalancers', variables('SQLLoadBalancerName')), '/probes/lbprobe')]"
|
|
},
|
|
"protocol": "Tcp",
|
|
"frontendPort": 1433,
|
|
"backendPort": 1433,
|
|
"enableFloatingIP": true
|
|
}
|
|
}
|
|
]
|
|
}
|
|
},
|
|
{
|
|
"apiVersion": "[parameters('apiVersion')]",
|
|
"type": "Microsoft.Network/publicIPAddresses",
|
|
"name": "[concat(variables('SQLPublicIPAddressNamePrefix'), copyindex())]",
|
|
"location": "[resourceGroup().location]",
|
|
"tags": {
|
|
"displayName": "SQLPublicIPAddress"
|
|
},
|
|
"copy": {
|
|
"name": "sqlPublicIPLoop",
|
|
"count": "[variables('SQLNumberOfInstances')]"
|
|
},
|
|
"properties": {
|
|
"publicIPAllocationMethod": "[parameters('publicIPAddressType')]",
|
|
"dnsSettings": {
|
|
"domainNameLabel": "[concat(parameters('SQLDnsNameForPublicIPPrefix'), copyindex())]"
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"apiVersion": "[parameters('apiVersion')]",
|
|
"type": "Microsoft.Network/networkInterfaces",
|
|
"name": "[concat(variables('SQLNICNamePrefix'), copyindex())]",
|
|
"location": "[resourceGroup().location]",
|
|
"tags": {
|
|
"displayName": "SQLNetworkInterface"
|
|
},
|
|
"copy": {
|
|
"name": "sqlNicLoop",
|
|
"count": "[variables('SQLNumberOfInstances')]"
|
|
},
|
|
"dependsOn": [
|
|
"[concat('Microsoft.Network/publicIPAddresses/', variables('SQLpublicIPAddressNamePrefix'), copyindex())]",
|
|
"[concat('Microsoft.Network/loadBalancers/', variables('SQLLoadBalancerName'))]"
|
|
],
|
|
"properties": {
|
|
"ipConfigurations": [
|
|
{
|
|
"name": "ipconfig1",
|
|
"properties": {
|
|
"privateIPAllocationMethod": "Dynamic",
|
|
"publicIPAddress": {
|
|
"id": "[resourceId('Microsoft.Network/publicIPAddresses', concat(variables('SQLpublicIPAddressNamePrefix'), copyindex()))]"
|
|
},
|
|
"subnet": {
|
|
"id": "[parameters('subnetRef')]"
|
|
},
|
|
"loadBalancerBackendAddressPools": [
|
|
{
|
|
"id": "[concat(resourceId('Microsoft.Network/loadBalancers', variables('SQLLoadBalancerName')), '/backendAddressPools/LoadBalancerBackend')]"
|
|
}
|
|
]
|
|
}
|
|
}
|
|
]
|
|
}
|
|
},
|
|
{
|
|
"apiVersion": "[parameters('apiVersion')]",
|
|
"type": "Microsoft.Compute/virtualMachines",
|
|
"name": "[concat(parameters('SQLVMNamePrefix'), copyindex())]",
|
|
"location": "[resourceGroup().location]",
|
|
"tags": {
|
|
"displayName": "SQLServerVirtualMachine"
|
|
},
|
|
"copy": {
|
|
"name": "sqlVMLoop",
|
|
"count": "[variables('SQLNumberOfInstances')]"
|
|
},
|
|
"dependsOn": [
|
|
"[concat('Microsoft.Network/networkInterfaces/', variables('SQLnicNamePrefix'), copyindex())]",
|
|
"[concat('Microsoft.Compute/availabilitySets/', variables('SQLAvailabilitySetName'))]"
|
|
],
|
|
"properties": {
|
|
"availabilitySet": {
|
|
"id": "[resourceId('Microsoft.Compute/availabilitySets', variables('SQLAvailabilitySetName'))]"
|
|
},
|
|
"hardwareProfile": {
|
|
"vmSize": "[parameters('SQLVMSize')]"
|
|
},
|
|
"osProfile": {
|
|
"computerName": "[concat(parameters('SQLVMNamePrefix'), copyindex())]",
|
|
"adminUsername": "[parameters('adminUsername')]",
|
|
"adminPassword": "[parameters('adminPassword')]"
|
|
},
|
|
"storageProfile": {
|
|
"imageReference": {
|
|
"publisher": "[variables('SQLVMImagePublisher')]",
|
|
"offer": "[variables('SQLVMImageOffer')]",
|
|
"sku": "[variables('SQLVMImageSKU')]",
|
|
"version": "latest"
|
|
},
|
|
"osDisk": {
|
|
"name": "osdisk",
|
|
"vhd": {
|
|
"uri": "[concat('http://', parameters('StorageName'), '.blob.core.windows.net/', parameters('vhdStorageContainerName'), '/', variables('SQLVMOSDiskNamePrefix'), copyindex(), '.vhd')]"
|
|
},
|
|
"caching": "ReadWrite",
|
|
"createOption": "FromImage"
|
|
},
|
|
"dataDisks": "[reference(concat('DiskSelection', copyindex())).outputs.dataDiskArray.value]"
|
|
},
|
|
"networkProfile": {
|
|
"networkInterfaces": [
|
|
{
|
|
"id": "[resourceId('Microsoft.Network/networkInterfaces', concat(variables('SQLNICNamePrefix'), copyindex()))]"
|
|
}
|
|
]
|
|
},
|
|
"diagnosticsProfile": {
|
|
"bootDiagnostics": {
|
|
"enabled": true,
|
|
"storageUri": "[concat('http://', parameters('diagnosticsStorageName'), '.blob.core.windows.net')]"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
],
|
|
"outputs": {
|
|
}
|
|
}
|