diff --git a/sql-2016-alwayson/CreateADPDC.ps1.zip b/sql-2016-alwayson/CreateADPDC.ps1.zip new file mode 100644 index 00000000..612c943b Binary files /dev/null and b/sql-2016-alwayson/CreateADPDC.ps1.zip differ diff --git a/sql-2016-alwayson/CreateFailoverCluster.ps1.zip b/sql-2016-alwayson/CreateFailoverCluster.ps1.zip new file mode 100644 index 00000000..6ffe4298 Binary files /dev/null and b/sql-2016-alwayson/CreateFailoverCluster.ps1.zip differ diff --git a/sql-2016-alwayson/CreateFileShareWitness.ps1.zip b/sql-2016-alwayson/CreateFileShareWitness.ps1.zip new file mode 100644 index 00000000..2d942f30 Binary files /dev/null and b/sql-2016-alwayson/CreateFileShareWitness.ps1.zip differ diff --git a/sql-2016-alwayson/PrepareAlwaysOnSqlServer.ps1.zip b/sql-2016-alwayson/PrepareAlwaysOnSqlServer.ps1.zip new file mode 100644 index 00000000..b1c82960 Binary files /dev/null and b/sql-2016-alwayson/PrepareAlwaysOnSqlServer.ps1.zip differ diff --git a/sql-2016-alwayson/Readme.md b/sql-2016-alwayson/Readme.md new file mode 100644 index 00000000..b1dc0c30 --- /dev/null +++ b/sql-2016-alwayson/Readme.md @@ -0,0 +1,70 @@ +# Create a two node SQL Server Always On Cluster with SQL 2016 on Windows Server 2016 + +This template deploys two SQL Server Enterprise, Standard or Developer instances in an Always On Availability Group. It creates the following resources: + +* A network security group +* A virtual network +* Four storage accounts (One for AD, One for SQL, One for File Share witness and One for VM diagnostic) +* Four public IP address (One for AD, Two for each SQL VM and One for Public LB bound to SQL Always On Listener) +* One external load balancer for SQL VMs with Public IP bound to the SQL Always On listener +* One VM (WS2016) configured as Domain Controller for a new forest with a single domain +* Two VM (WS2016) configured as SQL Server 2016 SP1 or SP2 Enterprise/Standard/Developer and clustered (must use the marketplace images) +* One VM (WS2016) configured as File Share Witness for the cluster +* One Availability Set containing the SQL and FSW 2016 VMs + +## Notes + +This template uses Azure Stack Marketplace images. These need to be available on your Azure Stack instance: + +* Windows Server 2016 Datacenter Image (for AD and FSW VMs) +* Choice of SQL Server 2016 SP1 or SP2 on Windows Server 2016 (Enterprise, Standard or Developer) +* Latest SQL IaaS Extension 1.2.x (currently 1.2.30) +* Latest DSC Extension (2.76.0, or higher) +* Latest Custom Script Extension for Windows (1.9.1, or higher) + +## Configuration + +* Each SQL VMs will have the number and size of data disks specified, of up to 1TiB each. The SQL extension will configured these into a single volume using Storage Spaces. +* The SQL VMs and the file share witness will be configured in an Availability Set + * Integrated Systems (fault domains:3, update domains:5) + * ASDK will automatically use fault domains:1, update domains:1) +* The template configures the SQL instances with contained database authentication set to true. +* The *external* DNS suffix for public IP addresses (ASDK default: azurestack.external) + +## Parameters + +| Parameter Name | Description | Type | Default Value +| --- | --- | --- | --- +| _artifactsLocation | Blob store where all deployment artifacts are stored | string | https://raw.githubusercontent.com/Azure/AzureStack-QuickStart-Templates/master/sql-2016-alwayson +| adminUsername | Admin user for new VMs and domain | string | localadmin +| adminPassword | Password used for the new admin | securestring | (must be specified) +| adVMSize | VM size for the domain controller | string* | Standard_D2_v2 +| witnessVMSize | VM size for the file share witness | string* | Standard_D1_v2 +| domainName | Name of the new AD domain | string | fabrikam.local +| dnsSuffix | Name of the Azure Stack instance's external domain | string | +| virtualNetworkAddressRange | Address range for new VNET in CIDR format | string | 10.0.0.0/16 +| staticSubnet | Range of addresses from the virtualNetworkAddressRange for static IP allocation | string | 10.0.0.0/24 +| sqlSubnet | Address range used by the SQL & FSW VMs | string | 10.0.1.0/26 +| adPDCNICIPAddress | IP address for the AD VM | string | 10.0.0.250 +| deploymentPrefix | DNS prefix for the public IP addresses | string | aodns +| virtualNetworkName | Name of the virtual network | string | sqlhaVNET +| sqlServerServiceAccountUserName | The SQL Server Service Account name | string | sqlservice +| sqlServerServiceAccountPassword | Password for the service account | secure string | +| sqlAuthUserName | SQL Server Admin user | string | sqlsa +| sqlAutPassword | Password for the SQL Server Admin | secure string | +| sqlStorageAccountName | Name for the SQL Storage Account | string | derived from resource group name +| sqlStorageAccountType | Standard or Premium Storage | string | Premium_LRS +| sqlServerOffer | Name of the SQL Offer | string* | SQL2016SP2-WS2016 +| sqlServerSku | Name of the SKU | string* | Enterprise +| sqlVMSize | Size of the SQL Server VMs | string * | Standard_DS2_v2 +| sqlAOAGName | SQL Always On Availability Group Name | string | sqlaa-ag +| sqlAOListenerName | SQL Always On listener name | string | derived from the resource group name +| sqlAOListenerPort | TCP port number used by the listener | string | 1433 +| workloadType | SQL VM Workload (GENERAL, OLTP, DW) | string* | GENERAL +| vmDiskSize | SQL data disk size (128, 256, 512, 1023) | string | 128 +| numberOfSqlVMDisks | Number of SQL data disks per server | int | 2 +| sampleDatabaseName | Sample HA database created during deployment | string | AutoHa-sample +| autoPatchingDay | Day of the week to download and apply patches | string* | Sunday +| autoPatchingStartHour | Hour to start patching process | string* | 2 + +* parameter has a list of allowed values; please refer to the template. \ No newline at end of file diff --git a/sql-2016-alwayson/azuredeploy.json b/sql-2016-alwayson/azuredeploy.json new file mode 100644 index 00000000..a0a5f56c --- /dev/null +++ b/sql-2016-alwayson/azuredeploy.json @@ -0,0 +1,975 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "_artifactsLocation": { + "type": "string", + "metadata": { + "description": "Artifacts base url" + }, + "defaultValue": "https://raw.githubusercontent.com/Azure/AzureStack-QuickStart-Templates/master/sql-2016-alwayson" + }, + "adminUsername": { + "type": "string", + "metadata": { + "description": "The name of the Administrator of the new VMs and Domain" + }, + "defaultValue": "localadmin" + }, + "adminPassword": { + "type": "securestring", + "metadata": { + "description": "The password for the Administrator account of the new VMs and Domain" + } + }, + "adVMSize": { + "type": "string", + "allowedValues": [ + "Standard_D1_v2", + "Standard_D2_v2" + ], + "metadata": { + "description": "The size of the AD VM Created" + }, + "defaultValue": "Standard_D2_v2" + }, + "witnessVMSize": { + "type": "string", + "allowedValues": [ + "Standard_D1_v2", + "Standard_D2_v2" + ], + "metadata": { + "description": "The size of the Witness VM Created" + }, + "defaultValue": "Standard_D1_v2" + }, + "domainName": { + "type": "string", + "metadata": { + "description": "The FQDN of the AD Domain created" + }, + "defaultValue": "fabrikam.local" + }, + "dnsSuffix": { + "type": "string", + "metadata": { + "description": "The DNS Suffix for reverse lookup of public IPAddresses. Must be lowercase. It should match with the following regular expression: ^[a-z][a-z0-9-]{1,61}[a-z0-9]$ or it will raise an error." + } + }, + "virtualNetworkAddressRange": { + "type": "string", + "metadata": { + "description": "The address range of the new VNET in CIDR format" + }, + "defaultValue": "10.0.0.0/16" + }, + "staticSubnet": { + "type": "string", + "metadata": { + "description": "The address range of the subnet static IPs are allocated from in the new VNET" + }, + "defaultValue": "10.0.0.0/24" + }, + "sqlSubnet": { + "type": "string", + "metadata": { + "description": "The address range of the SQL subnet created in the new VNET" + }, + "defaultValue": "10.0.1.0/26" + }, + "adPDCNICIPAddress": { + "type": "string", + "metadata": { + "description": "The IP address of the new AD VM" + }, + "defaultValue": "10.0.0.250" + }, + "deploymentPrefix": { + "type": "string", + "metadata": { + "description": "The DNS Prefix for the Public IP Address for the Always On Cluster" + }, + "defaultValue": "aodns" + }, + "virtualNetworkName": { + "type": "string", + "metadata": { + "description": "Name of virtual network to be created" + }, + "defaultValue": "sqlhaVNET" + }, + "sqlServerServiceAccountUserName": { + "type": "string", + "metadata": { + "description": "The SQL Server Service Account name" + }, + "defaultValue": "sqlservice" + }, + "sqlServerServiceAccountPassword": { + "type": "securestring", + "metadata": { + "description": "The SQL Server Service Account password" + } + }, + "sqlAuthUserName": { + "type": "string", + "metadata": { + "description": "The SQL Server Auth Account name" + }, + "defaultValue": "sqlsa" + }, + "sqlAuthPassword": { + "type": "securestring", + "metadata": { + "description": "The SQL Server Auth Account password" + } + }, + "sqlStorageAccountName": { + "type": "string", + "metadata": { + "description": "The name of Sql Server Storage Account" + }, + "defaultValue": "[tolower(concat(take(uniqueString(resourceGroup().id),8),'sql'))]" + }, + "sqlStorageAccountType": { + "type": "string", + "allowedValues": [ + "Premium_LRS", + "Standard_LRS" + ], + "metadata": { + "description": "The type of the Sql Server Storage Account created" + }, + "defaultValue": "Premium_LRS" + }, + "sqlServerOffer": { + "type": "string", + "allowedValues": [ + "SQL2016SP1-WS2016", + "SQL2016SP2-WS2016" + ], + "metadata": { + "description": "The SQL Server Version" + }, + "defaultValue": "SQL2016SP2-WS2016" + }, + "sqlServerSku": { + "type": "string", + "allowedValues": [ + "Enterprise", + "Standard", + "SQLDEV" + ], + "metadata": { + "description": "The SQL Edition" + }, + "defaultValue": "Enterprise" + }, + "sqlVMSize": { + "type": "string", + "allowedValues": [ + "Standard_DS2_v2", + "Standard_DS3_v2", + "Standard_DS4_v2", + "Standard_DS5_v2", + "Standard_DS11_v2", + "Standard_DS12_v2", + "Standard_DS13_v2" + ], + "metadata": { + "description": "The size of the SQL VMs Created" + }, + "defaultValue": "Standard_DS2_v2" + }, + "sqlAOAGName": { + "type": "string", + "metadata": { + "description": "The Sql AlwaysOn Group Name" + }, + "defaultValue": "sqlaa-ag" + }, + "sqlAOListenerName": { + "type": "string", + "metadata": { + "description": "The Sql AG Listener Name" + }, + "defaultValue": "[tolower(concat('ao-listen-' , resourceGroup().name))]" + }, + "sqlAOListenerPort": { + "type": "string", + "metadata": { + "description": "The Sql AG Listener port" + }, + "defaultValue": "1433" + }, + "workloadType": { + "type": "string", + "allowedValues": [ + "GENERAL", "OLTP", "DW" + ], + "metadata": { + "description": "The Sql VM work load type" + }, + "defaultValue": "GENERAL" + }, + "vmDiskSize": { + "type": "string", + "allowedValues": [ + "128", + "256", + "512", + "1023" + ], + "metadata": { + "description": "The size of the SQL VM data disks in GB." + }, + "defaultValue": "128" + }, + "numberOfSqlVMDisks": { + "type": "int", + "metadata": { + "description": "Number of data disks (subject to VM size limitations)" + }, + "minValue": 1, + "maxValue": 32, + "defaultValue": 2 + }, + "sampleDatabaseName": { + "type": "string", + "metadata": { + "description": "Sample HA database" + }, + "defaultValue": "AutoHa-sample" + }, + "autoPatchingDay": { + "type": "string", + "allowedValues": [ + "Never", + "Everyday", + "Sunday", + "Monday", + "Tuesday", + "Wednesday", + "Thursday", + "Friday", + "Saturday" + ], + "metadata": { + "description": "The day of a week for auto patching" + }, + "defaultValue": "Sunday" + }, + "autoPatchingStartHour": { + "type": "string", + "allowedValues": [ + "0", + "1", + "2", + "3", + "4", + "5", + "6", + "7", + "8", + "9", + "10", + "11", + "12", + "13", + "14", + "15", + "16", + "17", + "18", + "19", + "20", + "21", + "22", + "23" + ], + "metadata": { + "description": "The start hour of a day for auto patching" + }, + "defaultValue": "2" + } + }, + "variables": { + "lbSettings": { + "rdpLBFE": "rdpLBFE", + "sqlLBFE": "sqlLBFE", + "adLBBE": "adLBBE", + "sqlLBBE": "sqlLBBE", + "rdpLBName": "rdpLoadBalancer", + "sqlLBName": "sqlLoadBalancer" + }, + "subnetNames": { + "staticSubnetName": "staticSubnet", + "sqlSubnetName": "sqlSubnet" + }, + "RDPNAT": "RDP", + "SQLAOProbe": "SQLAlwaysOnEndPointProbe", + "primaryDCIPAddressName": "primaryDCIP", + "sql1AddressName": "sql1IP", + "sql0AddressName": "sql0IP", + "vmSettings": { + "availabilitySets": { + "sqlAvailabilitySetName": "sqlAvailabilitySet", + "adAvailabilitySetName": "adAvailabilitySet" + }, + "vmContainerName": "vhds", + "adPDCVMName": "[substring(concat('priDC-', uniquestring(replace(resourceGroup().Id,'-',''))), 0, 8)]", + "sqlVMName": "[substring(concat('sql-', uniquestring(replace(resourceGroup().Id,'-',''))), 0, 8)]", + "sqlwVMName": "[substring(concat('fsw-', uniquestring(replace(resourceGroup().Id,'-',''))), 0, 8)]", + "windowsImagePublisher": "MicrosoftWindowsServer", + "windowsImageOffer": "WindowsServer", + "windowsImageSKU": "2016-Datacenter" + }, + "sqlAOEPName": "[concat(parameters('deploymentPrefix'),'-hadr')]", + "sharePath": "[concat(parameters('deploymentPrefix'),'-fsw')]", + "clusterName": "[concat(parameters('deploymentPrefix'),'-fc')]", + "adPDCNicName": "[concat(variables('vmSettings').adPDCVMName,'-nic')]", + "sqlwNicName": "[concat(variables('vmSettings').sqlwVMName,'-nic')]", + "VnetID": "[resourceId('Microsoft.Network/virtualNetworks', variables('virtualNetworkNameWithSuffix'))]", + "staticSubnetRef": "[concat(variables('VnetID'),'/subnets/',variables('subnetNames').staticSubnetName)]", + "sqlSubnetRef": "[concat(variables('VnetID'),'/subnets/',variables('subnetNames').sqlSubnetName)]", + "dnsPrefix": "[parameters('sqlAOListenerName')]", + "publicIPAddressName": "[concat('SQLPIP',resourceGroup().name)]", + "ids": { + "adNicId": "[resourceId('Microsoft.Network/networkInterfaces',variables('adPDCNicName'))]", + "rdplbID": "[resourceId('Microsoft.Network/loadBalancers',variables('lbSettings').rdpLBName)]", + "sqllbID": "[resourceId('Microsoft.Network/loadBalancers',variables('lbSettings').sqlLBName)]", + "publicIPAddressID": "[resourceId('Microsoft.Network/publicIPAddresses',variables('publicIPAddressName'))]" + }, + "derivedIds": { + "adIPConfigID": "[concat(variables('ids').adNicId,'/ipConfigurations/ipconfig1')]", + "rdplbFEConfigID": "[concat(variables('ids').rdplbID,'/frontendIPConfigurations/',variables('lbSettings').rdpLBFE)]", + "adRDPNATRuleID": "[concat(variables('ids').rdplbID,'/inboundNatRules/',variables('RDPNAT'))]", + "adBEAddressPoolID": "[concat(variables('ids').rdplbID,'/backendAddressPools/',variables('lbSettings').adLBBE)]", + "sqlBEAddressPoolID": "[concat(variables('ids').sqllbID,'/backendAddressPools/',variables('lbSettings').sqlLBBE)]", + "sqllbFEConfigID": "[concat(variables('ids').sqllbID,'/frontendIPConfigurations/',variables('lbSettings').sqlLBFE)]", + "sqllbProbeID": "[concat(variables('ids').sqllbID,'/probes/',variables('SQLAOProbe'))]" + }, + "Monday": true, + "Tuesday": true, + "Wednesday": true, + "Thursday": true, + "Friday": true, + "Saturday": true, + "Sunday": true, + "Never": false, + "Everyday": true, + "nsgName": "[concat('Nsg',resourceGroup().name)]", + "nsgID": "[resourceId('Microsoft.Network/networkSecurityGroups',variables('nsgName'))]", + "subnets": [ + { + "name": "[variables('subnetNames').staticSubnetName]", + "properties": { + "addressPrefix": "[parameters('staticSubnet')]", + "networkSecurityGroup": { + "id": "[variables('nsgID')]" + } + } + }, + { + "name": "[variables('subnetNames').sqlSubnetName]", + "properties": { + "addressPrefix": "[parameters('sqlSubnet')]", + "networkSecurityGroup": { + "id": "[variables('nsgID')]" + } + } + } + ], + "virtualNetworkNameWithSuffix": "[substring(concat(parameters('virtualNetworkName'), uniqueString(parameters('sqlStorageAccountName'))),0,15)]", + "primaryDCIPAddressNameWithSuffix": "[substring(concat(variables('primaryDCIPAddressName'), uniqueString(parameters('sqlStorageAccountName'))),0,15)]", + "sql1AddressNameWithSuffix": "[substring(concat(variables('sql1AddressName'), uniqueString(parameters('sqlStorageAccountName'))),0,15)]", + "sql0AddressNameWithSuffix": "[substring(concat(variables('sql0AddressName'), uniqueString(parameters('sqlStorageAccountName'))),0,15)]", + "dcStorageAccountName": "[concat(substring(concat(parameters('sqlStorageAccountName'), uniqueString(parameters('sqlStorageAccountName'))),0,18),'dc')]", + "configuration": { + "vnetwithDNSTemplateURL": "[concat(parameters('_artifactsLocation'),'/vnet-with-dns-server.json')]", + "rdpIPAdressSetupURL": "[concat(parameters('_artifactsLocation'),'/publicip-rdp.json')]", + "setupLBsUrl": "[concat(parameters('_artifactsLocation'), '/setupLBs-e.json')]", + "creatingADNICUrl": "[concat(parameters('_artifactsLocation'),'/creatingADNIC.json')]", + "creatingNicsUrl": "[concat(parameters('_artifactsLocation'),'/creatingNICS.json')]", + "storageAccountVirtualNetworkPublicIP": "[concat(parameters('_artifactsLocation'),'/storageAccountVirtualNetworkPublicIP.json')]", + "provisioningADVM": "[concat(parameters('_artifactsLocation'),'/provisioningADVM','.json')]", + "provisioningSQLVMs": "[concat(parameters('_artifactsLocation'),'/provisioningSQLVMs.json')]", + "configuringBackupADVM": "[concat(parameters('_artifactsLocation'),'/configuringBackupADVM.json')]", + "preparingAlwaysOnSqlServer": "[concat(parameters('_artifactsLocation'),'/preparingSqlServer.json')]", + "configuringAlwaysOn": "[concat(parameters('_artifactsLocation'),'/configuringAlwaysOn.json')]", + "adPDCModulesURL": "[concat(parameters('_artifactsLocation'),'/CreateADPDC.ps1.zip')]", + "adPDCConfigurationFunction": "CreateADPDC.ps1\\CreateADPDC", + "adBDCModulesURL": "[concat(parameters('_artifactsLocation'),'/CreateADBDC.ps1.zip')]", + "adBDCConfigurationFunction": "CreateADBDC.ps1\\CreateADBDC", + "fswModulesURL": "[concat(parameters('_artifactsLocation'),'/CreateFileShareWitness.ps1.zip')]", + "fswConfigurationFunction": "CreateFileShareWitness.ps1\\CreateFileShareWitness", + "sqlAOPrepareModulesURL": "[concat(parameters('_artifactsLocation'),'/PrepareAlwaysOnSqlServer.ps1.zip')]", + "sqlAOPrepareConfigurationFunction": "PrepareAlwaysOnSqlServer.ps1\\PrepareAlwaysOnSqlServer", + "createClusterModulesURL": "[concat(parameters('_artifactsLocation'),'/CreateFailoverCluster.ps1.zip')]", + "createClusterConfigurationFunction": "CreateFailoverCluster.ps1\\CreateFailoverCluster" + } + }, + "resources": [ + { + "name": "[variables('nsgName')]", + "location": "[resourceGroup().location]", + "type": "Microsoft.Network/networkSecurityGroups", + "apiVersion": "2015-06-15", + "properties": { + "securityRules": [ + { + "name": "rule1", + "properties": { + "protocol": "*", + "sourcePortRange": "*", + "destinationPortRange": "*", + "sourceAddressPrefix": "*", + "destinationAddressPrefix": "*", + "access": "Allow", + "priority": 101, + "direction": "Inbound" + } + } + ] + } + }, + { + "name": "StorageAccountVirtualNetworkPublicIP", + "type": "Microsoft.Resources/deployments", + "apiVersion": "2015-01-01", + "comments": "This resource will create storage accounts for Active Directory, SQL Server, File Share Witness and Diagnostics. It will also create the Virtual Network and public IP addresses", + "dependsOn": [ + "[variables('nsgID')]" + ], + "properties": { + "mode": "Incremental", + "templateLink": { + "uri": "[variables('configuration').storageAccountVirtualNetworkPublicIP]", + "contentVersion": "1.0.0.0" + }, + "parameters": { + "location": { + "value": "[resourceGroup().location]" + }, + "sqlStorageAccountName": { + "value": "[parameters('sqlStorageAccountName')]" + }, + "dcStorageAccountName": { + "value": "[variables('dcStorageAccountName')]" + }, + "SqlStorageAccountType": { + "value": "[parameters('sqlStorageAccountType')]" + }, + "primaryDCIPAddressNameWithSuffix": { + "value": "[variables('primaryDCIPAddressNameWithSuffix')]" + }, + "sqlVMName": { + "value": "[variables('vmSettings').sqlVMName]" + }, + "sql1AddressNameWithSuffix": { + "value": "[variables('sql1AddressNameWithSuffix')]" + }, + "sql0AddressNameWithSuffix": { + "value": "[variables('sql0AddressNameWithSuffix')]" + }, + "virtualNetworkName": { + "value": "[variables('virtualNetworkNameWithSuffix')]" + }, + "virtualNetworkAddressRange": { + "value": "[parameters('virtualNetworkAddressRange')]" + }, + "subnets": { + "value": "[variables('subnets')]" + }, + "nsgID": { + "value": "[variables('nsgID')]" + }, + "dnsSuffix": { + "value": "[parameters('dnsSuffix')]" + } + } + } + }, + { + "name": "[variables('publicIPAddressName')]", + "type": "Microsoft.Network/publicIPAddresses", + "location": "[resourceGroup().location]", + "apiVersion": "2015-06-15", + "dependsOn": [ + "Microsoft.Resources/deployments/StorageAccountVirtualNetworkPublicIP" + ], + "properties": { + "publicIPAllocationMethod": "Static", + "dnsSettings": { + "domainNameLabel": "[variables('dnsPrefix')]", + "reverseFqdn": "[concat(variables('dnsPrefix'), '.', resourceGroup().location, '.cloudapp.', parameters('dnsSuffix'))]" + } + } + }, + { + "name": "LoadBalancers", + "type": "Microsoft.Resources/deployments", + "apiVersion": "2016-09-01", + "comments": "Create Load Balancers for SQL", + "dependsOn": [ + "[variables('ids').publicIPAddressID]" + ], + "properties": { + "mode": "Incremental", + "templateLink": { + "uri": "[variables('configuration').setupLBsUrl]", + "contentVersion": "1.0.0.0" + }, + "parameters": { + "location": { + "value": "[resourceGroup().location]" + }, + "sqlLBName": { + "value": "[variables('lbSettings').sqlLBName]" + }, + "sqlLBFE": { + "value": "[variables('lbSettings').sqlLBFE]" + }, + "sqlLBIPAddress": { + "value": "[variables('ids').publicIPAddressID]" + }, + "staticSubnetRef": { + "value": "[variables('sqlSubnetRef')]" + }, + "sqlLBBE": { + "value": "[variables('lbSettings').sqlLBBE]" + }, + "sqlLBBEID": { + "value": "[variables('derivedIds').sqlBEAddressPoolID]" + }, + "sqllbFEConfigID": { + "value": "[variables('derivedIds').sqllbFEConfigID]" + }, + "sqllbProbeID": { + "value": "[variables('derivedIds').sqllbProbeID]" + }, + "SQLAOProbe": { + "value": "[variables('SQLAOProbe')]" + } + } + } + }, + { + "name": "CreatingADNetworkInterface", + "type": "Microsoft.Resources/deployments", + "apiVersion": "2016-09-01", + "dependsOn": [ + "Microsoft.Resources/deployments/LoadBalancers" + ], + "properties": { + "mode": "Incremental", + "templateLink": { + "uri": "[variables('configuration').creatingADNICUrl]", + "contentVersion": "1.0.0.0" + }, + "parameters": { + "location": { + "value": "[resourceGroup().location]" + }, + "adPDCNicName": { + "value": "[variables('adPDCNicName')]" + }, + "adPDCNICIPAddress": { + "value": "[parameters('adPDCNICIPAddress')]" + }, + "staticSubnetRef": { + "value": "[variables('staticSubnetRef')]" + }, + "adBEAddressPoolID": { + "value": "[variables('derivedIds').adBEAddressPoolID]" + }, + "adRDPNATRuleID": { + "value": "[variables('derivedIds').adRDPNATRuleID]" + }, + "primaryDCIPAddressNameWithSuffix": { + "value": "[variables('primaryDCIPAddressNameWithSuffix')]" + } + } + } + }, + { + "name": "ProvisioningADVM", + "type": "Microsoft.Resources/deployments", + "apiVersion": "2016-09-01", + "dependsOn": [ + "Microsoft.Resources/deployments/CreatingADNetworkInterface" + ], + "properties": { + "mode": "Incremental", + "templateLink": { + "uri": "[variables('configuration').provisioningADVM]", + "contentVersion": "1.0.0.0" + }, + "parameters": { + "adPDCVMName": { + "value": "[variables('vmSettings').adPDCVMName]" + }, + "adAvailabilitySetName": { + "value": "[variables('vmSettings').availabilitySets.adAvailabilitySetName]" + }, + "dcStorageAccountName": { + "value": "[variables('dcStorageAccountName')]" + }, + "sqlStorageAccountName": { + "value": "[parameters('sqlStorageAccountName')]" + }, + "location": { + "value": "[resourceGroup().location]" + }, + "adVMSize": { + "value": "[parameters('adVMSize')]" + }, + "adminUsername": { + "value": "[parameters('adminUsername')]" + }, + "adminPassword": { + "value": "[parameters('adminPassword')]" + }, + "adImagePublisher": { + "value": "[variables('vmSettings').windowsImagePublisher]" + }, + "adImageOffer": { + "value": "[variables('vmSettings').windowsImageOffer]" + }, + "adImageSKU": { + "value": "[variables('vmSettings').windowsImageSKU]" + }, + "vmContainerName": { + "value": "[variables('vmSettings').vmContainerName]" + }, + "adPDCNicName": { + "value": "[variables('adPDCNicName')]" + }, + "domainName": { + "value": "[parameters('domainName')]" + }, + "adPDCConfigurationFunction": { + "value": "[variables('configuration').adPDCConfigurationFunction]" + }, + "adPDCModulesURL": { + "value": "[variables('configuration').adPDCModulesURL]" + } + } + } + }, + { + "name": "UpdatingDNStoPrimaryADVM", + "type": "Microsoft.Resources/deployments", + "apiVersion": "2016-09-01", + "dependsOn": [ + "Microsoft.Resources/deployments/ProvisioningADVM" + ], + "properties": { + "mode": "Incremental", + "templateLink": { + "uri": "[variables('configuration').vnetwithDNSTemplateURL]", + "contentVersion": "1.0.0.0" + }, + "parameters": { + "location": { + "value": "[resourceGroup().location]" + }, + "virtualNetworkName": { + "value": "[variables('virtualNetworkNameWithSuffix')]" + }, + "virtualNetworkAddressRange": { + "value": "[parameters('virtualNetworkAddressRange')]" + }, + "subnets": { + "value": "[variables('subnets')]" + }, + "DNSServerAddress": { + "value": [ + "[parameters('adPDCNICIPAddress')]" + ] + } + } + } + }, + { + "name": "CreatingNetworkInterfaces", + "type": "Microsoft.Resources/deployments", + "apiVersion": "2016-09-01", + "dependsOn": [ + "Microsoft.Resources/deployments/UpdatingDNStoPrimaryADVM" + ], + "properties": { + "mode": "Incremental", + "templateLink": { + "uri": "[variables('configuration').creatingNicsUrl]", + "contentVersion": "1.0.0.0" + }, + "parameters": { + "location": { + "value": "[resourceGroup().location]" + }, + "adPDCNICIPAddress": { + "value": "[parameters('adPDCNICIPAddress')]" + }, + "sqlVMName": { + "value": "[variables('vmSettings').sqlVMName]" + }, + "sqlSubnetRef": { + "value": "[variables('sqlSubnetRef')]" + }, + "sqlBEAddressPoolID": { + "value": "[variables('derivedIds').sqlBEAddressPoolID]" + }, + "sqlwNicName": { + "value": "[variables('sqlwNicName')]" + }, + "sql1AddressNameWithSuffix": { + "value": "[variables('sql1AddressNameWithSuffix')]" + }, + "sql0AddressNameWithSuffix": { + "value": "[variables('sql0AddressNameWithSuffix')]" + } + } + } + }, + { + "name": "ProvisioningSQLVMs", + "type": "Microsoft.Resources/deployments", + "apiVersion": "2016-09-01", + "dependsOn": [ + "Microsoft.Resources/deployments/CreatingNetworkInterfaces" + ], + "properties": { + "mode": "Incremental", + "templateLink": { + "uri": "[variables('configuration').provisioningSQLVMs]", + "contentVersion": "1.0.0.0" + }, + "parameters": { + "sqlAvailabilitySetName": { + "value": "[variables('vmSettings').availabilitySets.sqlAvailabilitySetName]" + }, + "sqlStorageAccountName": { + "value": "[parameters('sqlStorageAccountName')]" + }, + "location": { + "value": "[resourceGroup().location]" + }, + "adminUsername": { + "value": "[parameters('adminUsername')]" + }, + "adminPassword": { + "value": "[parameters('adminPassword')]" + }, + "vmContainerName": { + "value": "[variables('vmSettings').vmContainerName]" + }, + "sqlVMName": { + "value": "[variables('vmSettings').sqlVMName]" + }, + "sqlVMSize": { + "value": "[parameters('sqlVMSize')]" + }, + "vmDiskSize": { + "value": "[parameters('vmDiskSize')]" + }, + "fswImagePublisher": { + "value": "[variables('vmSettings').windowsImagePublisher]" + }, + "fswImageOffer": { + "value": "[variables('vmSettings').windowsImageOffer]" + }, + "fswImageSKU": { + "value": "[variables('vmSettings').windowsImageSKU]" + }, + "sqlImageOffer": { + "value": "[parameters('sqlServerOffer')]" + }, + "numberOfDisks": { + "value": "[parameters('numberOfSqlVMDisks')]" + }, + "sqlImageSKU": { + "value": "[parameters('sqlServerSku')]" + }, + "witnessVMSize": { + "value": "[parameters('witnessVMSize')]" + }, + "sqlwVMName": { + "value": "[variables('vmSettings').sqlwVMName]" + }, + "sqlwNicName": { + "value": "[variables('sqlwNicName')]" + } + } + } + }, + { + "name": "PreparingAlwaysOnSqlServer", + "type": "Microsoft.Resources/deployments", + "apiVersion": "2016-09-01", + "dependsOn": [ + "Microsoft.Resources/deployments/ProvisioningSQLVMs" + ], + "properties": { + "mode": "Incremental", + "templateLink": { + "uri": "[variables('configuration').preparingAlwaysOnSqlServer]", + "contentVersion": "1.0.0.0" + }, + "parameters": { + "sqlVMName": { + "value": "[variables('vmSettings').sqlVMName]" + }, + "location": { + "value": "[resourceGroup().location]" + }, + "adminUsername": { + "value": "[parameters('adminUsername')]" + }, + "adminPassword": { + "value": "[parameters('adminPassword')]" + }, + "domainName": { + "value": "[parameters('domainName')]" + }, + "sqlAOPrepareModulesURL": { + "value": "[variables('configuration').sqlAOPrepareModulesURL]" + }, + "sqlAOPrepareConfigurationFunction": { + "value": "[variables('configuration').sqlAOPrepareConfigurationFunction]" + }, + "sqlAOEPName": { + "value": "[variables('sqlAOEPName')]" + }, + "sqlServerServiceAccountUserName": { + "value": "[parameters('sqlServerServiceAccountUserName')]" + }, + "sqlServerServiceAccountPassword": { + "value": "[parameters('sqlServerServiceAccountPassword')]" + }, + "sqlAuthUserName": { + "value": "[parameters('sqlAuthUserName')]" + }, + "sqlAuthPassword": { + "value": "[parameters('sqlAuthPassword')]" + }, + "sharePath": { + "value": "[variables('sharePath')]" + }, + "adPDCVMName": { + "value": "[variables('vmSettings').adPDCVMName]" + }, + "sqlwVMName": { + "value": "[variables('vmSettings').sqlwVMName]" + }, + "fswModulesURL": { + "value": "[variables('configuration').fswModulesURL]" + }, + "fswConfigurationFunction": { + "value": "[variables('configuration').fswConfigurationFunction]" + }, + "autoPatchingDay": { + "value": "[parameters('autoPatchingDay')]" + }, + "autoPatchingStartHour": { + "value": "[parameters('autoPatchingStartHour')]" + }, + "autoPatchingEnable": { + "value": "[variables(parameters('autoPatchingDay'))]" + }, + "numberOfDisks": { + "value": "[parameters('numberOfSqlVMDisks')]" + }, + "workloadType": { + "value": "[parameters('workloadType')]" + } + } + } + }, + { + "name": "ConfiguringAlwaysOn", + "type": "Microsoft.Resources/deployments", + "apiVersion": "2016-09-01", + "dependsOn": [ + "Microsoft.Resources/deployments/PreparingAlwaysOnSqlServer" + ], + "properties": { + "mode": "Incremental", + "templateLink": { + "uri": "[variables('configuration').configuringAlwaysOn]", + "contentVersion": "1.0.0.0" + }, + "parameters": { + "sqlVMName": { + "value": "[variables('vmSettings').sqlVMName]" + }, + "location": { + "value": "[resourceGroup().location]" + }, + "adminUsername": { + "value": "[parameters('adminUsername')]" + }, + "adminPassword": { + "value": "[parameters('adminPassword')]" + }, + "domainName": { + "value": "[parameters('domainName')]" + }, + "sqlAOEPName": { + "value": "[variables('sqlAOEPName')]" + }, + "sqlServerServiceAccountUserName": { + "value": "[parameters('sqlServerServiceAccountUserName')]" + }, + "sqlServerServiceAccountPassword": { + "value": "[parameters('sqlServerServiceAccountPassword')]" + }, + "createClusterModulesURL": { + "value": "[variables('configuration').createClusterModulesURL]" + }, + "createClusterConfigurationFunction": { + "value": "[variables('configuration').createClusterConfigurationFunction]" + }, + "clusterName": { + "value": "[variables('clusterName')]" + }, + "sharePath": { + "value": "[variables('sharePath')]" + }, + "sqlAOAGName": { + "value": "[parameters('sqlAOAGName')]" + }, + "sqlAOListenerName": { + "value": "[parameters('sqlAOListenerName')]" + }, + "sqlAOListenerPort": { + "value": "[parameters('sqlAOListenerPort')]" + }, + "sqlLBName": { + "value": "[variables('lbSettings').sqlLBName]" + }, + "sqlLBIPAddress": { + "value": "[reference(variables('ids').publicIPAddressID).ipAddress]" + }, + "adPDCVMName": { + "value": "[variables('vmSettings').adPDCVMName]" + }, + "sqlwVMName": { + "value": "[variables('vmSettings').sqlwVMName]" + }, + "numberOfDataDisks": { + "value": "[parameters('numberOfSqlVMDisks')]" + }, + "workloadType": { + "value": "[parameters('workloadType')]" + }, + "databaseName": { + "value": "[parameters('sampleDatabaseName')]" + } + } + } + } + ], + "outputs": {} + } \ No newline at end of file diff --git a/sql-2016-alwayson/azuredeploy.json.bak b/sql-2016-alwayson/azuredeploy.json.bak new file mode 100644 index 00000000..d9827351 --- /dev/null +++ b/sql-2016-alwayson/azuredeploy.json.bak @@ -0,0 +1,975 @@ + { + "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "_artifactsLocation": { + "type": "string", + "metadata": { + "description": "Artifacts base url" + }, + "defaultValue": "https://raw.githubusercontent.com/Azure/AzureStack-QuickStart-Templates/master/sql-2016-alwayson" + }, + "adminUsername": { + "type": "string", + "metadata": { + "description": "The name of the Administrator of the new VMs and Domain" + }, + "defaultValue": "localadmin" + }, + "adminPassword": { + "type": "securestring", + "metadata": { + "description": "The password for the Administrator account of the new VMs and Domain" + } + }, + "adVMSize": { + "type": "string", + "allowedValues": [ + "Standard_D1_v2", + "Standard_D2_v2" + ], + "metadata": { + "description": "The size of the AD VMs Created" + }, + "defaultValue": "Standard_D2_v2" + }, + "witnessVMSize": { + "type": "string", + "allowedValues": [ + "Standard_D1_v2", + "Standard_D2_v2" + ], + "metadata": { + "description": "The size of the Witness VM Created" + }, + "defaultValue": "Standard_D1_v2" + }, + "domainName": { + "type": "string", + "metadata": { + "description": "The FQDN of the AD Domain created " + }, + "defaultValue": "fabrikam.local" + }, + "dnsSuffix": { + "type": "string", + "metadata": { + "description": "The DNS Suffix for reverse lookup of public IPAddresses" + } + }, + "virtualNetworkAddressRange": { + "type": "string", + "metadata": { + "description": "The address range of the new VNET in CIDR format" + }, + "defaultValue": "10.0.0.0/16" + }, + "staticSubnet": { + "type": "string", + "metadata": { + "description": "The address range of the subnet static IPs are allocated from in the new VNET" + }, + "defaultValue": "10.0.0.0/24" + }, + "sqlSubnet": { + "type": "string", + "metadata": { + "description": "The address range of the SQL subnet created in the new VNET" + }, + "defaultValue": "10.0.1.0/26" + }, + "adPDCNICIPAddress": { + "type": "string", + "metadata": { + "description": "The IP address of the new AD VM" + }, + "defaultValue": "10.0.0.250" + }, + "deploymentPrefix": { + "type": "string", + "metadata": { + "description": "The DNS Prefix for the Public IP Address for the Always On Cluster" + }, + "defaultValue": "aodns" + }, + "virtualNetworkName": { + "type": "string", + "metadata": { + "description": "Name of virtual network to be created" + }, + "defaultValue": "sqlhaVNET" + }, + "sqlServerServiceAccountUserName": { + "type": "string", + "metadata": { + "description": "The SQL Server Service Account name" + }, + "defaultValue": "sqlservice" + }, + "sqlServerServiceAccountPassword": { + "type": "securestring", + "metadata": { + "description": "The SQL Server Service Account password" + } + }, + "sqlAuthUserName": { + "type": "string", + "metadata": { + "description": "The SQL Server Auth Account name" + }, + "defaultValue": "sqlsa" + }, + "sqlAuthPassword": { + "type": "securestring", + "metadata": { + "description": "The SQL Server Auth Account password" + } + }, + "sqlStorageAccountName": { + "type": "string", + "metadata": { + "description": "The name of Sql Server Storage Account" + }, + "defaultValue": "[tolower(concat(take(uniqueString(resourceGroup().id),8),'sql'))]" + }, + "sqlStorageAccountType": { + "type": "string", + "allowedValues": [ + "Premium_LRS", + "Standard_LRS" + ], + "metadata": { + "description": "The type of the Sql Server Storage Account created" + }, + "defaultValue": "Premium_LRS" + }, + "sqlServerOffer": { + "type": "string", + "allowedValues": [ + "SQL2016SP1-WS2016", + "SQL2016SP2-WS2016" + ], + "metadata": { + "description": "The SQL Server Version" + }, + "defaultValue": "SQL2016SP2-WS2016" + }, + "sqlServerSku": { + "type": "string", + "allowedValues": [ + "Enterprise", + "Standard", + "SQLDEV" + ], + "metadata": { + "description": "The SQL Edition" + }, + "defaultValue": "Enterprise" + }, + "sqlVMSize": { + "type": "string", + "allowedValues": [ + "Standard_DS2_v2", + "Standard_DS3_v2", + "Standard_DS4_v2", + "Standard_DS5_v2", + "Standard_DS11_v2", + "Standard_DS12_v2", + "Standard_DS13_v2" + ], + "metadata": { + "description": "The size of the SQL VMs Created" + }, + "defaultValue": "Standard_DS2_v2" + }, + "sqlAOAGName": { + "type": "string", + "metadata": { + "description": "The Sql AlwaysOn Group Name" + }, + "defaultValue": "sqlaa-ag" + }, + "sqlAOListenerName": { + "type": "string", + "metadata": { + "description": "The Sql AG Listener Name" + }, + "defaultValue": "[tolower(concat('ao-listen-' , resourceGroup().name))]" + }, + "sqlAOListenerPort": { + "type": "string", + "metadata": { + "description": "The Sql AG Listener port" + }, + "defaultValue": "1433" + }, + "workloadType": { + "type": "string", + "allowedValues": [ + "GENERAL", "OLTP", "DW" + ], + "metadata": { + "description": "The Sql VM work load type" + }, + "defaultValue": "GENERAL" + }, + "vmDiskSize": { + "type": "string", + "allowedValues": [ + "128", + "256", + "512", + "1023" + ], + "metadata": { + "description": "The size of the SQL VM data disks in GB." + }, + "defaultValue": "128" + }, + "numberOfSqlVMDisks": { + "type": "int", + "metadata": { + "description": "Number of data disks (subject to VM size limitations)" + }, + "minValue": 1, + "maxValue": 32, + "defaultValue": 2 + }, + "sampleDatabaseName": { + "type": "string", + "metadata": { + "description": "Sample HA database" + }, + "defaultValue": "AutoHa-sample" + }, + "autoPatchingDay": { + "type": "string", + "allowedValues": [ + "Never", + "Everyday", + "Sunday", + "Monday", + "Tuesday", + "Wednesday", + "Thursday", + "Friday", + "Saturday" + ], + "metadata": { + "description": "The day of a week for auto patching" + }, + "defaultValue": "Sunday" + }, + "autoPatchingStartHour": { + "type": "string", + "allowedValues": [ + "0", + "1", + "2", + "3", + "4", + "5", + "6", + "7", + "8", + "9", + "10", + "11", + "12", + "13", + "14", + "15", + "16", + "17", + "18", + "19", + "20", + "21", + "22", + "23" + ], + "metadata": { + "description": "The start hour of a day for auto patching" + }, + "defaultValue": "2" + } + }, + "variables": { + "lbSettings": { + "rdpLBFE": "rdpLBFE", + "sqlLBFE": "sqlLBFE", + "adLBBE": "adLBBE", + "sqlLBBE": "sqlLBBE", + "rdpLBName": "rdpLoadBalancer", + "sqlLBName": "sqlLoadBalancer" + }, + "subnetNames": { + "staticSubnetName": "staticSubnet", + "sqlSubnetName": "sqlSubnet" + }, + "RDPNAT": "RDP", + "SQLAOProbe": "SQLAlwaysOnEndPointProbe", + "primaryDCIPAddressName": "primaryDCIP", + "sql1AddressName": "sql1IP", + "sql0AddressName": "sql0IP", + "vmSettings": { + "availabilitySets": { + "sqlAvailabilitySetName": "sqlAvailabilitySet", + "adAvailabilitySetName": "adAvailabilitySet" + }, + "vmContainerName": "vhds", + "adPDCVMName": "[substring(concat('priDC-', uniquestring(replace(resourceGroup().Id,'-',''))), 0, 8)]", + "sqlVMName": "[substring(concat('sql-', uniquestring(replace(resourceGroup().Id,'-',''))), 0, 8)]", + "sqlwVMName": "[substring(concat('fsw-', uniquestring(replace(resourceGroup().Id,'-',''))), 0, 8)]", + "windowsImagePublisher": "MicrosoftWindowsServer", + "windowsImageOffer": "WindowsServer", + "windowsImageSKU": "2016-Datacenter" + }, + "sqlAOEPName": "[concat(parameters('deploymentPrefix'),'-hadr')]", + "sharePath": "[concat(parameters('deploymentPrefix'),'-fsw')]", + "clusterName": "[concat(parameters('deploymentPrefix'),'-fc')]", + "adPDCNicName": "[concat(variables('vmSettings').adPDCVMName,'-nic')]", + "sqlwNicName": "[concat(variables('vmSettings').sqlwVMName,'-nic')]", + "VnetID": "[resourceId('Microsoft.Network/virtualNetworks', variables('virtualNetworkNameWithSuffix'))]", + "staticSubnetRef": "[concat(variables('VnetID'),'/subnets/',variables('subnetNames').staticSubnetName)]", + "sqlSubnetRef": "[concat(variables('VnetID'),'/subnets/',variables('subnetNames').sqlSubnetName)]", + "dnsPrefix": "[parameters('sqlAOListenerName')]", + "publicIPAddressName": "[concat('SQLPIP',resourceGroup().name)]", + "ids": { + "adNicId": "[resourceId('Microsoft.Network/networkInterfaces',variables('adPDCNicName'))]", + "rdplbID": "[resourceId('Microsoft.Network/loadBalancers',variables('lbSettings').rdpLBName)]", + "sqllbID": "[resourceId('Microsoft.Network/loadBalancers',variables('lbSettings').sqlLBName)]", + "publicIPAddressID": "[resourceId('Microsoft.Network/publicIPAddresses',variables('publicIPAddressName'))]" + }, + "derivedIds": { + "adIPConfigID": "[concat(variables('ids').adNicId,'/ipConfigurations/ipconfig1')]", + "rdplbFEConfigID": "[concat(variables('ids').rdplbID,'/frontendIPConfigurations/',variables('lbSettings').rdpLBFE)]", + "adRDPNATRuleID": "[concat(variables('ids').rdplbID,'/inboundNatRules/',variables('RDPNAT'))]", + "adBEAddressPoolID": "[concat(variables('ids').rdplbID,'/backendAddressPools/',variables('lbSettings').adLBBE)]", + "sqlBEAddressPoolID": "[concat(variables('ids').sqllbID,'/backendAddressPools/',variables('lbSettings').sqlLBBE)]", + "sqllbFEConfigID": "[concat(variables('ids').sqllbID,'/frontendIPConfigurations/',variables('lbSettings').sqlLBFE)]", + "sqllbProbeID": "[concat(variables('ids').sqllbID,'/probes/',variables('SQLAOProbe'))]" + }, + "Monday": true, + "Tuesday": true, + "Wednesday": true, + "Thursday": true, + "Friday": true, + "Saturday": true, + "Sunday": true, + "Never": false, + "Everyday": true, + "nsgName": "[concat('Nsg',resourceGroup().name)]", + "nsgID": "[resourceId('Microsoft.Network/networkSecurityGroups',variables('nsgName'))]", + "subnets": [ + { + "name": "[variables('subnetNames').staticSubnetName]", + "properties": { + "addressPrefix": "[parameters('staticSubnet')]", + "networkSecurityGroup": { + "id": "[variables('nsgID')]" + } + } + }, + { + "name": "[variables('subnetNames').sqlSubnetName]", + "properties": { + "addressPrefix": "[parameters('sqlSubnet')]", + "networkSecurityGroup": { + "id": "[variables('nsgID')]" + } + } + } + ], + "virtualNetworkNameWithSuffix": "[substring(concat(parameters('virtualNetworkName'), uniqueString(parameters('sqlStorageAccountName'))),0,15)]", + "primaryDCIPAddressNameWithSuffix": "[substring(concat(variables('primaryDCIPAddressName'), uniqueString(parameters('sqlStorageAccountName'))),0,15)]", + "sql1AddressNameWithSuffix": "[substring(concat(variables('sql1AddressName'), uniqueString(parameters('sqlStorageAccountName'))),0,15)]", + "sql0AddressNameWithSuffix": "[substring(concat(variables('sql0AddressName'), uniqueString(parameters('sqlStorageAccountName'))),0,15)]", + "dcStorageAccountName": "[concat(substring(concat(parameters('sqlStorageAccountName'), uniqueString(parameters('sqlStorageAccountName'))),0,18),'dc')]", + "configuration": { + "vnetwithDNSTemplateURL": "[concat(parameters('_artifactsLocation'),'/vnet-with-dns-server.json')]", + "rdpIPAdressSetupURL": "[concat(parameters('_artifactsLocation'),'/publicip-rdp.json')]", + "setupLBsUrl": "[concat(parameters('_artifactsLocation'), '/setupLBs-e.json')]", + "creatingADNICUrl": "[concat(parameters('_artifactsLocation'),'/creatingADNIC.json')]", + "creatingNicsUrl": "[concat(parameters('_artifactsLocation'),'/creatingNICS.json')]", + "storageAccountVirtualNetworkPublicIP": "[concat(parameters('_artifactsLocation'),'/storageAccountVirtualNetworkPublicIP.json')]", + "provisioningADVM": "[concat(parameters('_artifactsLocation'),'/provisioningADVM','.json')]", + "provisioningSQLVMs": "[concat(parameters('_artifactsLocation'),'/provisioningSQLVMs.json')]", + "configuringBackupADVM": "[concat(parameters('_artifactsLocation'),'/configuringBackupADVM.json')]", + "preparingAlwaysOnSqlServer": "[concat(parameters('_artifactsLocation'),'/preparingSqlServer.json')]", + "configuringAlwaysOn": "[concat(parameters('_artifactsLocation'),'/configuringAlwaysOn.json')]", + "adPDCModulesURL": "[concat(parameters('_artifactsLocation'),'/CreateADPDC.ps1.zip')]", + "adPDCConfigurationFunction": "CreateADPDC.ps1\\CreateADPDC", + "adBDCModulesURL": "[concat(parameters('_artifactsLocation'),'/CreateADBDC.ps1.zip')]", + "adBDCConfigurationFunction": "CreateADBDC.ps1\\CreateADBDC", + "fswModulesURL": "[concat(parameters('_artifactsLocation'),'/CreateFileShareWitness.ps1.zip')]", + "fswConfigurationFunction": "CreateFileShareWitness.ps1\\CreateFileShareWitness", + "sqlAOPrepareModulesURL": "[concat(parameters('_artifactsLocation'),'/PrepareAlwaysOnSqlServer.ps1.zip')]", + "sqlAOPrepareConfigurationFunction": "PrepareAlwaysOnSqlServer.ps1\\PrepareAlwaysOnSqlServer", + "createClusterModulesURL": "[concat(parameters('_artifactsLocation'),'/CreateFailoverCluster.ps1.zip')]", + "createClusterConfigurationFunction": "CreateFailoverCluster.ps1\\CreateFailoverCluster" + } + }, + "resources": [ + { + "name": "[variables('nsgName')]", + "location": "[resourceGroup().location]", + "type": "Microsoft.Network/networkSecurityGroups", + "apiVersion": "2015-06-15", + "properties": { + "securityRules": [ + { + "name": "rule1", + "properties": { + "protocol": "*", + "sourcePortRange": "*", + "destinationPortRange": "*", + "sourceAddressPrefix": "*", + "destinationAddressPrefix": "*", + "access": "Allow", + "priority": 101, + "direction": "Inbound" + } + } + ] + } + }, + { + "name": "StorageAccountVirtualNetworkPublicIP", + "type": "Microsoft.Resources/deployments", + "apiVersion": "2015-01-01", + "comments": "This resource will create storage accounts for Active Directory, SQL Server, File Share Witness and Diagnostics. It will also create the Virtual Network and public IP addresses", + "dependsOn": [ + "[variables('nsgID')]" + ], + "properties": { + "mode": "Incremental", + "templateLink": { + "uri": "[variables('configuration').storageAccountVirtualNetworkPublicIP]", + "contentVersion": "1.0.0.0" + }, + "parameters": { + "location": { + "value": "[resourceGroup().location]" + }, + "sqlStorageAccountName": { + "value": "[parameters('sqlStorageAccountName')]" + }, + "dcStorageAccountName": { + "value": "[variables('dcStorageAccountName')]" + }, + "SqlStorageAccountType": { + "value": "[parameters('sqlStorageAccountType')]" + }, + "primaryDCIPAddressNameWithSuffix": { + "value": "[variables('primaryDCIPAddressNameWithSuffix')]" + }, + "sqlVMName": { + "value": "[variables('vmSettings').sqlVMName]" + }, + "sql1AddressNameWithSuffix": { + "value": "[variables('sql1AddressNameWithSuffix')]" + }, + "sql0AddressNameWithSuffix": { + "value": "[variables('sql0AddressNameWithSuffix')]" + }, + "virtualNetworkName": { + "value": "[variables('virtualNetworkNameWithSuffix')]" + }, + "virtualNetworkAddressRange": { + "value": "[parameters('virtualNetworkAddressRange')]" + }, + "subnets": { + "value": "[variables('subnets')]" + }, + "nsgID": { + "value": "[variables('nsgID')]" + }, + "dnsSuffix": { + "value": "[parameters('dnsSuffix')]" + } + } + } + }, + { + "name": "[variables('publicIPAddressName')]", + "type": "Microsoft.Network/publicIPAddresses", + "location": "[resourceGroup().location]", + "apiVersion": "2015-06-15", + "dependsOn": [ + "Microsoft.Resources/deployments/StorageAccountVirtualNetworkPublicIP" + ], + "properties": { + "publicIPAllocationMethod": "Static", + "dnsSettings": { + "domainNameLabel": "[variables('dnsPrefix')]", + "reverseFqdn": "[concat(variables('dnsPrefix'), '.', resourceGroup().location, '.cloudapp.', parameters('dnsSuffix'))]" + } + } + }, + { + "name": "LoadBalancers", + "type": "Microsoft.Resources/deployments", + "apiVersion": "2016-09-01", + "comments": "Create Load Balancers for SQL", + "dependsOn": [ + "[variables('ids').publicIPAddressID]" + ], + "properties": { + "mode": "Incremental", + "templateLink": { + "uri": "[variables('configuration').setupLBsUrl]", + "contentVersion": "1.0.0.0" + }, + "parameters": { + "location": { + "value": "[resourceGroup().location]" + }, + "sqlLBName": { + "value": "[variables('lbSettings').sqlLBName]" + }, + "sqlLBFE": { + "value": "[variables('lbSettings').sqlLBFE]" + }, + "sqlLBIPAddress": { + "value": "[variables('ids').publicIPAddressID]" + }, + "staticSubnetRef": { + "value": "[variables('sqlSubnetRef')]" + }, + "sqlLBBE": { + "value": "[variables('lbSettings').sqlLBBE]" + }, + "sqlLBBEID": { + "value": "[variables('derivedIds').sqlBEAddressPoolID]" + }, + "sqllbFEConfigID": { + "value": "[variables('derivedIds').sqllbFEConfigID]" + }, + "sqllbProbeID": { + "value": "[variables('derivedIds').sqllbProbeID]" + }, + "SQLAOProbe": { + "value": "[variables('SQLAOProbe')]" + } + } + } + }, + { + "name": "CreatingADNetworkInterface", + "type": "Microsoft.Resources/deployments", + "apiVersion": "2016-09-01", + "dependsOn": [ + "Microsoft.Resources/deployments/LoadBalancers" + ], + "properties": { + "mode": "Incremental", + "templateLink": { + "uri": "[variables('configuration').creatingADNICUrl]", + "contentVersion": "1.0.0.0" + }, + "parameters": { + "location": { + "value": "[resourceGroup().location]" + }, + "adPDCNicName": { + "value": "[variables('adPDCNicName')]" + }, + "adPDCNICIPAddress": { + "value": "[parameters('adPDCNICIPAddress')]" + }, + "staticSubnetRef": { + "value": "[variables('staticSubnetRef')]" + }, + "adBEAddressPoolID": { + "value": "[variables('derivedIds').adBEAddressPoolID]" + }, + "adRDPNATRuleID": { + "value": "[variables('derivedIds').adRDPNATRuleID]" + }, + "primaryDCIPAddressNameWithSuffix": { + "value": "[variables('primaryDCIPAddressNameWithSuffix')]" + } + } + } + }, + { + "name": "ProvisioningADVM", + "type": "Microsoft.Resources/deployments", + "apiVersion": "2016-09-01", + "dependsOn": [ + "Microsoft.Resources/deployments/CreatingADNetworkInterface" + ], + "properties": { + "mode": "Incremental", + "templateLink": { + "uri": "[variables('configuration').provisioningADVM]", + "contentVersion": "1.0.0.0" + }, + "parameters": { + "adPDCVMName": { + "value": "[variables('vmSettings').adPDCVMName]" + }, + "adAvailabilitySetName": { + "value": "[variables('vmSettings').availabilitySets.adAvailabilitySetName]" + }, + "dcStorageAccountName": { + "value": "[variables('dcStorageAccountName')]" + }, + "sqlStorageAccountName": { + "value": "[parameters('sqlStorageAccountName')]" + }, + "location": { + "value": "[resourceGroup().location]" + }, + "adVMSize": { + "value": "[parameters('adVMSize')]" + }, + "adminUsername": { + "value": "[parameters('adminUsername')]" + }, + "adminPassword": { + "value": "[parameters('adminPassword')]" + }, + "adImagePublisher": { + "value": "[variables('vmSettings').windowsImagePublisher]" + }, + "adImageOffer": { + "value": "[variables('vmSettings').windowsImageOffer]" + }, + "adImageSKU": { + "value": "[variables('vmSettings').windowsImageSKU]" + }, + "vmContainerName": { + "value": "[variables('vmSettings').vmContainerName]" + }, + "adPDCNicName": { + "value": "[variables('adPDCNicName')]" + }, + "domainName": { + "value": "[parameters('domainName')]" + }, + "adPDCConfigurationFunction": { + "value": "[variables('configuration').adPDCConfigurationFunction]" + }, + "adPDCModulesURL": { + "value": "[variables('configuration').adPDCModulesURL]" + } + } + } + }, + { + "name": "UpdatingDNStoPrimaryADVM", + "type": "Microsoft.Resources/deployments", + "apiVersion": "2016-09-01", + "dependsOn": [ + "Microsoft.Resources/deployments/ProvisioningADVM" + ], + "properties": { + "mode": "Incremental", + "templateLink": { + "uri": "[variables('configuration').vnetwithDNSTemplateURL]", + "contentVersion": "1.0.0.0" + }, + "parameters": { + "location": { + "value": "[resourceGroup().location]" + }, + "virtualNetworkName": { + "value": "[variables('virtualNetworkNameWithSuffix')]" + }, + "virtualNetworkAddressRange": { + "value": "[parameters('virtualNetworkAddressRange')]" + }, + "subnets": { + "value": "[variables('subnets')]" + }, + "DNSServerAddress": { + "value": [ + "[parameters('adPDCNICIPAddress')]" + ] + } + } + } + }, + { + "name": "CreatingNetworkInterfaces", + "type": "Microsoft.Resources/deployments", + "apiVersion": "2016-09-01", + "dependsOn": [ + "Microsoft.Resources/deployments/UpdatingDNStoPrimaryADVM" + ], + "properties": { + "mode": "Incremental", + "templateLink": { + "uri": "[variables('configuration').creatingNicsUrl]", + "contentVersion": "1.0.0.0" + }, + "parameters": { + "location": { + "value": "[resourceGroup().location]" + }, + "adPDCNICIPAddress": { + "value": "[parameters('adPDCNICIPAddress')]" + }, + "sqlVMName": { + "value": "[variables('vmSettings').sqlVMName]" + }, + "sqlSubnetRef": { + "value": "[variables('sqlSubnetRef')]" + }, + "sqlBEAddressPoolID": { + "value": "[variables('derivedIds').sqlBEAddressPoolID]" + }, + "sqlwNicName": { + "value": "[variables('sqlwNicName')]" + }, + "sql1AddressNameWithSuffix": { + "value": "[variables('sql1AddressNameWithSuffix')]" + }, + "sql0AddressNameWithSuffix": { + "value": "[variables('sql0AddressNameWithSuffix')]" + } + } + } + }, + { + "name": "ProvisioningSQLVMs", + "type": "Microsoft.Resources/deployments", + "apiVersion": "2016-09-01", + "dependsOn": [ + "Microsoft.Resources/deployments/CreatingNetworkInterfaces" + ], + "properties": { + "mode": "Incremental", + "templateLink": { + "uri": "[variables('configuration').provisioningSQLVMs]", + "contentVersion": "1.0.0.0" + }, + "parameters": { + "sqlAvailabilitySetName": { + "value": "[variables('vmSettings').availabilitySets.sqlAvailabilitySetName]" + }, + "sqlStorageAccountName": { + "value": "[parameters('sqlStorageAccountName')]" + }, + "location": { + "value": "[resourceGroup().location]" + }, + "adminUsername": { + "value": "[parameters('adminUsername')]" + }, + "adminPassword": { + "value": "[parameters('adminPassword')]" + }, + "vmContainerName": { + "value": "[variables('vmSettings').vmContainerName]" + }, + "sqlVMName": { + "value": "[variables('vmSettings').sqlVMName]" + }, + "sqlVMSize": { + "value": "[parameters('sqlVMSize')]" + }, + "vmDiskSize": { + "value": "[parameters('vmDiskSize')]" + }, + "fswImagePublisher": { + "value": "[variables('vmSettings').windowsImagePublisher]" + }, + "fswImageOffer": { + "value": "[variables('vmSettings').windowsImageOffer]" + }, + "fswImageSKU": { + "value": "[variables('vmSettings').windowsImageSKU]" + }, + "sqlImageOffer": { + "value": "[parameters('sqlServerOffer')]" + }, + "numberOfDisks": { + "value": "[parameters('numberOfSqlVMDisks')]" + }, + "sqlImageSKU": { + "value": "[parameters('sqlServerSku')]" + }, + "witnessVMSize": { + "value": "[parameters('witnessVMSize')]" + }, + "sqlwVMName": { + "value": "[variables('vmSettings').sqlwVMName]" + }, + "sqlwNicName": { + "value": "[variables('sqlwNicName')]" + } + } + } + }, + { + "name": "PreparingAlwaysOnSqlServer", + "type": "Microsoft.Resources/deployments", + "apiVersion": "2016-09-01", + "dependsOn": [ + "Microsoft.Resources/deployments/ProvisioningSQLVMs" + ], + "properties": { + "mode": "Incremental", + "templateLink": { + "uri": "[variables('configuration').preparingAlwaysOnSqlServer]", + "contentVersion": "1.0.0.0" + }, + "parameters": { + "sqlVMName": { + "value": "[variables('vmSettings').sqlVMName]" + }, + "location": { + "value": "[resourceGroup().location]" + }, + "adminUsername": { + "value": "[parameters('adminUsername')]" + }, + "adminPassword": { + "value": "[parameters('adminPassword')]" + }, + "domainName": { + "value": "[parameters('domainName')]" + }, + "sqlAOPrepareModulesURL": { + "value": "[variables('configuration').sqlAOPrepareModulesURL]" + }, + "sqlAOPrepareConfigurationFunction": { + "value": "[variables('configuration').sqlAOPrepareConfigurationFunction]" + }, + "sqlAOEPName": { + "value": "[variables('sqlAOEPName')]" + }, + "sqlServerServiceAccountUserName": { + "value": "[parameters('sqlServerServiceAccountUserName')]" + }, + "sqlServerServiceAccountPassword": { + "value": "[parameters('sqlServerServiceAccountPassword')]" + }, + "sqlAuthUserName": { + "value": "[parameters('sqlAuthUserName')]" + }, + "sqlAuthPassword": { + "value": "[parameters('sqlAuthPassword')]" + }, + "sharePath": { + "value": "[variables('sharePath')]" + }, + "adPDCVMName": { + "value": "[variables('vmSettings').adPDCVMName]" + }, + "sqlwVMName": { + "value": "[variables('vmSettings').sqlwVMName]" + }, + "fswModulesURL": { + "value": "[variables('configuration').fswModulesURL]" + }, + "fswConfigurationFunction": { + "value": "[variables('configuration').fswConfigurationFunction]" + }, + "autoPatchingDay": { + "value": "[parameters('autoPatchingDay')]" + }, + "autoPatchingStartHour": { + "value": "[parameters('autoPatchingStartHour')]" + }, + "autoPatchingEnable": { + "value": "[variables(parameters('autoPatchingDay'))]" + }, + "numberOfDisks": { + "value": "[parameters('numberOfSqlVMDisks')]" + }, + "workloadType": { + "value": "[parameters('workloadType')]" + } + } + } + }, + { + "name": "ConfiguringAlwaysOn", + "type": "Microsoft.Resources/deployments", + "apiVersion": "2016-09-01", + "dependsOn": [ + "Microsoft.Resources/deployments/PreparingAlwaysOnSqlServer" + ], + "properties": { + "mode": "Incremental", + "templateLink": { + "uri": "[variables('configuration').configuringAlwaysOn]", + "contentVersion": "1.0.0.0" + }, + "parameters": { + "sqlVMName": { + "value": "[variables('vmSettings').sqlVMName]" + }, + "location": { + "value": "[resourceGroup().location]" + }, + "adminUsername": { + "value": "[parameters('adminUsername')]" + }, + "adminPassword": { + "value": "[parameters('adminPassword')]" + }, + "domainName": { + "value": "[parameters('domainName')]" + }, + "sqlAOEPName": { + "value": "[variables('sqlAOEPName')]" + }, + "sqlServerServiceAccountUserName": { + "value": "[parameters('sqlServerServiceAccountUserName')]" + }, + "sqlServerServiceAccountPassword": { + "value": "[parameters('sqlServerServiceAccountPassword')]" + }, + "createClusterModulesURL": { + "value": "[variables('configuration').createClusterModulesURL]" + }, + "createClusterConfigurationFunction": { + "value": "[variables('configuration').createClusterConfigurationFunction]" + }, + "clusterName": { + "value": "[variables('clusterName')]" + }, + "sharePath": { + "value": "[variables('sharePath')]" + }, + "sqlAOAGName": { + "value": "[parameters('sqlAOAGName')]" + }, + "sqlAOListenerName": { + "value": "[parameters('sqlAOListenerName')]" + }, + "sqlAOListenerPort": { + "value": "[parameters('sqlAOListenerPort')]" + }, + "sqlLBName": { + "value": "[variables('lbSettings').sqlLBName]" + }, + "sqlLBIPAddress": { + "value": "[reference(variables('ids').publicIPAddressID).ipAddress]" + }, + "adPDCVMName": { + "value": "[variables('vmSettings').adPDCVMName]" + }, + "sqlwVMName": { + "value": "[variables('vmSettings').sqlwVMName]" + }, + "numberOfDataDisks": { + "value": "[parameters('numberOfSqlVMDisks')]" + }, + "workloadType": { + "value": "[parameters('workloadType')]" + }, + "databaseName": { + "value": "[parameters('sampleDatabaseName')]" + } + } + } + } + ], + "outputs": {} + } \ No newline at end of file diff --git a/sql-2016-alwayson/azuredeploy.parameters.json b/sql-2016-alwayson/azuredeploy.parameters.json new file mode 100644 index 00000000..7b728d07 --- /dev/null +++ b/sql-2016-alwayson/azuredeploy.parameters.json @@ -0,0 +1,15 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json", + "contentVersion": "1.0.0.0", + "parameters": { + "domainName": { + "value": "contoso.local" + }, + "sqlServerServiceAccountUserName": { + "value": "sqlservice" + }, + "adminUsername": { + "value": "locladmin" + } + } +} diff --git a/sql-2016-alwayson/configuringAlwaysOn.json b/sql-2016-alwayson/configuringAlwaysOn.json new file mode 100644 index 00000000..16a3c10c --- /dev/null +++ b/sql-2016-alwayson/configuringAlwaysOn.json @@ -0,0 +1,133 @@ +{ + "$schema":"https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", + "contentVersion":"1.0.0.0", + "parameters":{ + "sqlVMName":{ + "type":"string" + }, + "location":{ + "type":"string" + }, + "adminUsername":{ + "type":"string" + }, + "adminPassword":{ + "type":"securestring" + }, + "domainName":{ + "type":"string" + }, + "sqlAOEPName":{ + "type":"string" + }, + "sqlServerServiceAccountUserName":{ + "type":"string" + }, + "sqlServerServiceAccountPassword":{ + "type":"securestring" + }, + "createClusterModulesURL":{ + "type":"string" + }, + "createClusterConfigurationFunction":{ + "type":"string" + }, + "clusterName":{ + "type":"string" + }, + "sharePath":{ + "type":"string" + }, + "sqlAOAGName":{ + "type":"string" + }, + "sqlAOListenerName":{ + "type":"string" + }, + "sqlAOListenerPort":{ + "type":"string" + }, + "sqlLBName":{ + "type":"string" + }, + "sqlLBIPAddress":{ + "type":"string" + }, + "adPDCVMName":{ + "type":"string" + }, + "sqlwVMName":{ + "type":"string" + }, + "numberOfDataDisks":{ + "type":"int" + }, + "workloadType":{ + "type":"string" + }, + "databaseName":{ + "type": "string" + } + }, + "resources":[ + { + "type":"Microsoft.Compute/virtualMachines/extensions", + "name":"[concat(parameters('sqlVMName'),'1/configuringAlwaysOn')]", + "apiVersion":"2015-06-15", + "location":"[parameters('location')]", + "properties":{ + "publisher":"Microsoft.Powershell", + "type":"DSC", + "typeHandlerVersion":"2.76", + "autoUpgradeMinorVersion":true, + "settings":{ + "modulesURL":"[parameters('createClusterModulesURL')]", + "configurationFunction":"[parameters('createClusterConfigurationFunction')]", + "properties":{ + "domainName":"[parameters('domainName')]", + "clusterName":"[parameters('clusterName')]", + "sharePath":"[concat('\\\\',parameters('sqlwVMName'),'\\',parameters('sharePath'))]", + "nodes":[ + "[concat(parameters('sqlVMName'),'0')]", + "[concat(parameters('sqlVMName'),'1')]" + ], + "sqlAlwaysOnEndpointName":"[parameters('sqlAOEPName')]", + "sqlAlwaysOnAvailabilityGroupName":"[parameters('sqlAOAGName')]", + "sqlAlwaysOnAvailabilityGroupListenerName":"[parameters('sqlAOListenerName')]", + "SqlAlwaysOnAvailabilityGroupListenerPort":"[parameters('sqlAOListenerPort')]", + "databaseNames":"[parameters('databaseName')]", + "lbName":"[parameters('sqlLBName')]", + "lbAddress":"[parameters('sqlLBIPAddress')]", + "primaryReplica":"[concat(parameters('sqlVMName'),'1')]", + "secondaryReplica":"[concat(parameters('sqlVMName'),'0')]", + "dnsServerName":"[parameters('adPDCVMName')]", + "adminCreds":{ + "userName":"[parameters('adminUserName')]", + "password":"privateSettingsRef:adminPassword" + }, + "sqlServiceCreds":{ + "userName":"[parameters('sqlServerServiceAccountUserName')]", + "password":"privateSettingsRef:sqlServerServiceAccountPassword" + }, + "SQLAuthCreds":{ + "userName":"sqlsa", + "password":"privateSettingsRef:sqlAuthPassword" + }, + "NumberOfDisks":"[parameters('numberOfDataDisks')]", + "WorkloadType":"[parameters('workloadType')]" + } + }, + "protectedSettings":{ + "items":{ + "adminPassword":"[parameters('adminPassword')]", + "sqlServerServiceAccountPassword":"[parameters('sqlServerServiceAccountPassword')]", + "sqlAuthPassword":"[parameters('sqlServerServiceAccountPassword')]" + } + } + } + } + ], + "outputs":{ + + } +} \ No newline at end of file diff --git a/sql-2016-alwayson/creatingADNIC.json b/sql-2016-alwayson/creatingADNIC.json new file mode 100644 index 00000000..2d38c474 --- /dev/null +++ b/sql-2016-alwayson/creatingADNIC.json @@ -0,0 +1,54 @@ +{ + "$schema":"https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", + "contentVersion":"1.0.0.0", + "parameters": { + "location": { + "type": "string" + }, + "adPDCNicName": { + "type": "string" + }, + "adPDCNICIPAddress": { + "type": "string" + }, + "staticSubnetRef": { + "type": "string" + }, + "adBEAddressPoolID": { + "type": "string" + }, + "adRDPNATRuleID": { + "type": "string" + }, + "primaryDCIPAddressNameWithSuffix": { + "type": "string" + } + }, + "resources":[ + { + "name":"[parameters('adPDCNicName')]", + "type":"Microsoft.Network/networkInterfaces", + "location":"[parameters('location')]", + "apiVersion":"2015-06-15", + "properties":{ + "ipConfigurations":[ + { + "name":"ipconfig1", + "properties": { + "privateIPAllocationMethod": "Static", + "privateIPAddress": "[parameters('adPDCNICIPAddress')]", + "subnet": { + "id": "[parameters('staticSubnetRef')]" + }, + "publicIpAddress": { + "id": "[resourceId(resourceGroup().Name,'Microsoft.Network/publicIpAddresses', parameters('primaryDCIPAddressNameWithSuffix'))]" + } + } + } + ] + } + } + ], + "outputs":{ + } +} \ No newline at end of file diff --git a/sql-2016-alwayson/creatingNICS.json b/sql-2016-alwayson/creatingNICS.json new file mode 100644 index 00000000..8375bd98 --- /dev/null +++ b/sql-2016-alwayson/creatingNICS.json @@ -0,0 +1,122 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "location": { + "type": "string" + }, + "adPDCNICIPAddress": { + "type": "string" + }, + "sqlVMName": { + "type": "string" + }, + "sqlSubnetRef": { + "type": "string" + }, + "sqlBEAddressPoolID": { + "type": "string" + }, + "sqlwNicName": { + "type": "string" + }, + "sql1AddressNameWithSuffix": { + "type": "string" + }, + "sql0AddressNameWithSuffix": { + "type": "string" + } + }, + "resources": [ + { + "name": "[concat(parameters('sqlVMName'),'1-nic')]", + "type": "Microsoft.Network/networkInterfaces", + "location": "[parameters('location')]", + "apiVersion": "2015-06-15", + "properties": { + "ipConfigurations": [ + { + "name": "ipconfig1", + "properties": { + "privateIPAllocationMethod": "Dynamic", + "subnet": { + "id": "[parameters('sqlSubnetRef')]" + }, + "publicIpAddress": { + "id": "[resourceId(resourceGroup().Name,'Microsoft.Network/publicIpAddresses', parameters('sql1AddressNameWithSuffix'))]" + }, + "loadBalancerBackendAddressPools": [ + { + "id": "[parameters('sqlBEAddressPoolID')]" + } + ] + } + } + ], + "dnsSettings": { + "dnsServers": [ + "[parameters('adPDCNICIPAddress')]" + ] + } + } + }, + { + "name": "[concat(parameters('sqlVMName'),'0-nic')]", + "type": "Microsoft.Network/networkInterfaces", + "location": "[parameters('location')]", + "apiVersion": "2015-06-15", + "properties": { + "ipConfigurations": [ + { + "name": "ipconfig1", + "properties": { + "privateIPAllocationMethod": "Dynamic", + "subnet": { + "id": "[parameters('sqlSubnetRef')]" + }, + "publicIpAddress": { + "id": "[resourceId(resourceGroup().Name,'Microsoft.Network/publicIpAddresses', parameters('sql0AddressNameWithSuffix'))]" + }, + "loadBalancerBackendAddressPools": [ + { + "id": "[parameters('sqlBEAddressPoolID')]" + } + ] + } + } + ], + "dnsSettings": { + "dnsServers": [ + "[parameters('adPDCNICIPAddress')]" + ] + } + } + }, + { + "name": "[parameters('sqlwNicName')]", + "type": "Microsoft.Network/networkInterfaces", + "location": "[parameters('location')]", + "apiVersion": "2015-06-15", + "properties": { + "ipConfigurations": [ + { + "name": "ipconfig1", + "properties": { + "privateIPAllocationMethod": "Dynamic", + "subnet": { + "id": "[parameters('sqlSubnetRef')]" + } + } + } + ], + "dnsSettings": { + "dnsServers": [ + "[parameters('adPDCNICIPAddress')]" + ] + } + } + } + ], + "outputs": { + } +} \ No newline at end of file diff --git a/sql-2016-alwayson/metadata.json b/sql-2016-alwayson/metadata.json new file mode 100644 index 00000000..c732ebd9 --- /dev/null +++ b/sql-2016-alwayson/metadata.json @@ -0,0 +1,7 @@ +{ + "itemDisplayName": "Deploys Two SQL Server 2016 SP1 or SP2 VMs in always-on mode with Windows Authentication.", + "description": "This template creates four new 2016-Datacenter Windows server VMs and an internal load balancer and VNet. It configures one VM to be the AD DC in its own availability group, and creates a Windows Cluster with the other three VMs where two VMs in the cluster are running SQL Server are configured with an availability group and an availability group listener, the other VM is a File Share Witness for the cluster. This template requires the appropriate SQL VM image from the marketplace, the latest SQL IaaS Extension, the latest PowerShell DSC extension and the latest Custom Script for Windows extension.", + "summary": "This template creates 4 AzureStack VMs with Active Directory and SQL Server Always On", + "githubUsername": "azurestack", + "dateUpdated": "2018-08-27" +} diff --git a/sql-2016-alwayson/preparingSqlServer.json b/sql-2016-alwayson/preparingSqlServer.json new file mode 100644 index 00000000..2341bc44 --- /dev/null +++ b/sql-2016-alwayson/preparingSqlServer.json @@ -0,0 +1,232 @@ +{ + "$schema":"https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", + "contentVersion":"1.0.0.0", + "parameters": { + "sqlVMName": { + "type": "string" + }, + "location": { + "type": "string" + }, + "adminUsername": { + "type": "string" + }, + "adminPassword": { + "type": "securestring" + }, + "domainName": { + "type": "string" + }, + "sqlAOPrepareModulesURL": { + "type": "string" + }, + "sqlAOPrepareConfigurationFunction": { + "type": "string" + }, + "sqlAOEPName": { + "type": "string" + }, + "sqlServerServiceAccountUserName": { + "type": "string" + }, + "sqlServerServiceAccountPassword": { + "type": "securestring" + }, + "sqlAuthUserName": { + "type": "string" + }, + "sqlAuthPassword": { + "type": "securestring" + }, + "sharePath": { + "type": "string" + }, + "adPDCVMName": { + "type": "string" + }, + "sqlwVMName": { + "type": "string" + }, + "fswModulesURL": { + "type": "string" + }, + "fswConfigurationFunction": { + "type": "string" + }, + "autoPatchingEnable": { + "type": "bool" + }, + "autoPatchingDay": { + "type": "string" + }, + "autoPatchingStartHour": { + "type": "string" + }, + "numberOfDisks": { + "type": "int" + }, + "workloadType": { + "type": "string" + } + }, + "variables":{ + "Monday":"[mod(div(add(add(24,int(parameters('autoPatchingStartHour'))),2),24),7)]", + "Tuesday":"[mod(div(add(add(48,int(parameters('autoPatchingStartHour'))),2),24),7)]", + "Wednesday":"[mod(div(add(add(72,int(parameters('autoPatchingStartHour'))),2),24),7)]", + "Thursday":"[mod(div(add(add(96,int(parameters('autoPatchingStartHour'))),2),24),7)]", + "Friday":"[mod(div(add(add(120,int(parameters('autoPatchingStartHour'))),2),24),7)]", + "Saturday":"[mod(div(add(add(144,int(parameters('autoPatchingStartHour'))),2),24),7)]", + "Sunday":"[mod(div(add(add(168,int(parameters('autoPatchingStartHour'))),2),24),7)]", + "Never":"8", + "Everyday":"0", + "1":"Monday", + "2":"Tuesday", + "3":"Wednesday", + "4":"Thursday", + "5":"Friday", + "6":"Saturday", + "7":"Sunday", + "8":"Monday", + "0":"Everyday" + }, + "resources":[ + { + "type":"Microsoft.Compute/virtualMachines/extensions", + "name":"[concat(parameters('sqlwVMName'),'/CreateFileShareWitness')]", + "apiVersion":"2015-06-15", + "location":"[parameters('location')]", + "properties":{ + "publisher":"Microsoft.Powershell", + "type":"DSC", + "typeHandlerVersion":"2.76", + "autoUpgradeMinorVersion":true, + "settings":{ + "modulesURL":"[parameters('fswModulesURL')]", + "configurationFunction":"[parameters('fswConfigurationFunction')]", + "properties":{ + "domainName":"[parameters('domainName')]", + "SharePath":"[parameters('sharePath')]", + "adminCreds":{ + "userName":"[parameters('adminUserName')]", + "password":"privateSettingsRef:adminPassword" + } + } + }, + "protectedSettings":{ + "items":{ + "adminPassword":"[parameters('adminPassword')]" + } + } + } + }, + { + "apiVersion":"2015-06-15", + "type":"Microsoft.Compute/virtualMachines/extensions", + "name":"[concat(parameters('sqlVMName'),'0/SqlVmIaasExtension')]", + "location":"[parameters('location')]", + "properties": { + "type": "SqlIaaSAgent", + "publisher": "Microsoft.SqlServer.Management", + "typeHandlerVersion": "1.2", + "autoUpgradeMinorVersion": "true", + "settings": { + "AutoTelemetrySettings": { + "Region": "[parameters('location')]" + }, + "AutoPatchingSettings": { + "PatchCategory": "WindowsMandatoryUpdates", + "Enable": "[parameters('autoPatchingEnable')]", + "DayOfWeek": "[parameters('autoPatchingDay')]", + "MaintenanceWindowStartingHour": "[int(parameters('autoPatchingStartHour'))]", + "MaintenanceWindowDuration": "60" + }, + "AutoBackupSettings": { + "Enable": false, + "RetentionPeriod": "30", + "EnableEncryption": false + } + }, + "protectedSettings": { + "SQLAuthUpdateUserName": "[parameters('sqlAuthUserName')]", + "SQLAuthUpdatePassword": "[parameters('sqlAuthPassword')]" + } + } + }, + { + "apiVersion":"2015-06-15", + "type":"Microsoft.Compute/virtualMachines/extensions", + "name":"[concat(parameters('sqlVMName'),'1/SqlVmIaasExtension')]", + "location":"[parameters('location')]", + "properties": { + "type": "SqlIaaSAgent", + "publisher": "Microsoft.SqlServer.Management", + "typeHandlerVersion": "1.2", + "autoUpgradeMinorVersion": "true", + "settings": { + "AutoTelemetrySettings": { + "Region": "[parameters('location')]" + }, + "AutoPatchingSettings": { + "PatchCategory": "WindowsMandatoryUpdates", + "Enable": "[parameters('autoPatchingEnable')]", + "DayOfWeek": "[variables(string(variables(parameters('autoPatchingDay'))))]", + "MaintenanceWindowStartingHour": "[mod(add(int(parameters('autoPatchingStartHour')),2),24)]", + "MaintenanceWindowDuration": "60" + }, + "AutoBackupSettings": { + "Enable": false, + "RetentionPeriod": "30", + "EnableEncryption": false + } + }, + "protectedSettings": { + "SQLAuthUpdateUserName": "[parameters('sqlAuthUserName')]", + "SQLAuthUpdatePassword": "[parameters('sqlAuthPassword')]" + } + } + }, + { + "type":"Microsoft.Compute/virtualMachines/extensions", + "name":"[concat(parameters('sqlVMName'),'0/sqlAOPrepare')]", + "apiVersion":"2015-06-15", + "location":"[parameters('location')]", + "dependsOn":[ + "[concat('Microsoft.Compute/virtualMachines/',parameters('sqlwVMName'),'/extensions/CreateFileShareWitness')]", + "[concat('Microsoft.Compute/virtualMachines/',parameters('sqlVMName'),'0/extensions/SqlVmIaasExtension')]" + ], + "properties":{ + "publisher":"Microsoft.Powershell", + "type":"DSC", + "typeHandlerVersion":"2.76", + "autoUpgradeMinorVersion":true, + "settings":{ + "modulesURL":"[parameters('sqlAOPrepareModulesURL')]", + "configurationFunction":"[parameters('sqlAOPrepareConfigurationFunction')]", + "properties":{ + "domainName":"[parameters('domainName')]", + "sqlAlwaysOnEndpointName":"[parameters('sqlAOEPName')]", + "adminCreds":{ + "userName":"[parameters('adminUserName')]", + "password":"privateSettingsRef:AdminPassword" + }, + "sqlServiceCreds":{ + "userName":"[parameters('sqlServerServiceAccountUserName')]", + "password":"privateSettingsRef:SqlServerServiceAccountPassword" + }, + "NumberOfDisks":"[parameters('numberOfDisks')]", + "WorkloadType":"[parameters('workloadType')]" + } + }, + "protectedSettings":{ + "items":{ + "adminPassword":"[parameters('adminPassword')]", + "sqlServerServiceAccountPassword":"[parameters('sqlServerServiceAccountPassword')]" + } + } + } + } + ], + "outputs":{ + + } +} \ No newline at end of file diff --git a/sql-2016-alwayson/provisioningADVM.json b/sql-2016-alwayson/provisioningADVM.json new file mode 100644 index 00000000..2b0cce6f --- /dev/null +++ b/sql-2016-alwayson/provisioningADVM.json @@ -0,0 +1,167 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "adPDCVMName": { + "type": "string" + }, + "adAvailabilitySetName": { + "type": "string" + }, + "adVMSize": { + "type": "string" + }, + "adminUsername": { + "type": "string" + }, + "adminPassword": { + "type": "securestring" + }, + "adImagePublisher": { + "type": "string" + }, + "adImageOffer": { + "type": "string" + }, + "adImageSKU": { + "type": "string" + }, + "adPDCNicName": { + "type": "string" + }, + "adPDCConfigurationFunction": { + "type": "string" + }, + "adPDCModulesURL": { + "type": "string" + }, + "location": { + "type": "string" + }, + "dcStorageAccountName": { + "type": "string" + }, + "sqlStorageAccountName": { + "type": "string" + }, + "vmContainerName": { + "type": "string" + }, + "domainName": { + "type": "string" + } + }, + "variables": { + "dcstorageName": "[parameters('dcStorageAccountName')]", + "diagstorageName": "[concat(uniquestring(parameters('sqlStorageAccountName')), 'diag')]" + }, + "resources": [ + { + "type": "Microsoft.Compute/availabilitySets", + "name": "[parameters('adAvailabilitySetName')]", + "apiVersion": "2016-03-30", + "location": "[parameters('location')]", + "properties":{ + "platformFaultDomainCount": 3, + "platformUpdateDomainCount": 5 + } + }, + { + "apiVersion": "2016-03-30", + "type": "Microsoft.Compute/virtualMachines", + "name": "[parameters('adPDCVMName')]", + "location": "[parameters('location')]", + "dependsOn": [ + "[concat('Microsoft.Compute/availabilitySets/',parameters('adAvailabilitySetName'))]" + ], + "properties": { + "hardwareProfile": { + "vmSize": "[parameters('adVMSize')]" + }, + "availabilitySet": { + "id": "[resourceId('Microsoft.Compute/availabilitySets',parameters('adAvailabilitySetName'))]" + }, + "osProfile": { + "computername": "[parameters('adPDCVMName')]", + "adminUsername": "[parameters('adminUsername')]", + "adminPassword": "[parameters('adminPassword')]" + }, + "storageProfile": { + "imageReference": { + "publisher": "[parameters('adImagePublisher')]", + "offer": "[parameters('adImageOffer')]", + "sku": "[parameters('adImageSKU')]", + "version": "latest" + }, + "osDisk": { + "name": "osdisk", + "vhd": { + "uri": "[concat(reference(concat('Microsoft.Storage/storageAccounts/', variables('dcstorageName')),providers('Microsoft.Storage', 'storageAccounts').apiVersions[0]).primaryEndpoints.blob ,parameters('vmContainerName'),'/', parameters('adPDCVMName'), '0','-osdisk.vhd')]" + }, + "caching": "ReadWrite", + "createOption": "FromImage" + }, + "dataDisks": [ + { + "vhd": { + "uri": "[concat(reference(concat('Microsoft.Storage/storageAccounts/', variables('dcstorageName')),providers('Microsoft.Storage', 'storageAccounts').apiVersions[0]).primaryEndpoints.blob ,parameters('vmContainerName'),'/', parameters('adPDCVMName'), '0','data-1.vhd')]" + }, + "name": "[concat(parameters('adPDCVMName'),'-data-disk1')]", + "createOption": "Empty", + "caching": "None", + "diskSizeGB": 2, + "lun": 0 + } + ] + }, + "networkProfile": { + "networkInterfaces": [ + { + "id": "[resourceId(resourceGroup().name,'Microsoft.Network/networkInterfaces',parameters('adPDCNicName'))]" + } + ] + }, + "diagnosticsProfile": { + "bootDiagnostics": { + "enabled": true, + "storageUri": "[concat(reference(concat('Microsoft.Storage/storageAccounts/', variables('diagstorageName')),providers('Microsoft.Storage', 'storageAccounts').apiVersions[0]).primaryEndpoints.blob)]" + } + } + }, + "resources": [ + { + "type": "Microsoft.Compute/virtualMachines/extensions", + "name": "[concat(parameters('adPDCVMName'),'/InstallDomainController')]", + "apiVersion": "2016-03-30", + "location": "[parameters('location')]", + "dependsOn": [ + "[resourceId('Microsoft.Compute/virtualMachines', parameters('adPDCVMName'))]" + ], + "properties": { + "publisher": "Microsoft.Powershell", + "type": "DSC", + "typeHandlerVersion": "2.76", + "autoUpgradeMinorVersion": true, + "settings": { + "modulesURL": "[parameters('adPDCModulesURL')]", + "configurationFunction": "[parameters('adPDCConfigurationFunction')]", + "properties": { + "domainName": "[parameters('domainName')]", + "adminCreds": { + "userName": "[parameters('adminUserName')]", + "password": "PrivateSettingsRef:adminPassword" + } + } + }, + "protectedSettings": { + "items": { + "adminPassword": "[parameters('adminPassword')]" + } + } + } + } + ] + } + ], + "outputs": {} +} \ No newline at end of file diff --git a/sql-2016-alwayson/provisioningSQLVMs.json b/sql-2016-alwayson/provisioningSQLVMs.json new file mode 100644 index 00000000..a7fc09a7 --- /dev/null +++ b/sql-2016-alwayson/provisioningSQLVMs.json @@ -0,0 +1,213 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "adminUsername": { + "type": "string" + }, + "adminPassword": { + "type": "securestring" + }, + "sqlVMName": { + "type": "string" + }, + "location": { + "type": "string" + }, + "sqlStorageAccountName": { + "type": "string" + }, + "sqlAvailabilitySetName": { + "type": "string" + }, + "sqlVMSize": { + "type": "string" + }, + "fswImagePublisher": { + "type": "string" + }, + "fswImageOffer": { + "type": "string" + }, + "fswImageSKU": { + "type": "string" + }, + "vmContainerName": { + "type": "string" + }, + "sqlImageOffer": { + "type": "string" + }, + "sqlImageSKU": { + "type": "string" + }, + "numberOfDisks": { + "type": "int" + }, + "vmDiskSize": { + "type": "string" + }, + "witnessVMSize": { + "type": "string" + }, + "sqlwVMName": { + "type": "string" + }, + "sqlwNicName": { + "type": "string" + } + }, + "variables": { + "fwstorageName": "[concat(uniquestring(parameters('sqlStorageAccountName')), 'fsw')]", + "diagstorageName": "[concat(uniquestring(parameters('sqlStorageAccountName')), 'diag')]", + "updateDomainCount": "5", + "faultDomainCount": "3" + }, + "resources": [ + { + "type": "Microsoft.Compute/availabilitySets", + "name": "[parameters('sqlAvailabilitySetName')]", + "apiVersion": "2016-03-30", + "location": "[parameters('location')]", + "properties": { + "platformFaultDomainCount": "[variables('faultDomainCount')]", + "platformUpdateDomainCount": "[variables('updateDomainCount')]" + } + }, + { + "apiVersion": "2016-03-30", + "type": "Microsoft.Compute/virtualMachines", + "name": "[concat(parameters('sqlVMName'), copyIndex())]", + "location": "[parameters('location')]", + "dependsOn": [ + "[concat('Microsoft.Compute/availabilitySets/',parameters('sqlAvailabilitySetName'))]" + ], + "copy": { + "name": "sqlvirtualMachineLoop", + "count": 2 + }, + "properties": { + "hardwareProfile": { + "vmSize": "[parameters('sqlVMSize')]" + }, + "availabilitySet": { + "id": "[resourceId('Microsoft.Compute/availabilitySets',parameters('sqlAvailabilitySetName'))]" + }, + "osProfile": { + "computerName": "[concat(parameters('sqlVMName'), copyIndex('sqlvirtualMachineLoop'))]", + "adminUsername": "[parameters('adminUsername')]", + "adminPassword": "[parameters('adminPassword')]" + }, + "storageProfile": { + "imageReference": { + "publisher": "MicrosoftSQLServer", + "offer": "[parameters('sqlImageOffer')]", + "sku": "[parameters('sqlImageSKU')]", + "version": "latest" + }, + "osDisk": { + "name": "osdisk", + "vhd": { + "uri": "[concat(reference(concat('Microsoft.Storage/storageAccounts/', parameters('sqlStorageAccountName')), providers('Microsoft.Storage', 'storageAccounts').apiVersions[0]).primaryEndpoints.blob, parameters('vmContainerName'),'/', parameters('sqlVMName'), copyIndex('sqlvirtualMachineLoop'),'-osdisk.vhd')]" + }, + "caching": "ReadWrite", + "createOption": "FromImage" + }, + "copy": [ + { + "name": "dataDisks", + "count": "[parameters('numberOfDisks')]", + "input": { + "vhd": { + "uri": "[concat(reference(concat('Microsoft.Storage/storageAccounts/', parameters('sqlStorageAccountName')), providers('Microsoft.Storage', 'storageAccounts').apiVersions[0]).primaryEndpoints.blob, parameters('vmContainerName'),'/', parameters('sqlVMName'), copyIndex('sqlvirtualMachineLoop'),'-Data-', copyIndex('dataDisks'),'.vhd')]" + }, + "name": "[concat(parameters('sqlVMName'), copyIndex('sqlvirtualMachineLoop'),'-data-disk', copyIndex('dataDisks'))]", + "caching": "ReadOnly", + "createOption": "empty", + "diskSizeGB": "[parameters('vmDiskSize')]", + "lun": "[copyIndex('dataDisks')]" + } + } + ] + }, + "networkProfile": { + "networkInterfaces": [ + { + "id": "[resourceId(resourceGroup().name,'Microsoft.Network/networkInterfaces',concat(parameters('sqlVMName'), copyIndex(),'-nic'))]" + } + ] + }, + "diagnosticsProfile": { + "bootDiagnostics": { + "enabled": true, + "storageUri": "[concat(reference(concat('Microsoft.Storage/storageAccounts/', variables('diagstorageName')),providers('Microsoft.Storage', 'storageAccounts').apiVersions[0]).primaryEndpoints.blob)]" + } + } + } + }, + { + "apiVersion": "2016-03-30", + "type": "Microsoft.Compute/virtualMachines", + "name": "[parameters('sqlwVMName')]", + "location": "[parameters('location')]", + "dependsOn": [ + "[concat('Microsoft.Compute/availabilitySets/',parameters('sqlAvailabilitySetName'))]" + ], + "properties": { + "hardwareProfile": { + "vmSize": "[parameters('witnessVMSize')]" + }, + "availabilitySet": { + "id": "[resourceId('Microsoft.Compute/availabilitySets',parameters('sqlAvailabilitySetName'))]" + }, + "osProfile": { + "computerName": "[parameters('sqlwVMName')]", + "adminUsername": "[parameters('adminUsername')]", + "adminPassword": "[parameters('adminPassword')]" + }, + "storageProfile": { + "imageReference": { + "publisher": "[parameters('fswImagePublisher')]", + "offer": "[parameters('fswImageOffer')]", + "sku": "[parameters('fswImageSKU')]", + "version": "latest" + }, + "osDisk": { + "name": "osdisk", + "vhd": { + "uri": "[concat(reference(concat('Microsoft.Storage/storageAccounts/', variables('fwstorageName')),providers('Microsoft.Storage', 'storageAccounts').apiVersions[0]).primaryEndpoints.blob ,parameters('vmContainerName'),'/', parameters('sqlwVMName'), '-osdisk.vhd')]" + }, + "caching": "ReadWrite", + "createOption": "FromImage" + }, + "dataDisks": [ + { + "vhd": { + "uri": "[concat(reference(concat('Microsoft.Storage/storageAccounts/', variables('fwstorageName')),providers('Microsoft.Storage', 'storageAccounts').apiVersions[0]).primaryEndpoints.blob ,parameters('vmContainerName'),'/', parameters('sqlwVMName'), '-data-1.vhd')]" + }, + "name": "[concat(parameters('sqlwVMName'),'-data-disk1')]", + "caching": "None", + "createOption": "Empty", + "diskSizeGB": 2, + "lun": 0 + } + ] + }, + "networkProfile": { + "networkInterfaces": [ + { + "id": "[resourceId(resourceGroup().name,'Microsoft.Network/networkInterfaces',parameters('sqlwNicName'))]" + } + ] + }, + "diagnosticsProfile": { + "bootDiagnostics": { + "enabled": true, + "storageUri": "[concat(reference(concat('Microsoft.Storage/storageAccounts/', variables('diagstorageName')),providers('Microsoft.Storage', 'storageAccounts').apiVersions[0]).primaryEndpoints.blob)]" + } + } + } + } + ], + "outputs": {} +} \ No newline at end of file diff --git a/sql-2016-alwayson/setupLBs-e.json b/sql-2016-alwayson/setupLBs-e.json new file mode 100644 index 00000000..02b49f6a --- /dev/null +++ b/sql-2016-alwayson/setupLBs-e.json @@ -0,0 +1,92 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "location": { + "type": "string" + }, + "sqlLBName": { + "type": "string" + }, + "sqlLBFE": { + "type": "string" + }, + "sqlLBIPAddress": { + "type": "string" + }, + "staticSubnetRef": { + "type": "string" + }, + "sqlLBBE": { + "type": "string" + }, + "sqlLBBEID": { + "type": "string" + }, + "sqllbFEConfigID": { + "type": "string" + }, + "sqllbProbeID": { + "type": "string" + }, + "SQLAOProbe": { + "type": "string" + } + }, + "resources": [ + { + "apiVersion": "2015-06-15", + "name": "[parameters('sqlLBName')]", + "type": "Microsoft.Network/loadBalancers", + "location": "[parameters('location')]", + "properties": { + "frontendIPConfigurations": [ + { + "name": "[parameters('sqlLBFE')]", + "properties": { + "publicIPAddress": { + "id": "[parameters('sqlLBIPAddress')]" + } + } + } + ], + "backendAddressPools": [ + { + "name": "[parameters('sqlLBBE')]" + } + ], + "loadBalancingRules": [ + { + "name": "SQLAlwaysOnEndPointListener", + "properties": { + "backendAddressPool": { + "id": "[parameters('sqlLBBEID')]" + }, + "frontendIPConfiguration": { + "id": "[parameters('sqllbFEConfigID')]" + }, + "probe": { + "id": "[parameters('sqllbProbeID')]" + }, + "protocol": "Tcp", + "frontendPort": 1433, + "backendPort": 1433, + "enableFloatingIP": true + } + } + ], + "probes": [ + { + "name": "[parameters('SQLAOProbe')]", + "properties": { + "protocol": "Tcp", + "port": 59999, + "intervalInSeconds": 5, + "numberOfProbes": 2 + } + } + ] + } + } + ] +} \ No newline at end of file diff --git a/sql-2016-alwayson/storageAccountVirtualNetworkPublicIP.json b/sql-2016-alwayson/storageAccountVirtualNetworkPublicIP.json new file mode 100644 index 00000000..1137bb9b --- /dev/null +++ b/sql-2016-alwayson/storageAccountVirtualNetworkPublicIP.json @@ -0,0 +1,140 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "sqlStorageAccountName": { + "type": "string" + }, + "dcStorageAccountName": { + "type": "string" + }, + "location": { + "type": "string" + }, + "SqlStorageAccountType": { + "type": "string" + }, + "virtualNetworkName": { + "type": "string" + }, + "virtualNetworkAddressRange": { + "type": "string" + }, + "subnets": { + "type": "array" + }, + "primaryDCIPAddressNameWithSuffix": { + "type": "string" + }, + "sqlVMName": { + "type": "string" + }, + "sql1AddressNameWithSuffix": { + "type": "string" + }, + "sql0AddressNameWithSuffix": { + "type": "string" + }, + "nsgID": { + "type": "string" + }, + "dnsSuffix": { + "type": "string" + } + }, + "resources": [ + { + "name": "[parameters('sqlStorageAccountName')]", + "type": "Microsoft.Storage/storageAccounts", + "apiVersion": "2016-01-01", + "location": "[parameters('location')]", + "sku": { + "name": "[parameters('SqlStorageAccountType')]" + }, + "kind": "Storage" + }, + { + "type": "Microsoft.Storage/storageAccounts", + "name": "[parameters('dcStorageAccountName')]", + "apiVersion": "2016-01-01", + "location": "[parameters('location')]", + "sku": { + "name": "[parameters('SqlStorageAccountType')]" + }, + "kind": "Storage" + }, + { + "type": "Microsoft.Storage/storageAccounts", + "name": "[concat(uniquestring(parameters('sqlStorageAccountName')), 'fsw')]", + "apiVersion": "2016-01-01", + "location": "[parameters('location')]", + "sku": { + "name": "[parameters('SqlStorageAccountType')]" + }, + "kind": "Storage" + }, + { + "type": "Microsoft.Storage/storageAccounts", + "name": "[concat(uniquestring(parameters('sqlStorageAccountName')), 'diag')]", + "apiVersion": "2016-01-01", + "location": "[parameters('location')]", + "sku": { + "name": "[parameters('SqlStorageAccountType')]" + }, + "kind": "Storage" + }, + { + "apiVersion": "2015-06-15", + "type": "Microsoft.Network/publicIPAddresses", + "name": "[parameters('primaryDCIPAddressNameWithSuffix')]", + "location": "[parameters('location')]", + "properties": { + "publicIPAllocationMethod": "Dynamic" + } + }, + { + "apiVersion": "2015-06-15", + "type": "Microsoft.Network/publicIPAddresses", + "name": "[parameters('sql1AddressNameWithSuffix')]", + "location": "[parameters('location')]", + "properties": { + "publicIPAllocationMethod": "Dynamic", + "dnsSettings": { + "domainNameLabel": "[concat(parameters('sqlVMName'), '1')]", + "reverseFqdn": "[concat(parameters('sqlVMName'), '1.', resourceGroup().location, '.cloudapp.', parameters('dnsSuffix'))]" + } + } + }, + { + "apiVersion": "2015-06-15", + "type": "Microsoft.Network/publicIPAddresses", + "name": "[parameters('sql0AddressNameWithSuffix')]", + "location": "[parameters('location')]", + "properties": { + "publicIPAllocationMethod": "Dynamic", + "dnsSettings": { + "domainNameLabel": "[concat(parameters('sqlVMName'), '0')]", + "reverseFqdn": "[concat(parameters('sqlVMName'), '0.', resourceGroup().location, '.cloudapp.', parameters('dnsSuffix'))]" + } + } + }, + { + "name": "[parameters('virtualNetworkName')]", + "type": "Microsoft.Network/virtualNetworks", + "location": "[parameters('location')]", + "apiVersion": "2015-06-15", + "properties": { + "addressSpace": { + "addressPrefixes": [ + "[parameters('virtualNetworkAddressRange')]" + ], + "networkSecurityGroup": { + "id": "[parameters('nsgID')]" + } + }, + "subnets": "[parameters('subnets')]" + } + } + ], + "outputs": {} +} \ No newline at end of file diff --git a/sql-2016-alwayson/vnet-with-dns-server.json b/sql-2016-alwayson/vnet-with-dns-server.json new file mode 100644 index 00000000..5a500321 --- /dev/null +++ b/sql-2016-alwayson/vnet-with-dns-server.json @@ -0,0 +1,56 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "location": { + "type": "string", + "metadata": { + "description": "The region to deploy the resources into" + } + }, + "virtualNetworkName": { + "type": "string", + "metadata": { + "description": "The name of the Virtual Network" + } + }, + "virtualNetworkAddressRange": { + "type": "string", + "metadata": { + "description": "The address range of the VNET in CIDR format" + }, + "defaultValue": "10.0.0.0/16" + }, + "subnets": { + "type": "array", + "metadata": { + "description": "The subnet definition for the VNET" + } + }, + "DNSServerAddress": { + "type": "array", + "metadata": { + "description": "The DNS address(es) of the DNS Server(s) used by the VNET" + } + } + }, + "resources": [ + { + "name": "[parameters('virtualNetworkName')]", + "type": "Microsoft.Network/virtualNetworks", + "location": "[parameters('location')]", + "apiVersion": "2015-06-15", + "properties": { + "addressSpace": { + "addressPrefixes": [ + "[parameters('virtualNetworkAddressRange')]" + ] + }, + "dhcpOptions": { + "dnsServers": "[parameters('DNSServerAddress')]" + }, + "subnets": "[parameters('subnets')]" + } + } + ] +} \ No newline at end of file