diff --git a/appservice-fileserver-sqlserver-ha/README.md b/appservice-fileserver-sqlserver-ha/README.md new file mode 100644 index 0000000..05b93b5 --- /dev/null +++ b/appservice-fileserver-sqlserver-ha/README.md @@ -0,0 +1,69 @@ +# Create HA Infrastructure for an AppServices deployment + +This template will deploy all the infrastructure required for Azure Stack AppServices installtion. The goal of the template is to simplify the deployment of the AppService Resource Provider and is therefore intended to be deployed into the Default Provider Subscription. Storage and Network configuartion for deployment are included in teh main temlpalte and may need to be adjusted according to your needs. + + It creates the following resources: + +* A virtual network with required subnets +* network security groups for file server, sql server and AD subnets +* Storage accounts for VM disks and cluster cloud witness +* One internal load balancer for SQL VMs with private IP bound to the SQL Always On listener +* Two VM (WS2016Core) configured as Domain Controllers for a new forest with a single domain +* Two VM (WS2016Core) configured as Storage Spaces Direct File share cluster +* 3 Availability Sets, for AD, FileServer cluster and SQL cluster + +# Deploying the AppService Resource Provider + +As stated the goal of this template is to deploy the infrastructure needed to support the App Service Resource Provider so this should be deployed before running the AppService installer. +* Check the template meets any requirements you may have on VNET address space and storage sizing +* Deploy this template using the Default Provider Subscription +* Create a new Resource Group +* Make a note of the outputs from this template they will be needed when installing AppService +* When installing AppService be sure to select the option to deploy to an existing VNET +* Details of File Server and SQL server endpoimnts & accounts can be found in the outputs noted +* After AppService deployment is complete manually back up bot the metering and hosting databases and add them to the availability group. +* By default the AppService Controller VM(s) have public IP addresses update the Controller NSG to allow RDP access, the SQL servers can be accesed from here on default IP addresses of 10.0.1.4 and 10.0.1.5 + +## Notes + +This template uses Azure Stack Marketplace images. These need to be available on your Azure Stack instance: + +* Windows Server 2016 Datacenter Core Image (for AD and File Server VMs) +* Choice of SQL Server 2016 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) + +## Parameters + +| Parameter Name | Description | Type | Default Value +| --- | --- | --- | --- +| namePrefix | prefix to beused in resource naming | string | aps +| domainVmSize | VM size for AD VMs | string | Standard_DS1_v2 +| filServerVmSize | VM size for file server VMs | string | Standard_DS2_v2 +| sqlVmSize | VM size for SQL VMs | string | Standard_DS2_v2 +| domainName | dns domain name of new domain | string | Appsvc.local +| adminUsername | Username for domain admin account | string | appsvcadmin +| adminPassword | password for domain admin account | secure string | +| fileShareOwnerUserName | Username for the file share owner account | string | FileShareOwner +| fileShareOwnerPassword | password for file share owner account | secure string | +| fileShareUserUserName | Username for the file share user account | string | FileShareUser +| fileShareUserPassword | password for domain admin account | secure string | +| sqlServerServiceAccountUserName | Username for SQL service account | string | svcSQL +| sqlServerServiceAccountPassword | password for SQL service account | secure string | +| sqlLogin | Username for the SQL login | string | sqlsa +| sqlLoginPassword | password for sql login account | secure string | +| sofsName | Name of the Scale-out File Server | string | sofs01 +| shareName | Name of the FileShare | string | WebSites +| _artifactsLocation | Blob store where all deployment artifacts are stored | string | https://raw.githubusercontent.com/pappleby64/AzureStackStuff/master/Templates/AppServiceInfraHA/ +| _artifactsLocationSasToken | sas token for artifact location if requires | secure string | +| location | location to be used for the deployment | string | + +## Outputs + +| Parameter Name | Description +| --- | --- +| FileSharePath | FQDN of the file server +| FileShareOwner | Name of File Share Owner Account +| FileShareUser | Name of File Share User Account +| SQLserver | Name of SQL account +| SQLUser | Name of SQL Server \ No newline at end of file diff --git a/appservice-fileserver-sqlserver-ha/azuredeploy.json b/appservice-fileserver-sqlserver-ha/azuredeploy.json new file mode 100644 index 0000000..2acbe0a --- /dev/null +++ b/appservice-fileserver-sqlserver-ha/azuredeploy.json @@ -0,0 +1,554 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "namePrefix": { + "type": "string", + "minLength": 3, + "maxLength": 5, + "metadata": { + "description": "Naming prefix for each new resource created. 3-char min, 5-char max, lowercase alphanumeric" + }, + "defaultValue": "aps" + }, + "domainVmSize": { + "type": "string", + "metadata": { + "description": "Size of the Active Directory VMs to be created" + }, + "defaultValue": "Standard_DS1_v2" + }, + "filServerVmSize": { + "type": "string", + "metadata": { + "description": "Size of the S2D VMs to be created" + }, + "defaultValue": "Standard_DS2_v2" + }, + "sqlVmSize": { + "type": "string", + "metadata": { + "description": "Size of the SQL VMs to be created" + }, + "defaultValue": "Standard_DS2_v2" + }, + "domainName": { + "type": "string", + "metadata": { + "description": "DNS domain name for Active Directory domain" + }, + "defaultValue": "appsvc.local" + }, + "adminUsername": { + "type": "string", + "metadata": { + "description": "Name of the Domain Administrator account" + }, + "defaultValue": "appsvcadmin" + }, + "adminPassword": { + "type": "securestring", + "minLength": 12, + "metadata": { + "description": "Password for the Domain Administrator account " + } + }, + "fileShareOwnerUserName": { + "type": "string", + "metadata": { + "description": "Username for the fileshareowner account" + }, + "defaultValue": "FileShareOwner" + }, + "fileShareOwnerPassword": { + "type": "securestring", + "minLength": 12, + "metadata": { + "description": "Password for the fileshareowner account" + } + }, + "fileShareUserUserName": { + "type": "string", + "metadata": { + "description": "Username for the FileShareUser account" + }, + "defaultValue": "FileShareUser" + }, + "fileShareUserPassword": { + "type": "securestring", + "minLength": 12, + "metadata": { + "description": "Password for the SFileShareUserQL account" + } + }, + "sqlServerServiceAccountUserName": { + "type": "string", + "metadata": { + "description": "Username for the SQL service account" + }, + "defaultValue": "svcSQL" + }, + "sqlServerServiceAccountPassword": { + "type": "securestring", + "minLength": 12, + "metadata": { + "description": "Password for the SQL service account" + } + }, + "sqlLogin": { + "type": "string", + "metadata": { + "description": "Username for the SQL account" + }, + "defaultValue": "sqlsa" + }, + "sqlLoginPassword": { + "type": "securestring", + "minLength": 12, + "metadata": { + "description": "Password for the SQL account" + } + }, + "sofsName": { + "type": "string", + "metadata": { + "description": "Name of clustered Scale-Out File Server role" + }, + "defaultValue": "fs01" + }, + "shareName": { + "type": "string", + "metadata": { + "description": "Name of shared data folder on clustered Scale-Out File Server role" + }, + "defaultValue": "WebSites" + }, + "_artifactsLocation": { + "type": "string", + "metadata": { + "description": "Location of resources that the script is dependent on such as linked templates and DSC modules" + }, + "defaultValue": "https://raw.githubusercontent.com/Azure/azure-quickstart-templates/master/301-storage-spaces-direct" + }, + "_artifactsLocationSasToken": { + "type": "securestring", + "metadata": { + "description": "The sasToken required to access _artifactsLocation. When the template is deployed using the accompanying scripts, a sasToken will be automatically generated." + }, + "defaultValue": "" + }, + "location": { + "type": "string", + "defaultValue": "[resourceGroup().location]", + "metadata": { + "description": "Location for all resources." + } + } + }, + "variables": { + "storageAccountType": "Premium_LRS", + "names": { + "adNsg": "[concat(parameters('namePrefix'), '-ad-Nsg')]", + "sqlNsg": "[concat(parameters('namePrefix'), '-sql-Nsg')]", + "fsNsg": "[concat(parameters('namePrefix'), '-fs-Nsg')]", + "vnet": "[concat(parameters('namePrefix'), '-vnet')]", + "adSubnetName": "ADSubnet", + "sqlSubnetName": "SQLSubnet", + "fileServerSubnetName": "FileServerSubnet" + }, + "adsubnetRef": "[resourceId('Microsoft.Network/virtualNetworks/subnets',variables('names').vnet,variables('names').adSubnetName)]", + "sqlsubnetRef": "[resourceId('Microsoft.Network/virtualNetworks/subnets',variables('names').vnet,variables('names').sqlSubnetName)]", + "fileserversubnetRef": "[resourceId('Microsoft.Network/virtualNetworks/subnets',variables('names').vnet,variables('names').fileServerSubnetName)]", + "NestedTemplate": { + "deployNetwork": "[concat(parameters('_artifactsLocation'),'/nestedtemplates/VirtualNetwork.json',parameters('_artifactsLocationSasToken'))]", + "deployNetworkDNS": "[concat(parameters('_artifactsLocation'),'/nestedtemplates/VirtualNetworkDNS.json',parameters('_artifactsLocationSasToken'))]", + "deployAD": "[concat(parameters('_artifactsLocation'),'/nestedtemplates/deploy-ad.json',parameters('_artifactsLocationSasToken'))]", + "deployS2D": "[concat(parameters('_artifactsLocation'),'/nestedtemplates/deploy-s2d-cluster.json',parameters('_artifactsLocationSasToken'))]", + "deploySql": "[concat(parameters('_artifactsLocation'),'/nestedtemplates/deploy-sql-cluster.json',parameters('_artifactsLocationSasToken'))]" + }, + "vnetPrefix": "10.0.0.0/16", + "adSubnetPrefix": "10.0.0.0/24", + "sqlSubnetPrefix": "10.0.1.0/24", + "fsSubnetPrefix": "10.0.2.0/24", + "controllerSubnetPrefix": "10.0.3.0/24", + "managementSubnetPrefix": "10.0.4.0/24", + "publisherSubnetPrefix": "10.0.5.0/24", + "frontendadSubnetPrefix": "10.0.6.0/24", + "workerSubnetPrefix": "10.0.8.0/21", + "adStatipIP":["10.0.0.100","10.0.0.101"], + "sqllistenerip":"10.0.1.100", + "networkSettings": { + "vnetName": "[variables('names').vnet]", + "addressSpace": { + "addressPrefixes": [ + "[variables('vnetPrefix')]" + ] + }, + "subnets": [ + { + "name": "[variables('names').adSubnetName]", + "properties": { + "addressPrefix": "[variables('adSubnetPrefix')]", + "networkSecurityGroup": { + "id": "[resourceId('Microsoft.Network/networkSecurityGroups',variables('names').adNsg )]" + } + } + }, + { + "name": "[variables('names').sqlSubnetName]", + "properties": { + "addressPrefix": "[variables('sqlSubnetPrefix')]", + "networkSecurityGroup": { + "id": "[resourceId('Microsoft.Network/networkSecurityGroups',variables('names').sqlNsg )]" + } + } + }, + { + "name": "[variables('names').fileServerSubnetName]", + "properties": { + "addressPrefix": "[variables('fsSubnetPrefix')]", + "networkSecurityGroup": { + "id": "[resourceId('Microsoft.Network/networkSecurityGroups',variables('names').fsNsg )]" + } + } + }, + { + "name": "ControllerSubnet", + "properties": { + "addressPrefix": "[variables('controllerSubnetPrefix')]" + } + }, + { + "name": "ManagementSubnet", + "properties": { + "addressPrefix": "[variables('managementSubnetPrefix')]" + } + }, + { + "name": "PublisherSubnet", + "properties": { + "addressPrefix": "[variables('publisherSubnetPrefix')]" + } + }, + { + "name": "FrontendSubnet", + "properties": { + "addressPrefix": "[variables('frontendadSubnetPrefix')]" + } + }, + { + "name": "WorkerSubnet", + "properties": { + "addressPrefix": "[variables('workerSubnetPrefix')]" + } + } + ] + } + }, + "resources": [ + { + "apiVersion": "2015-06-15", + "type": "Microsoft.Network/networkSecurityGroups", + "name": "[variables('names').adNsg]", + "location": "[parameters('location')]", + "properties": { + "securityRules": [] + } + }, + { + "apiVersion": "2015-06-15", + "type": "Microsoft.Network/networkSecurityGroups", + "name": "[variables('names').fsNsg]", + "location": "[parameters('location')]", + "properties": { + "securityRules": [] + } + }, + { + "apiVersion": "2015-06-15", + "type": "Microsoft.Network/networkSecurityGroups", + "name": "[variables('names').sqlNsg]", + "location": "[parameters('location')]", + "properties": { + "securityRules": [] + } + }, + { + "name": "NetworkDeployment", + "type": "Microsoft.Resources/deployments", + "apiVersion": "2016-02-01", + "properties": { + "mode": "Incremental", + "templateLink": { + "uri": "[variables('NestedTemplate').deployNetwork]", + "contentVersion": "1.0.0.0" + }, + "parameters": { + "networkSettings": { + "value": "[variables('networkSettings')]" + }, + "location": { + "value": "[parameters('location')]" + } + } + }, + "dependsOn": [ + "[variables('names').adNsg]", + "[variables('names').fsNsg]", + "[variables('names').sqlNsg]" + ] + }, + { + "name": "deployAD", + "type": "Microsoft.Resources/deployments", + "apiVersion": "2016-02-01", + "dependsOn": [ + "NetworkDeployment" + ], + "properties": { + "mode": "Incremental", + "templateLink": { + "uri": "[variables('NestedTemplate').deployAD]", + "contentVersion": "1.0.0.0" + }, + "parameters": { + "namePrefix": { + "value": "[parameters('namePrefix')]" + }, + "domainName": { + "value": "[parameters('domainName')]" + }, + "adminUsername": { + "value": "[parameters('adminUsername')]" + }, + "adminPassword": { + "value": "[parameters('adminPassword')]" + }, + "staticIP":{ + "value":"[variables('adStatipIP')]" + }, + "storageAccountType": { + "value": "[variables('storageAccountType')]" + }, + "nicSubnetUri": { + "value": "[variables('adsubnetRef')]" + }, + "vmSize": { + "value": "[parameters('domainVmSize')]" + }, + "vmCount": { + "value": 2 + }, + "vmDiskSize": { + "value": 128 + }, + "vmDiskCount": { + "value": 1 + }, + "_artifactsLocation": { + "value": "[parameters('_artifactsLocation')]" + }, + "_artifactsLocationSasToken": { + "value": "[parameters('_artifactsLocationSasToken')]" + }, + "location": { + "value": "[parameters('location')]" + } + } + } + }, + { + "name": "NetworkDeploymentDNS", + "type": "Microsoft.Resources/deployments", + "apiVersion": "2016-02-01", + "properties": { + "mode": "Incremental", + "templateLink": { + "uri": "[variables('NestedTemplate').deployNetworkDNS]", + "contentVersion": "1.0.0.0" + }, + "parameters": { + "networkSettings": { + "value": "[variables('networkSettings')]" + }, + "staticIP":{ + "value":"[variables('adStatipIP')]" + }, + "location": { + "value": "[parameters('location')]" + } + } + }, + "dependsOn": [ + "deployAD" + ] + }, + { + "name": "deployS2DCluster", + "type": "Microsoft.Resources/deployments", + "apiVersion": "2016-02-01", + "dependsOn": [ + "NetworkDeploymentDNS" + ], + "properties": { + "mode": "Incremental", + "templateLink": { + "uri": "[variables('NestedTemplate').deployS2D]", + "contentVersion": "1.0.0.0" + }, + "parameters": { + "namePrefix": { + "value": "[parameters('namePrefix')]" + }, + "domainName": { + "value": "[parameters('domainName')]" + }, + "adminUsername": { + "value": "[parameters('adminUsername')]" + }, + "adminPassword": { + "value": "[parameters('adminPassword')]" + }, + "fileShareOwnerUserName": { + "value": "[parameters('fileShareOwnerUserName')]" + }, + "fileShareOwnerPassword": { + "value": "[parameters('fileShareOwnerPassword')]" + }, + "fileShareUserUserName": { + "value": "[parameters('fileShareUserUserName')]" + }, + "fileShareUserPassword": { + "value": "[parameters('fileShareUserPassword')]" + }, + "storageAccountType": { + "value": "[variables('storageAccountType')]" + }, + "nicSubnetUri": { + "value": "[variables('fileserversubnetRef')]" + }, + "vmSize": { + "value": "[parameters('filServerVmSize')]" + }, + "vmCount": { + "value": 2 + }, + "vmDiskSize": { + "value": 1023 + }, + "vmDiskCount": { + "value": 2 + }, + "sofsName": { + "value": "[parameters('sofsName')]" + }, + "shareName": { + "value": "[parameters('shareName')]" + }, + "_artifactsLocation": { + "value": "[parameters('_artifactsLocation')]" + }, + "_artifactsLocationSasToken": { + "value": "[parameters('_artifactsLocationSasToken')]" + }, + "location": { + "value": "[parameters('location')]" + } + } + } + }, + { + "name": "DeploySQL", + "type": "Microsoft.Resources/deployments", + "apiVersion": "2016-02-01", + "dependsOn": [ + "NetworkDeploymentDNS" + ], + "properties": { + "mode": "Incremental", + "templateLink": { + "uri": "[variables('NestedTemplate').deploySql]", + "contentVersion": "1.0.0.0" + }, + "parameters": { + "namePrefix": { + "value": "[parameters('namePrefix')]" + }, + "domainName": { + "value": "[parameters('domainName')]" + }, + "adminUsername": { + "value": "[parameters('adminUsername')]" + }, + "adminPassword": { + "value": "[parameters('adminPassword')]" + }, + "sqlServerServiceAccountUserName": { + "value": "[parameters('sqlServerServiceAccountUserName')]" + }, + "sqlServerServiceAccountPassword": { + "value": "[parameters('sqlServerServiceAccountPassword')]" + }, + "sqlLogin":{ + "value":"[parameters('sqlLogin')]" + }, + "sqlLoginPassword":{ + "value":"[parameters('sqlLoginPassword')]" + }, + "SqlListenerIP":{ + "value":"[variables('sqllistenerip')]" + }, + "storageAccountType": { + "value": "[variables('storageAccountType')]" + }, + "nicSubnetUri": { + "value": "[variables('sqlsubnetRef')]" + }, + "vmSize": { + "value": "[parameters('sqlVmSize')]" + }, + "vmCount": { + "value": 2 + }, + "vmDiskSize": { + "value": 1023 + }, + "vmDiskCount": { + "value": 1 + }, + "_artifactsLocation": { + "value": "[parameters('_artifactsLocation')]" + }, + "_artifactsLocationSasToken": { + "value": "[parameters('_artifactsLocationSasToken')]" + }, + "location": { + "value": "[parameters('location')]" + } + } + } + } + ], + "outputs": { + "FileSharePath": { + "type": "string", + "value": "[concat('\\\\',reference('deployS2DCluster').outputs.sofsName.value,'\\',reference('deployS2DCluster').outputs.shareName.value)]" + }, + "FileShareOwner":{ + "type": "string", + "value": "[concat(parameters('domainName'),'\\',parameters('fileShareOwnerUserName'))]" + }, + "FileShareUser":{ + "type": "string", + "value": "[concat(parameters('domainName'),'\\',parameters('fileShareUserUserName'))]" + }, + "SQLserver":{ + "type": "string", + "value": "[variables('sqllistenerip')]" + }, + "SQLUser":{ + "type": "string", + "value": "[parameters('sqlLogin')]" + } + } +} \ No newline at end of file diff --git a/appservice-fileserver-sqlserver-ha/azuredeploy.parameters.json b/appservice-fileserver-sqlserver-ha/azuredeploy.parameters.json new file mode 100644 index 0000000..45a6be3 --- /dev/null +++ b/appservice-fileserver-sqlserver-ha/azuredeploy.parameters.json @@ -0,0 +1,36 @@ +{ + "$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "adminUsername": { + "value": "GEN-USER" + }, + "adminPassword": { + "value": "GEN-PASSWORD" + }, + "fileShareOwnerUserName": { + "value": "GEN-USER" + }, + "fileShareOwnerPassword": { + "value": "GEN-PASSWORD" + }, + "fileShareUserUserName": { + "value": "GEN-USER" + }, + "fileShareUserPassword": { + "value": "GEN-PASSWORD" + }, + "sqlServerServiceAccountUserName": { + "value": "GEN-USER" + }, + "sqlServerServiceAccountPassword": { + "value": "GEN-PASSWORD" + }, + "sqlLogin": { + "value": "GEN-USER" + }, + "sqlLoginPassword": { + "value": "GEN-PASSWORD" + } + } +} \ No newline at end of file diff --git a/appservice-fileserver-sqlserver-ha/dsc/config-s2d.ps1.zip b/appservice-fileserver-sqlserver-ha/dsc/config-s2d.ps1.zip new file mode 100644 index 0000000..57c583d Binary files /dev/null and b/appservice-fileserver-sqlserver-ha/dsc/config-s2d.ps1.zip differ diff --git a/appservice-fileserver-sqlserver-ha/dsc/config-second-dc.ps1.zip b/appservice-fileserver-sqlserver-ha/dsc/config-second-dc.ps1.zip new file mode 100644 index 0000000..d36659b Binary files /dev/null and b/appservice-fileserver-sqlserver-ha/dsc/config-second-dc.ps1.zip differ diff --git a/appservice-fileserver-sqlserver-ha/dsc/config-sql.ps1.zip b/appservice-fileserver-sqlserver-ha/dsc/config-sql.ps1.zip new file mode 100644 index 0000000..6e7df48 Binary files /dev/null and b/appservice-fileserver-sqlserver-ha/dsc/config-sql.ps1.zip differ diff --git a/appservice-fileserver-sqlserver-ha/dsc/prep-adforest.ps1.zip b/appservice-fileserver-sqlserver-ha/dsc/prep-adforest.ps1.zip new file mode 100644 index 0000000..97c9567 Binary files /dev/null and b/appservice-fileserver-sqlserver-ha/dsc/prep-adforest.ps1.zip differ diff --git a/appservice-fileserver-sqlserver-ha/dsc/prep-s2d.ps1.zip b/appservice-fileserver-sqlserver-ha/dsc/prep-s2d.ps1.zip new file mode 100644 index 0000000..44e87d4 Binary files /dev/null and b/appservice-fileserver-sqlserver-ha/dsc/prep-s2d.ps1.zip differ diff --git a/appservice-fileserver-sqlserver-ha/dsc/prep-sql.ps1.zip b/appservice-fileserver-sqlserver-ha/dsc/prep-sql.ps1.zip new file mode 100644 index 0000000..d2926a4 Binary files /dev/null and b/appservice-fileserver-sqlserver-ha/dsc/prep-sql.ps1.zip differ diff --git a/appservice-fileserver-sqlserver-ha/metadata.json b/appservice-fileserver-sqlserver-ha/metadata.json new file mode 100644 index 0000000..7365beb --- /dev/null +++ b/appservice-fileserver-sqlserver-ha/metadata.json @@ -0,0 +1,11 @@ +{ + "$schema": "https://aka.ms/azure-quickstart-templates-metadata-schema#", + "type": "QuickStart", + "itemDisplayName": "Create infrastructure for HA AppService deployment", + "description": "This template creates a SQL always-on cluster and Storage Spaces Direct Cluster with 2 domain controllers. It also creates a VNET with subnets required by AppService", + "summary": "Creates VNET, 2 node SQL cluster, 2 node FileServer cluster and 2 domain controllers", + "githubUsername": "pappleby64", + "dateUpdated": "2018-09-21" + } + + \ No newline at end of file diff --git a/appservice-fileserver-sqlserver-ha/nestedtemplates/VirtualNetwork.json b/appservice-fileserver-sqlserver-ha/nestedtemplates/VirtualNetwork.json new file mode 100644 index 0000000..b08bdc3 --- /dev/null +++ b/appservice-fileserver-sqlserver-ha/nestedtemplates/VirtualNetwork.json @@ -0,0 +1,34 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "networkSettings": { + "type": "object" + }, + "location": { + "type": "string", + "defaultValue": "[resourceGroup().location]", + "metadata": { + "description": "Location for all resources." + } + } + }, + "variables": {}, + "resources": [ + { + "apiVersion": "2015-06-15", + "type": "Microsoft.Network/virtualNetworks", + "name": "[parameters('networkSettings').vnetName]", + "location": "[parameters('location')]", + "tags": { + "displayName": "[parameters('networkSettings').vnetName]" + }, + "dependsOn": [], + "properties": { + "addressSpace": "[parameters('networkSettings').addressSpace]", + "subnets": "[parameters('networkSettings').subnets]" + } + } + ], + "outputs": {} +} \ No newline at end of file diff --git a/appservice-fileserver-sqlserver-ha/nestedtemplates/VirtualNetworkDNS.json b/appservice-fileserver-sqlserver-ha/nestedtemplates/VirtualNetworkDNS.json new file mode 100644 index 0000000..900f360 --- /dev/null +++ b/appservice-fileserver-sqlserver-ha/nestedtemplates/VirtualNetworkDNS.json @@ -0,0 +1,40 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "networkSettings": { + "type": "object" + }, + "staticIP":{ + "type": "array" + }, + "location": { + "type": "string", + "defaultValue": "[resourceGroup().location]", + "metadata": { + "description": "Location for all resources." + } + } + }, + "variables": {}, + "resources": [ + { + "apiVersion": "2015-06-15", + "type": "Microsoft.Network/virtualNetworks", + "name": "[parameters('networkSettings').vnetName]", + "location": "[parameters('location')]", + "tags": { + "displayName": "[parameters('networkSettings').vnetName]" + }, + "dependsOn": [], + "properties": { + "addressSpace": "[parameters('networkSettings').addressSpace]", + "subnets": "[parameters('networkSettings').subnets]", + "dhcpOptions": { + "dnsServers": "[parameters('staticIP')]" + } + } + } + ], + "outputs": {} +} \ No newline at end of file diff --git a/appservice-fileserver-sqlserver-ha/nestedtemplates/deploy-ad.json b/appservice-fileserver-sqlserver-ha/nestedtemplates/deploy-ad.json new file mode 100644 index 0000000..020c107 --- /dev/null +++ b/appservice-fileserver-sqlserver-ha/nestedtemplates/deploy-ad.json @@ -0,0 +1,300 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "namePrefix": { + "type": "string", + "minLength": 3, + "maxLength": 8, + "metadata": { + "description": "Naming prefix for each new resource created. 3-char min, 8-char max, lowercase alphanumeric" + } + }, + "domainName": { + "type": "string", + "metadata": { + "description": "DNS domain name for existing Active Directory domain" + } + }, + "adminUsername": { + "type": "string", + "metadata": { + "description": "Name of the Administrator of the existing Active Directory Domain" + } + }, + "adminPassword": { + "type": "securestring", + "minLength": 12, + "metadata": { + "description": "Password for the Administrator account of the existing Active Directory Domain" + } + }, + "staticIP":{ + "type": "array" + }, + "storageAccountType": { + "type": "string", + "allowedValues": [ + "Standard_LRS", + "Standard_GRS", + "Standard_RAGRS", + "Premium_LRS" + ], + "metadata": { + "description": "Type of new Storage Accounts (Standard_LRS, Standard_GRS, Standard_RAGRS or Premium_LRS) to be created to store VM disks" + } + }, + "nicSubnetUri": { + "type": "string", + "metadata": { + "description": "Resource ID for existing vnet/subnet to which VM NICs should be attached" + } + }, + "vmSize": { + "type": "string", + "metadata": { + "description": "Size of the S2D VMs to be created" + } + }, + "vmCount": { + "type": "int", + "minValue": 2, + "maxValue": 3, + "metadata": { + "description": "Number of S2D VMs to be created in cluster (Min=2, Max=3)" + } + }, + "vmDiskSize": { + "type": "int", + "minValue": 128, + "maxValue": 1023, + "metadata": { + "description": "Size of each data disk in GB on each S2D VM (Min=128, Max=1023)" + } + }, + "vmDiskCount": { + "type": "int", + "minValue": 1, + "maxValue": 32, + "metadata": { + "description": "Number of data disks on each S2D VM (Min=2, Max=32). Ensure that the VM size you've selected will support this number of data disks." + } + }, + "imagePublisher": { + "type": "string", + "defaultValue": "MicrosoftWindowsServer" + }, + "imageOffer": { + "type": "string", + "defaultValue": "WindowsServer" + }, + "imageSKU": { + "type": "string", + "defaultValue": "2016-Datacenter-Server-Core" + }, + "imageVersion": { + "type": "string", + "defaultValue": "latest" + }, + "_artifactsLocation": { + "type": "string" + }, + "_artifactsLocationSasToken": { + "type": "string" + }, + "location": { + "type": "string", + "defaultValue": "[resourceGroup().location]", + "metadata": { + "description": "Location for all resources." + } + } + }, + "variables": { + "apiVersionStorage": "2016-01-01", + "storageNamePrefix": "[concat(parameters('namePrefix'),uniqueString(resourceGroup().id),'vm')]", + "vmNamePrefix": "[concat(parameters('namePrefix'),'-ad-')]", + "vmAvailabilitySetName": "[concat(variables('vmNamePrefix'),'as')]", + "vmLoopTemplateURL": "[concat(parameters('_artifactsLocation'),'/nestedtemplates/newVM.json',parameters('_artifactsLocationSasToken'))]", + "adPDCModulesURL": "[concat(parameters('_artifactsLocation'),'/dsc/prep-adforest.ps1.zip',parameters('_artifactsLocationSasToken'))]", + "adPDCConfigurationFunction": "prep-adforest.ps1\\prep-adforest", + "adBDCModulesURL": "[concat(parameters('_artifactsLocation'),'/dsc/config-second-dc.ps1.zip',parameters('_artifactsLocationSasToken'))]", + "adBDCConfigurationFunction": "config-second-dc.ps1\\config-second-dc" + }, + "resources": [ + { + "type": "Microsoft.Compute/availabilitySets", + "name": "[variables('vmAvailabilitySetName')]", + "apiVersion": "2015-06-15", + "location": "[parameters('location')]", + "properties": {} + }, + { + "type": "Microsoft.Storage/storageAccounts", + "name": "[concat(variables('storageNamePrefix'),copyindex())]", + "apiVersion": "2016-01-01", + "copy": { + "name": "storageAccountLoop", + "count": "[parameters('vmCount')]" + }, + "location": "[parameters('location')]", + "sku": { + "name": "[parameters('storageAccountType')]" + }, + "kind": "Storage" + }, + { + "name": "[concat(variables('vmNamePrefix'), copyindex(), '-nic')]", + "type": "Microsoft.Network/networkInterfaces", + "location": "[parameters('location')]", + "apiVersion": "2015-06-15", + "copy": { + "name": "nicLoop", + "count": "[parameters('vmCount')]" + }, + "properties": { + "ipConfigurations": [ + { + "name": "ipconfig1", + "properties": { + "privateIPAllocationMethod": "Static", + "privateIPAddress": "[parameters('staticIP')[copyindex()]]", + "subnet": { + "id": "[parameters('nicSubnetUri')]" + } + } + } + ] + } + }, + { + "type": "Microsoft.Resources/deployments", + "apiVersion": "2015-01-01", + "copy": { + "name": "virtualMachineLoop", + "count": "[parameters('vmCount')]" + }, + "name": "[concat(variables('vmNamePrefix'),copyindex(),'-newVM')]", + "dependsOn": [ + "storageAccountLoop", + "nicLoop", + "[resourceId('Microsoft.Compute/availabilitySets', variables('vmAvailabilitySetName'))]" + ], + "properties": { + "mode": "Incremental", + "templateLink": { + "uri": "[variables('vmLoopTemplateURL')]" + }, + "parameters": { + "vmName": { + "value": "[concat(variables('vmNamePrefix'), copyindex())]" + }, + "storageAccountUri": { + "value": "[reference(concat('Microsoft.Storage/storageAccounts/',variables('StorageNamePrefix'),copyIndex()),variables('apiVersionStorage')).primaryEndpoints.blob]" + }, + "vmAvailabilitySetName": { + "value": "[variables('vmAvailabilitySetName')]" + }, + "vmSize": { + "value": "[parameters('vmSize')]" + }, + "vmDiskCount": { + "value": "[parameters('vmDiskCount')]" + }, + "vmDiskSize": { + "value": "[parameters('vmDiskSize')]" + }, + "adminUsername": { + "value": "[parameters('adminUsername')]" + }, + "adminPassword": { + "value": "[parameters('adminPassword')]" + }, + "_artifactsLocation": { + "value": "[parameters('_artifactsLocation')]" + }, + "_artifactsLocationSasToken": { + "value": "[parameters('_artifactsLocationSasToken')]" + }, + "imagePublisher": { + "value": "[parameters('imagePublisher')]" + }, + "imageOffer": { + "value": "[parameters('imageOffer')]" + }, + "imageSKU": { + "value": "[parameters('imageSKU')]" + }, + "imageVersion": { + "value": "[parameters('imageVersion')]" + } + } + } + }, + { + "name": "[concat(variables('vmNamePrefix'),'0/CreateADForest')]", + "type": "Microsoft.Compute/virtualMachines/extensions", + "apiVersion": "2016-03-30", + "location": "[parameters('location')]", + "dependsOn": [ + "[concat(variables('vmNamePrefix'),'0-newVM')]" + ], + "properties": { + "publisher": "Microsoft.Powershell", + "type": "DSC", + "typeHandlerVersion": "2.76", + "autoUpgradeMinorVersion": true, + "settings": { + "ModulesUrl": "[variables('adPDCModulesURL')]", + "ConfigurationFunction": "[variables('adPDCConfigurationFunction')]", + "Properties": { + "DomainName": "[parameters('domainName')]", + "AdminCreds": { + "UserName": "[parameters('adminUsername')]", + "Password": "PrivateSettingsRef:AdminPassword" + } + } + }, + "protectedSettings": { + "Items": { + "AdminPassword": "[parameters('adminPassword')]" + } + } + } + }, + { + "name": "[concat(variables('vmNamePrefix'),'1/PrepADBDC')]", + "type": "Microsoft.Compute/virtualMachines/extensions", + "apiVersion": "2016-03-30", + "location": "[parameters('location')]", + "dependsOn": [ + "[resourceId('Microsoft.Compute/virtualMachines/extensions', concat(variables('vmNamePrefix'),'0'), 'CreateADForest')]" + ], + "properties": { + "publisher": "Microsoft.Powershell", + "type": "DSC", + "typeHandlerVersion": "2.76", + "autoUpgradeMinorVersion": true, + "settings": { + "ModulesUrl": "[variables('adBDCModulesURL')]", + "ConfigurationFunction": "[variables('adBDCConfigurationFunction')]", + "Properties": { + "DomainName": "[parameters('domainName')]", + "DNSServer":"[parameters('staticIP')[0]]", + "AdminCreds": { + "UserName": "[parameters('adminUsername')]", + "Password": "PrivateSettingsRef:AdminPassword" + } + } + }, + "protectedSettings": { + "Items": { + "AdminPassword": "[parameters('adminPassword')]" + } + } + } + } + ], + "outputs": { + } +} \ No newline at end of file diff --git a/appservice-fileserver-sqlserver-ha/nestedtemplates/deploy-s2d-cluster.json b/appservice-fileserver-sqlserver-ha/nestedtemplates/deploy-s2d-cluster.json new file mode 100644 index 0000000..2a4555b --- /dev/null +++ b/appservice-fileserver-sqlserver-ha/nestedtemplates/deploy-s2d-cluster.json @@ -0,0 +1,383 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "namePrefix": { + "type": "string", + "minLength": 3, + "maxLength": 8, + "metadata": { + "description": "Naming prefix for each new resource created. 3-char min, 8-char max, lowercase alphanumeric" + } + }, + "sofsName": { + "type": "string", + "metadata": { + "description": "Name of clustered Scale-Out File Server role" + } + }, + "shareName": { + "type": "string", + "metadata": { + "description": "Name of shared data folder on clustered Scale-Out File Server role" + } + }, + "domainName": { + "type": "string", + "metadata": { + "description": "DNS domain name for existing Active Directory domain" + } + }, + "adminUsername": { + "type": "string", + "metadata": { + "description": "Name of the Administrator of the existing Active Directory Domain" + } + }, + "adminPassword": { + "type": "securestring", + "minLength": 12, + "metadata": { + "description": "Password for the Administrator account of the existing Active Directory Domain" + } + }, + "fileShareOwnerUserName": { + "type": "string", + "metadata": { + "description": "Name of the fileshareowner account" + } + }, + "fileShareOwnerPassword": { + "type": "securestring", + "minLength": 12, + "metadata": { + "description": "Password of the fileshareowner account" + } + }, + "fileShareUserUserName": { + "type": "string", + "metadata": { + "description": "Name of the fileshareuser account" + } + }, + "fileShareUserPassword": { + "type": "securestring", + "minLength": 12, + "metadata": { + "description": "Password of the fileshareuser account" + } + }, + "storageAccountType": { + "type": "string", + "allowedValues": [ + "Standard_LRS", + "Standard_GRS", + "Standard_RAGRS", + "Premium_LRS" + ], + "metadata": { + "description": "Type of new Storage Accounts (Standard_LRS, Standard_GRS, Standard_RAGRS or Premium_LRS) to be created to store VM disks" + } + }, + "nicSubnetUri": { + "type": "string", + "metadata": { + "description": "Resource ID for existing vnet/subnet to which VM NICs should be attached" + } + }, + "vmSize": { + "type": "string", + "metadata": { + "description": "Size of the S2D VMs to be created" + } + }, + "vmCount": { + "type": "int", + "minValue": 2, + "maxValue": 3, + "metadata": { + "description": "Number of S2D VMs to be created in cluster (Min=2, Max=3)" + } + }, + "vmDiskSize": { + "type": "int", + "minValue": 128, + "maxValue": 1023, + "metadata": { + "description": "Size of each data disk in GB on each S2D VM (Min=128, Max=1023)" + } + }, + "vmDiskCount": { + "type": "int", + "minValue": 2, + "maxValue": 32, + "metadata": { + "description": "Number of data disks on each S2D VM (Min=2, Max=32). Ensure that the VM size you've selected will support this number of data disks." + } + }, + "imagePublisher": { + "type": "string", + "defaultValue": "MicrosoftWindowsServer" + }, + "imageOffer": { + "type": "string", + "defaultValue": "WindowsServer" + }, + "imageSKU": { + "type": "string", + "defaultValue": "2016-Datacenter-Server-Core" + }, + "imageVersion": { + "type": "string", + "defaultValue": "latest" + }, + "_artifactsLocation": { + "type": "string" + }, + "_artifactsLocationSasToken": { + "type": "string" + }, + "location": { + "type": "string", + "defaultValue": "[resourceGroup().location]", + "metadata": { + "description": "Location for all resources." + } + } + }, + "variables": { + "apiVersionStorage": "2016-01-01", + "storageNamePrefix": "[concat(parameters('namePrefix'),uniqueString(resourceGroup().id),'fsvm')]", + "witnessStorageName": "[concat(parameters('namePrefix'),uniqueString(resourceGroup().id),'fscw')]", + "witnessStorageType": "Standard_LRS", + "vmNamePrefix": "[concat(parameters('namePrefix'),'-s2d-')]", + "vmAvailabilitySetName": "[concat(variables('vmNamePrefix'),'as')]", + "clusterName": "[concat(variables('vmNamePrefix'),'c')]", + "vmLoopTemplateURL": "[concat(parameters('_artifactsLocation'),'/nestedtemplates/newVM.json',parameters('_artifactsLocationSasToken'))]", + "s2dPrepModulesURL": "[concat(parameters('_artifactsLocation'),'/dsc/prep-s2d.ps1.zip',parameters('_artifactsLocationSasToken'))]", + "s2dPrepFunction": "PrepS2D.ps1\\PrepS2D", + "s2dConfigModulesURL": "[concat(parameters('_artifactsLocation'),'/dsc/config-s2d.ps1.zip',parameters('_artifactsLocationSasToken'))]", + "s2dConfigFunction": "ConfigS2D.ps1\\ConfigS2D" + }, + "resources": [ + { + "type": "Microsoft.Compute/availabilitySets", + "name": "[variables('vmAvailabilitySetName')]", + "apiVersion": "2015-06-15", + "location": "[parameters('location')]", + "properties": {} + }, + { + "type": "Microsoft.Storage/storageAccounts", + "name": "[variables('witnessStorageName')]", + "apiVersion": "2016-01-01", + "location": "[parameters('location')]", + "sku": { + "name": "[variables('witnessStorageType')]" + }, + "kind": "Storage" + }, + { + "type": "Microsoft.Storage/storageAccounts", + "name": "[concat(variables('storageNamePrefix'),copyindex())]", + "apiVersion": "2016-01-01", + "copy": { + "name": "storageAccountLoop", + "count": "[parameters('vmCount')]" + }, + "location": "[parameters('location')]", + "sku": { + "name": "[parameters('storageAccountType')]" + }, + "kind": "Storage" + }, + { + "name": "[concat(variables('vmNamePrefix'), copyindex(), '-nic')]", + "type": "Microsoft.Network/networkInterfaces", + "location": "[parameters('location')]", + "apiVersion": "2015-06-15", + "copy": { + "name": "nicLoop", + "count": "[parameters('vmCount')]" + }, + "properties": { + "ipConfigurations": [ + { + "name": "ipconfig1", + "properties": { + "privateIPAllocationMethod": "Dynamic", + "subnet": { + "id": "[parameters('nicSubnetUri')]" + } + } + } + ] + } + }, + { + "type": "Microsoft.Resources/deployments", + "apiVersion": "2015-01-01", + "copy": { + "name": "virtualMachineLoop", + "count": "[parameters('vmCount')]" + }, + "name": "[concat(variables('vmNamePrefix'),copyindex(),'-newVM')]", + "dependsOn": [ + "storageAccountLoop", + "nicLoop", + "[resourceId('Microsoft.Compute/availabilitySets', variables('vmAvailabilitySetName'))]" + ], + "properties": { + "mode": "Incremental", + "templateLink": { + "uri": "[variables('vmLoopTemplateURL')]" + }, + "parameters": { + "vmName": { + "value": "[concat(variables('vmNamePrefix'), copyindex())]" + }, + "storageAccountUri": { + "value": "[reference(concat('Microsoft.Storage/storageAccounts/',variables('StorageNamePrefix'),copyIndex()),variables('apiVersionStorage')).primaryEndpoints.blob]" + }, + "vmAvailabilitySetName": { + "value": "[variables('vmAvailabilitySetName')]" + }, + "vmSize": { + "value": "[parameters('vmSize')]" + }, + "vmDiskCount": { + "value": "[parameters('vmDiskCount')]" + }, + "vmDiskSize": { + "value": "[parameters('vmDiskSize')]" + }, + "adminUsername": { + "value": "[parameters('adminUsername')]" + }, + "adminPassword": { + "value": "[parameters('adminPassword')]" + }, + "_artifactsLocation": { + "value": "[parameters('_artifactsLocation')]" + }, + "_artifactsLocationSasToken": { + "value": "[parameters('_artifactsLocationSasToken')]" + }, + "imagePublisher": { + "value": "[parameters('imagePublisher')]" + }, + "imageOffer": { + "value": "[parameters('imageOffer')]" + }, + "imageSKU": { + "value": "[parameters('imageSKU')]" + }, + "imageVersion": { + "value": "[parameters('imageVersion')]" + } + } + } + }, + { + "type": "Microsoft.Compute/virtualMachines/extensions", + "name": "[concat(variables('vmNamePrefix'),copyindex(1),'/s2dPrep')]", + "apiVersion": "2015-06-15", + "location": "[parameters('location')]", + "dependsOn": [ + "virtualMachineLoop" + ], + "copy": { + "name": "virtualMachineExtensionLoop", + "count": "[sub(parameters('vmCount'),1)]" + }, + "properties": { + "publisher": "Microsoft.Powershell", + "type": "DSC", + "typeHandlerVersion": "2.20", + "autoUpgradeMinorVersion": true, + "settings": { + "modulesUrl": "[variables('s2dPrepModulesURL')]", + "configurationFunction": "[variables('s2dPrepFunction')]", + "properties": { + "domainName": "[parameters('domainName')]", + "adminCreds": { + "userName": "[parameters('adminUsername')]", + "password": "PrivateSettingsRef:adminPassword" + } + } + }, + "protectedSettings": { + "items": { + "adminPassword": "[parameters('adminPassword')]" + } + } + } + }, + { + "type": "Microsoft.Compute/virtualMachines/extensions", + "name": "[concat(variables('vmNamePrefix'),'0/s2dConfig')]", + "apiVersion": "2015-06-15", + "location": "[parameters('location')]", + "dependsOn": [ + "virtualMachineLoop", + "virtualMachineExtensionLoop", + "[resourceId('Microsoft.Storage/storageAccounts', variables('witnessStorageName'))]" + ], + "properties": { + "publisher": "Microsoft.Powershell", + "type": "DSC", + "typeHandlerVersion": "2.20", + "autoUpgradeMinorVersion": true, + "settings": { + "modulesUrl": "[variables('s2dConfigModulesURL')]", + "configurationFunction": "[variables('s2dConfigFunction')]", + "properties": { + "domainName": "[parameters('domainName')]", + "clusterName": "[variables('clusterName')]", + "sofsName": "[parameters('sofsName')]", + "shareName": "[parameters('shareName')]", + "vmNamePrefix": "[variables('vmNamePrefix')]", + "vmCount": "[parameters('vmCount')]", + "vmDiskSize": "[parameters('vmDiskSize')]", + "witnessStorageName": "[variables('witnessStorageName')]", + "witnessStorageEndpoint": "[replace(split(reference(concat('Microsoft.Storage/storageAccounts/', variables('witnessStorageName'))).primaryEndpoints.blob, 'blob.')[1], '/', '')]", + "witnessStorageKey": { + "userName": "PLACEHOLDER-DO-NOT-USE", + "password": "PrivateSettingsRef:witnessStorageKey" + }, + "adminCreds": { + "userName": "[parameters('adminUsername')]", + "password": "PrivateSettingsRef:adminPassword" + }, + "fileShareOwnerCreds": { + "userName": "[parameters('fileShareOwnerUserName')]", + "password": "PrivateSettingsRef:fileShareOwnerAccountPassword" + }, + "fileShareUserCreds": { + "userName": "[parameters('fileShareUserUserName')]", + "password": "PrivateSettingsRef:fileShareUserPassword" + } + } + }, + "protectedSettings": { + "items": { + "adminPassword": "[parameters('adminPassword')]", + "witnessStorageKey": "[listKeys(resourceId('Microsoft.Storage/storageAccounts',variables('witnessStorageName')),variables('apiVersionStorage')).keys[0].value]", + "fileShareOwnerAccountPassword" :"[parameters('fileShareOwnerPassword')]", + "fileShareUserPassword" : "[parameters('fileShareUserPassword')]" + } + } + } + } + ], + "outputs": { + "sofsName": { + "type": "string", + "value": "[parameters('sofsName')]" + }, + "shareName": { + "type": "string", + "value": "[parameters('shareName')]" + } + } +} \ No newline at end of file diff --git a/appservice-fileserver-sqlserver-ha/nestedtemplates/deploy-sql-cluster.json b/appservice-fileserver-sqlserver-ha/nestedtemplates/deploy-sql-cluster.json new file mode 100644 index 0000000..ed6b2e2 --- /dev/null +++ b/appservice-fileserver-sqlserver-ha/nestedtemplates/deploy-sql-cluster.json @@ -0,0 +1,483 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "namePrefix": { + "type": "string", + "minLength": 3, + "maxLength": 8, + "metadata": { + "description": "Naming prefix for each new resource created. 3-char min, 8-char max, lowercase alphanumeric" + } + }, + "domainName": { + "type": "string", + "metadata": { + "description": "DNS domain name for existing Active Directory domain" + } + }, + "adminUsername": { + "type": "string", + "metadata": { + "description": "Name of the Administrator of the existing Active Directory Domain" + } + }, + "adminPassword": { + "type": "securestring", + "minLength": 12, + "metadata": { + "description": "Password for the Administrator account of the existing Active Directory Domain" + } + }, + "sqlServerServiceAccountUserName":{ + "type": "string" + }, + "sqlServerServiceAccountPassword":{ + "type": "securestring" + }, + "sqlLogin":{ + "type": "string" + }, + "sqlLoginPassword":{ + "type": "securestring" + }, + "SqlListenerIP":{ + "type": "string" + }, + "storageAccountType": { + "type": "string", + "allowedValues": [ + "Standard_LRS", + "Standard_GRS", + "Standard_RAGRS", + "Premium_LRS" + ], + "metadata": { + "description": "Type of new Storage Accounts (Standard_LRS, Standard_GRS, Standard_RAGRS or Premium_LRS) to be created to store VM disks" + } + }, + "nicSubnetUri": { + "type": "string", + "metadata": { + "description": "Resource ID for existing vnet/subnet to which VM NICs should be attached" + } + }, + "vmSize": { + "type": "string", + "metadata": { + "description": "Size of the S2D VMs to be created" + } + }, + "vmCount": { + "type": "int", + "minValue": 2, + "maxValue": 3, + "metadata": { + "description": "Number of S2D VMs to be created in cluster (Min=2, Max=3)" + } + }, + "vmDiskSize": { + "type": "int", + "minValue": 128, + "maxValue": 1023, + "metadata": { + "description": "Size of each data disk in GB on each S2D VM (Min=128, Max=1023)" + } + }, + "vmDiskCount": { + "type": "int", + "minValue": 1, + "maxValue": 32, + "metadata": { + "description": "Number of data disks on each S2D VM (Min=2, Max=32). Ensure that the VM size you've selected will support this number of data disks." + } + }, + "imagePublisher": { + "type": "string", + "defaultValue": "MicrosoftSQLServer" + }, + "imageOffer": { + "type": "string", + "defaultValue": "SQL2016SP2-WS2016" + }, + "imageSKU": { + "type": "string", + "defaultValue": "Enterprise" + }, + "imageVersion": { + "type": "string", + "defaultValue": "latest" + }, + "_artifactsLocation": { + "type": "string" + }, + "_artifactsLocationSasToken": { + "type": "string" + }, + "location": { + "type": "string", + "defaultValue": "[resourceGroup().location]", + "metadata": { + "description": "Location for all resources." + } + } + }, + "variables": { + "apiVersionStorage": "2016-01-01", + "storageNamePrefix": "[concat(parameters('namePrefix'),uniqueString(resourceGroup().id),'sqlvm')]", + "witnessStorageName": "[concat(parameters('namePrefix'),uniqueString(resourceGroup().id),'sqlcw')]", + "witnessStorageType": "Standard_LRS", + "vmNamePrefix": "[concat(parameters('namePrefix'),'-sql-')]", + "vmAvailabilitySetName": "[concat(variables('vmNamePrefix'),'as')]", + "vmLoopTemplateURL": "[concat(parameters('_artifactsLocation'),'/nestedtemplates/newVM.json',parameters('_artifactsLocationSasToken'))]", + "sqllbName":"[concat(parameters('namePrefix'),'-sql-lb')]", + "sqlLBFE":"[concat(parameters('namePrefix'),'-sql-lbfe')]", + "sqlLBBE":"[concat(parameters('namePrefix'),'-sql-lbbe')]", + "SQLAOProbe":"[concat(parameters('namePrefix'),'-sql-probe')]", + "SqlLBID":"[resourceId('Microsoft.Network/loadBalancers',variables('sqllbName'))]", + "sqlLBBEID":"[concat(variables('SqlLBID'),'/backendAddressPools/',variables('sqlLBBE'))]", + "sqllbFEConfigID":"[concat(variables('SqlLBID'),'/frontendIPConfigurations/',variables('sqlLBFE'))]", + "sqllbProbeID":"[concat(variables('SqlLBID'),'/probes/',variables('SQLAOProbe'))]", + "createClusterModulesURL":"[concat(parameters('_artifactsLocation'),'/dsc/config-sql.ps1.zip',parameters('_artifactsLocationSasToken'))]", + "createClusterConfigurationFunction":"config-sql.ps1\\config-sql", + "sqlAOPrepareModulesURL":"[concat(parameters('_artifactsLocation'),'/dsc/prep-sql.ps1.zip',parameters('_artifactsLocationSasToken'))]", + "sqlAOPrepareConfigurationFunction":"prep-sql.ps1\\prep-sql", + "sqlAOEPName":"aodns-hadr", + "clusterName":"aodns-fc", + "sqlAOAGName":"alwayson-ag", + "sqlAOListenerName":"aon-listener-lensqlhademo", + "sqlAOListenerPort":1433, + "sqlLBIPAddress":"[parameters('SqlListenerIP')]", + "adPDCVMName":"[concat(parameters('namePrefix'),'-ad-0')]" + }, + "resources": [ + { + "type": "Microsoft.Compute/availabilitySets", + "name": "[variables('vmAvailabilitySetName')]", + "apiVersion": "2015-06-15", + "location": "[parameters('location')]", + "properties": {} + }, + { + "type": "Microsoft.Storage/storageAccounts", + "name": "[variables('witnessStorageName')]", + "apiVersion": "2016-01-01", + "location": "[parameters('location')]", + "sku": { + "name": "[variables('witnessStorageType')]" + }, + "kind": "Storage" + }, + { + "type": "Microsoft.Storage/storageAccounts", + "name": "[concat(variables('storageNamePrefix'),copyindex())]", + "apiVersion": "2016-01-01", + "copy": { + "name": "storageAccountLoop", + "count": "[parameters('vmCount')]" + }, + "location": "[parameters('location')]", + "sku": { + "name": "[parameters('storageAccountType')]" + }, + "kind": "Storage" + }, + { + "apiVersion": "2015-06-15", + "name": "[variables('sqllbName')]", + "type": "Microsoft.Network/loadBalancers", + "location": "[parameters('location')]", + "properties": { + "frontendIPConfigurations": [ + { + "name": "[variables('sqlLBFE')]", + "properties": { + "privateIPAllocationMethod": "Static", + "privateIPAddress": "[variables('sqlLBIPAddress')]", + "subnet": { + "id": "[parameters('nicSubnetUri')]" + } + } + } + ], + "backendAddressPools": [ + { + "name": "[variables('sqlLBBE')]" + } + ], + "loadBalancingRules": [ + { + "name": "SQLAlwaysOnEndPointListener", + "properties": { + "backendAddressPool": { + "id": "[variables('sqlLBBEID')]" + }, + "frontendIPConfiguration": { + "id": "[variables('sqllbFEConfigID')]" + }, + "probe": { + "id": "[variables('sqllbProbeID')]" + }, + "protocol": "Tcp", + "frontendPort": "[variables('sqlAOListenerPort')]", + "backendPort": "[variables('sqlAOListenerPort')]", + "enableFloatingIP": true + } + } + ], + "probes": [ + { + "name": "[variables('SQLAOProbe')]", + "properties": { + "protocol": "Tcp", + "port": 59999, + "intervalInSeconds": 5, + "numberOfProbes": 2 + } + } + ] + } + }, + { + "name": "[concat(variables('vmNamePrefix'), copyindex(), '-nic')]", + "type": "Microsoft.Network/networkInterfaces", + "location": "[parameters('location')]", + "apiVersion": "2015-06-15", + "dependsOn": [ + "[variables('sqllbName')]" + ], + "copy": { + "name": "nicLoop", + "count": "[parameters('vmCount')]" + }, + "properties": { + "ipConfigurations": [ + { + "name": "ipconfig1", + "properties": { + "privateIPAllocationMethod": "Dynamic", + "subnet": { + "id": "[parameters('nicSubnetUri')]" + }, + "loadBalancerBackendAddressPools": [ + { + "id": "[variables('sqlLBBEID')]" + } + ] + } + } + ] + } + }, + { + "type": "Microsoft.Resources/deployments", + "apiVersion": "2015-01-01", + "copy": { + "name": "virtualMachineLoop", + "count": "[parameters('vmCount')]" + }, + "name": "[concat(variables('vmNamePrefix'),copyindex(),'-newVM')]", + "dependsOn": [ + "storageAccountLoop", + "nicLoop", + "[resourceId('Microsoft.Compute/availabilitySets', variables('vmAvailabilitySetName'))]" + ], + "properties": { + "mode": "Incremental", + "templateLink": { + "uri": "[variables('vmLoopTemplateURL')]" + }, + "parameters": { + "vmName": { + "value": "[concat(variables('vmNamePrefix'), copyindex())]" + }, + "storageAccountUri": { + "value": "[reference(concat('Microsoft.Storage/storageAccounts/',variables('StorageNamePrefix'),copyIndex()),variables('apiVersionStorage')).primaryEndpoints.blob]" + }, + "vmAvailabilitySetName": { + "value": "[variables('vmAvailabilitySetName')]" + }, + "vmSize": { + "value": "[parameters('vmSize')]" + }, + "vmDiskCount": { + "value": "[parameters('vmDiskCount')]" + }, + "vmDiskSize": { + "value": "[parameters('vmDiskSize')]" + }, + "adminUsername": { + "value": "[parameters('adminUsername')]" + }, + "adminPassword": { + "value": "[parameters('adminPassword')]" + }, + "_artifactsLocation": { + "value": "[parameters('_artifactsLocation')]" + }, + "_artifactsLocationSasToken": { + "value": "[parameters('_artifactsLocationSasToken')]" + }, + "imagePublisher": { + "value": "[parameters('imagePublisher')]" + }, + "imageOffer": { + "value": "[parameters('imageOffer')]" + }, + "imageSKU": { + "value": "[parameters('imageSKU')]" + }, + "imageVersion": { + "value": "[parameters('imageVersion')]" + } + } + } + }, + { + "apiVersion": "2015-06-15", + "type": "Microsoft.Compute/virtualMachines/extensions", + "name": "[concat(variables('vmNamePrefix'),copyindex(),'/SqlVmIaasExtension')]", + "location": "[parameters('location')]", + "dependsOn": [ + "virtualMachineLoop" + ], + "copy": { + "name": "virtualMachineExtensionLoop", + "count": "[parameters('vmCount')]" + }, + "properties": { + "type": "SqlIaaSAgent", + "publisher": "Microsoft.SqlServer.Management", + "typeHandlerVersion": "1.2", + "autoUpgradeMinorVersion": "true", + "settings": { + "AutoTelemetrySettings": { + "Region": "[parameters('location')]" + }, + "AutoPatchingSettings": { + "PatchCategory": "WindowsMandatoryUpdates", + "Enable": true, + "DayOfWeek": "Sunday", + "MaintenanceWindowStartingHour": 2, + "MaintenanceWindowDuration": "60" + }, + "AutoBackupSettings": { + "Enable": false, + "RetentionPeriod": "30", + "EnableEncryption": false + } + }, + "protectedSettings": { + "SQLAuthUpdateUserName": "[parameters('sqlLogin')]", + "SQLAuthUpdatePassword": "[parameters('sqlLoginPassword')]" + } + } + }, + { + "type":"Microsoft.Compute/virtualMachines/extensions", + "name":"[concat(variables('vmNamePrefix'),'0/sqlAOPrepare')]", + "apiVersion":"2015-06-15", + "location":"[parameters('location')]", + "dependsOn":[ + "virtualMachineExtensionLoop" + ], + "properties":{ + "publisher":"Microsoft.Powershell", + "type":"DSC", + "typeHandlerVersion":"2.19", + "autoUpgradeMinorVersion":true, + "settings":{ + "modulesURL":"[variables('sqlAOPrepareModulesURL')]", + "configurationFunction":"[variables('sqlAOPrepareConfigurationFunction')]", + "properties":{ + "domainName":"[parameters('domainName')]", + "sqlAlwaysOnEndpointName":"[variables('sqlAOEPName')]", + "adminCreds":{ + "userName":"[parameters('adminUserName')]", + "password":"privateSettingsRef:AdminPassword" + }, + "sqlServiceCreds":{ + "userName":"[parameters('sqlServerServiceAccountUserName')]", + "password":"privateSettingsRef:SqlServerServiceAccountPassword" + }, + "NumberOfDisks":"[parameters('vmDiskCount')]", + "WorkloadType":"GENERAL" + } + }, + "protectedSettings":{ + "items":{ + "adminPassword":"[parameters('adminPassword')]", + "sqlServerServiceAccountPassword":"[parameters('sqlServerServiceAccountPassword')]" + } + } + } + }, + { + "type":"Microsoft.Compute/virtualMachines/extensions", + "name":"[concat(variables('vmNamePrefix'),'1/configuringAlwaysOn')]", + "apiVersion":"2015-06-15", + "location":"[parameters('location')]", + "dependsOn": [ + "[resourceId('Microsoft.Compute/virtualMachines/extensions', concat(variables('vmNamePrefix'),'0'), 'sqlAOPrepare')]" + ], + "properties":{ + "publisher":"Microsoft.Powershell", + "type":"DSC", + "typeHandlerVersion":"2.19", + "autoUpgradeMinorVersion":true, + "settings":{ + "modulesURL":"[variables('createClusterModulesURL')]", + "configurationFunction":"[variables('createClusterConfigurationFunction')]", + "properties":{ + "domainName":"[parameters('domainName')]", + "clusterName":"[variables('clusterName')]", + "witnessStorageName": "[variables('witnessStorageName')]", + "witnessStorageEndpoint": "[replace(split(reference(concat('Microsoft.Storage/storageAccounts/', variables('witnessStorageName'))).primaryEndpoints.blob, 'blob.')[1], '/', '')]", + "witnessStorageKey": { + "userName": "PLACEHOLDER-DO-NOT-USE", + "password": "PrivateSettingsRef:witnessStorageKey" + }, + "nodes":[ + "[concat(variables('vmNamePrefix'),'0')]", + "[concat(variables('vmNamePrefix'),'1')]" + ], + "sqlAlwaysOnEndpointName":"[variables('sqlAOEPName')]", + "sqlAlwaysOnAvailabilityGroupName":"[variables('sqlAOAGName')]", + "sqlAlwaysOnAvailabilityGroupListenerName":"[variables('sqlAOListenerName')]", + "SqlAlwaysOnAvailabilityGroupListenerPort":"[variables('sqlAOListenerPort')]", + "databaseNames":"AutoHa-sample", + "lbName":"[variables('sqlLBName')]", + "lbAddress":"[variables('sqlLBIPAddress')]", + "primaryReplica":"[concat(variables('vmNamePrefix'),'1')]", + "secondaryReplica":"[concat(variables('vmNamePrefix'),'0')]", + "dnsServerName":"[variables('adPDCVMName')]", + "adminCreds":{ + "userName":"[parameters('adminUserName')]", + "password":"privateSettingsRef:adminPassword" + }, + "sqlServiceCreds":{ + "userName":"[parameters('sqlServerServiceAccountUserName')]", + "password":"privateSettingsRef:sqlServerServiceAccountPassword" + }, + "SQLAuthCreds":{ + "userName":"sqlsa", + "password":"privateSettingsRef:sqlAuthPassword" + }, + "NumberOfDisks":"[parameters('vmDiskCount')]", + "WorkloadType":"GENERAL" + } + }, + "protectedSettings":{ + "items":{ + "adminPassword":"[parameters('adminPassword')]", + "sqlServerServiceAccountPassword":"[parameters('sqlServerServiceAccountPassword')]", + "sqlAuthPassword":"[parameters('sqlServerServiceAccountPassword')]", + "witnessStorageKey": "[listKeys(resourceId('Microsoft.Storage/storageAccounts',variables('witnessStorageName')),variables('apiVersionStorage')).keys[0].value]" + + } + } + } + } + ], + "outputs": {} +} \ No newline at end of file diff --git a/appservice-fileserver-sqlserver-ha/nestedtemplates/newVM.json b/appservice-fileserver-sqlserver-ha/nestedtemplates/newVM.json new file mode 100644 index 0000000..49f13fd --- /dev/null +++ b/appservice-fileserver-sqlserver-ha/nestedtemplates/newVM.json @@ -0,0 +1,125 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "vmName": { + "type": "string" + }, + "storageAccountUri": { + "type": "string" + }, + "vmAvailabilitySetName": { + "type": "string" + }, + "vmSize": { + "type": "string" + }, + "vmDiskCount": { + "type": "int" + }, + "vmDiskSize": { + "type": "int" + }, + "adminUsername": { + "type": "string" + }, + "adminPassword": { + "type": "securestring" + }, + "imagePublisher": { + "type": "string" + }, + "imageOffer": { + "type": "string" + }, + "imageSKU": { + "type": "string" + }, + "imageVersion": { + "type": "string" + }, + "_artifactsLocation": { + "type": "string" + }, + "_artifactsLocationSasToken": { + "type": "string" + }, + "location": { + "type": "string", + "defaultValue": "[resourceGroup().location]", + "metadata": { + "description": "Location for all resources." + } + } + }, + "variables": { + }, + "resources": [ + { + "type": "Microsoft.Compute/virtualMachines", + "apiVersion": "2015-06-15", + "location": "[parameters('location')]", + "name": "[parameters('vmName')]", + "dependsOn": [ + ], + "properties": { + "hardwareProfile": { + "vmSize": "[parameters('vmSize')]" + }, + "availabilitySet": { + "id": "[resourceId('Microsoft.Compute/availabilitySets/', parameters('vmAvailabilitySetName'))]" + }, + "osProfile": { + "computerName": "[parameters('vmName')]", + "adminUsername": "[parameters('adminUsername')]", + "adminPassword": "[parameters('adminPassword')]" + }, + "storageProfile": { + "imageReference": { + "publisher": "[parameters('imagePublisher')]", + "offer": "[parameters('imageOffer')]", + "sku": "[parameters('imageSku')]", + "version": "[parameters('imageVersion')]" + }, + "osDisk": { + "name": "osdisk", + "vhd": { + "uri": "[concat(parameters('storageAccountUri'), 'vhds/',parameters('vmName'),'-osdisk.vhd')]" + }, + "caching": "ReadWrite", + "createOption": "FromImage" + }, + "copy": [ + { + "name": "dataDisks", + "count": "[parameters('vmDiskCount')]", + "input": { + "name":"[concat('vmnam', '-data-disk',copyIndex('dataDisks'))]", + "lun": "[copyIndex('dataDisks')]", + "createOption": "Empty", + "caching":"None", + "diskSizeGB": "[parameters('vmDiskSize')]", + "vhd":{ + "uri":"[concat(parameters('storageAccountUri'),'vhds/',parameters('vmName'), '-data-disk',copyIndex('dataDisks'),'.vhd')]" + } + } + } + ] + }, + "networkProfile": { + "networkInterfaces": [ + { + "id": "[resourceId('Microsoft.Network/networkInterfaces',concat(parameters('vmName'),'-nic'))]" + } + ] + } + } + } + ], + "outputs": { + "vmName": { + "type": "string", + "value": "[parameters('vmName')]" + } + } +} \ No newline at end of file diff --git a/sample-hybrid-application/Northwind.Insurance.Website/obj/Debug/net452/win7-x86/Northwind.Insurance.Website.AssemblyInfo.cs b/sample-hybrid-application/Northwind.Insurance.Website/obj/Debug/net452/win7-x86/Northwind.Insurance.Website.AssemblyInfo.cs new file mode 100644 index 0000000..9064858 --- /dev/null +++ b/sample-hybrid-application/Northwind.Insurance.Website/obj/Debug/net452/win7-x86/Northwind.Insurance.Website.AssemblyInfo.cs @@ -0,0 +1,23 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +using System; +using System.Reflection; + +[assembly: System.Reflection.AssemblyCompanyAttribute("Northwind.Insurance.Website")] +[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")] +[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] +[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")] +[assembly: System.Reflection.AssemblyProductAttribute("Northwind.Insurance.Website")] +[assembly: System.Reflection.AssemblyTitleAttribute("Northwind.Insurance.Website")] +[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] + +// Generated by the MSBuild WriteCodeFragment class. + diff --git a/sample-hybrid-application/Northwind.Insurance.Website/obj/Debug/net452/win7-x86/Northwind.Insurance.Website.AssemblyInfoInputs.cache b/sample-hybrid-application/Northwind.Insurance.Website/obj/Debug/net452/win7-x86/Northwind.Insurance.Website.AssemblyInfoInputs.cache new file mode 100644 index 0000000..a6fcbd9 --- /dev/null +++ b/sample-hybrid-application/Northwind.Insurance.Website/obj/Debug/net452/win7-x86/Northwind.Insurance.Website.AssemblyInfoInputs.cache @@ -0,0 +1 @@ +9987a72952add59280bb2c8070ce5f722b22c9a0 diff --git a/sample-hybrid-application/Northwind.Insurance.Website/obj/Debug/net452/win7-x86/Northwind.Insurance.Website.csproj.CoreCompileInputs.cache b/sample-hybrid-application/Northwind.Insurance.Website/obj/Debug/net452/win7-x86/Northwind.Insurance.Website.csproj.CoreCompileInputs.cache new file mode 100644 index 0000000..0578c69 --- /dev/null +++ b/sample-hybrid-application/Northwind.Insurance.Website/obj/Debug/net452/win7-x86/Northwind.Insurance.Website.csproj.CoreCompileInputs.cache @@ -0,0 +1 @@ +ee14b4be3fdd481104e41892ca32444fdc21211f diff --git a/sample-hybrid-application/Northwind.Insurance.Website/obj/Debug/net452/win7-x86/Northwind.Insurance.Website.csprojResolveAssemblyReference.cache b/sample-hybrid-application/Northwind.Insurance.Website/obj/Debug/net452/win7-x86/Northwind.Insurance.Website.csprojResolveAssemblyReference.cache new file mode 100644 index 0000000..305b466 Binary files /dev/null and b/sample-hybrid-application/Northwind.Insurance.Website/obj/Debug/net452/win7-x86/Northwind.Insurance.Website.csprojResolveAssemblyReference.cache differ diff --git a/sample-hybrid-application/Northwind.Insurance.Website/obj/Debug/net452/win7-x86/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs b/sample-hybrid-application/Northwind.Insurance.Website/obj/Debug/net452/win7-x86/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs new file mode 100644 index 0000000..e69de29 diff --git a/sample-hybrid-application/Northwind.Insurance.Website/obj/Debug/net452/win7-x86/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs b/sample-hybrid-application/Northwind.Insurance.Website/obj/Debug/net452/win7-x86/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs new file mode 100644 index 0000000..e69de29 diff --git a/sample-hybrid-application/Northwind.Insurance.Website/obj/Debug/net452/win7-x86/TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs b/sample-hybrid-application/Northwind.Insurance.Website/obj/Debug/net452/win7-x86/TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs new file mode 100644 index 0000000..e69de29