Skip to content

Commit

Permalink
inital build
Browse files Browse the repository at this point in the history
  • Loading branch information
nephinj committed Sep 17, 2019
0 parents commit d02da24
Show file tree
Hide file tree
Showing 8 changed files with 717 additions and 0 deletions.
Binary file added DSC/CreateFailoverCluster.ps1.zip
Binary file not shown.
Binary file added DSC/CreateFileShareWitness.ps1.zip
Binary file not shown.
Binary file added DSC/PrepareAlwaysOnSqlServer.ps1.zip
Binary file not shown.
148 changes: 148 additions & 0 deletions Templates/SQLVirtualMachine.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"sqlVMName": {
"type": "string"
},
"location": {
"type": "string"
},
"sqlAutopatchingDayOfWeek": {
"type": "string"
},
"sqlAutopathingEnabled": {
"type": "string"
},
"sqlAutopatchingStartHour": {
"type": "string"
},
"sqlAutopatchingWindowDuration": {
"type": "string"
},
"sqlAutoBackupEnabled":{
"type": "string"
},
"sqlAutoBackupRetentionPeriod":{
"type": "string"
},
"sqlAutoBackupEnableEncryption": {
"type": "string"
},
"sqlAutoBackupSystemDbs": {
"type": "string"
},
"sqlAutoBackupScheduleType":{
"type": "string"
},
"sqlAutoBackupFrequency":{
"type": "string"
},
"sqlAutoBackupFullBackupStartTime":{
"type": "string"
},
"sqlAutoBackupFullBackupWindowHours":{
"type": "string"
},
"sqlAutoBackuplogBackupFrequency":{
"type": "string"
},
"sqlAutoBackupPassword":{
"type": "string"
},
"numberOfDisks": {
"type": "string"
},
"workloadType": {
"type": "string"
},
"rServicesEnabled":{
"type": "string",
"defaultValue": "false"
},
"sqlConnectivityType":{
"type": "string",
"defaultValue": "Private"
},
"sqlPortNumber":{
"type": "string",
"defaultValue": "1433"
},
"sqlStorageDisksConfigurationType":{
"type": "string",
"defaultValue": "NEW"
},
"sqlStorageStartingDeviceId":{
"type": "string",
"defaultValue": "2"
},
"sqlServerLicenseType":{
"type":"string",
"defaultValue": "PAYG"
},
"sqlStorageAccountName":{
"type": "string"
}
},
"variables": {},
"resources": [
{
"name": "[concat(parameters('sqlVMName'),copyIndex(1))]",
"type": "Microsoft.SqlVirtualMachine/SqlVirtualMachines",
"apiVersion": "2017-03-01-preview",
"copy": {
"name": "vmcopy",
"count": 2
},
"location": "[parameters('location')]",
"properties": {
"virtualMachineResourceId": "[resourceId('Microsoft.Compute/virtualMachines', concat(parameters('sqlVMName'),copyIndex(1)))]",
"SqlServerLicenseType": "[parameters('sqlServerLicenseType')]",
"AutoPatchingSettings": {
"Enable": "[parameters('sqlAutopathingEnabled')]",
"DayOfWeek": "[parameters('sqlAutopatchingDayOfWeek')]",
"MaintenanceWindowStartingHour": "[parameters('sqlAutopatchingStartHour')]",
"MaintenanceWindowDuration":"[parameters('sqlAutopatchingWindowDuration')]"
},
"AutoBackupSettings": {
"Enable": "[parameters('sqlAutoBackupEnabled')]",
"RetentionPeriod": "[parameters('sqlAutoBackupRetentionPeriod')]",
"EnableEncryption": "[parameters('sqlAutoBackupEnableEncryption')]",
"BackupSystemDbs": "[parameters('sqlAutoBackupSystemDbs')]",
"BackupScheduleType": "[parameters('sqlAutoBackupScheduleType')]",
"FullBackupFrequency": "[parameters('sqlAutoBackupFrequency')]",
"FullBackupStartTime": "[parameters('sqlAutoBackupFullBackupStartTime')]",
"FullBackupWindowHours": "[parameters('sqlAutoBackupFullBackupWindowHours')]",
"LogBackupFrequency": "[parameters('sqlAutoBackuplogBackupFrequency')]",
"Password": "[parameters('sqlAutoBackupPassword')]",
"StorageAccountUrl": "[reference(resourceId('Microsoft.Storage/storageAccounts', parameters('sqlStorageAccountName')), '2018-07-01').primaryEndpoints['blob']]",
"StorageAccessKey": "[first(listKeys(resourceId('Microsoft.Storage/storageAccounts', parameters('sqlStorageAccountName')), '2018-07-01').keys).value]"
},
"KeyVaultCredentialSettings":
{
"Enable": false,
"CredentialName": ""
},
"ServerConfigurationsManagementSettings": {
"SQLConnectivityUpdateSettings": {
"ConnectivityType": "[parameters('sqlConnectivityType')]",
"Port": "[parameters('sqlPortNumber')]",
"SQLAuthUpdateUserName": "",
"SQLAuthUpdatePassword": ""
},
"SQLWorkloadTypeUpdateSettings": {
"SQLWorkloadType": "[parameters('workloadType')]"
},
"SQLStorageUpdateSettings": {
"DiskCount": "[parameters('numberOfDisks')]",
"DiskConfigurationType": "[parameters('sqlStorageDisksConfigurationType')]",
"StartingDeviceID": "[parameters('sqlStorageStartingDeviceId')]"
},
"AdditionalFeaturesServerConfigurations": {
"IsRServicesEnabled": "[parameters('rServicesEnabled')]"
}
}
}
}
]
}
35 changes: 35 additions & 0 deletions data.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
data "azurerm_key_vault" "keyvaultsecrets" {
name = "${var.keyVaultConfig.existingVaultName}"
resource_group_name = "${var.keyVaultConfig.existingRGName}"
}

data "azurerm_key_vault_secret" "localAdminPasswordSecret" {
name = "${var.keyVaultConfig.localAdminPasswordSecret}"
key_vault_id = "${data.azurerm_key_vault.keyvaultsecrets.id}"
}

data "azurerm_key_vault_secret" "domainAdminPasswordSecret" {
name = "${var.keyVaultConfig.domainAdminPasswordSecret}"
key_vault_id = "${data.azurerm_key_vault.keyvaultsecrets.id}"
}

data "azurerm_key_vault_secret" "sqlAdminPasswordSecret" {
name = "${var.sqlServerConfig.sqlServerServiceAccountPasswordSecret}"
key_vault_id = "${data.azurerm_key_vault.keyvaultsecrets.id}"
}

data "azurerm_subnet" "subnet" {
name = "${var.vnetConfig.dbSubnetName}"
virtual_network_name = "${var.vnetConfig.existingVnetName}"
resource_group_name = "${var.vnetConfig.existingVnetRG}"
}

data "azurerm_virtual_network" "vnet" {
name = "${var.vnetConfig.existingVnetName}"
resource_group_name = "${var.vnetConfig.existingVnetRG}"
}

# =============== TEMPLATES =============== #
data "template_file" "sqlvm" {
template = file("./Templates/SQLVirtualMachine.json")
}
Loading

0 comments on commit d02da24

Please sign in to comment.