diff --git a/acceptance-tests/spring-music-validator/sqlserver/index.js b/acceptance-tests/spring-music-validator/sqlserver/index.js index c67ea7b6f..5e88cd34f 100644 --- a/acceptance-tests/spring-music-validator/sqlserver/index.js +++ b/acceptance-tests/spring-music-validator/sqlserver/index.js @@ -20,6 +20,12 @@ function sqlserverQuerySpringMusic(pool) { module.exports = async function (credentials, runServer) { let content = "" + + if (credentials.hostname != credentials.sqlServerFullyQualifiedDomainName || + credentials.name != credentials.sqldbName) { + console.error("hostname does not match sqlServerFullyQualifiedDomainName or name does not match sqldbName ") + throw new Error("badly formed credentials") + } return connectSqlserver({ server: credentials.hostname, user: credentials.username, diff --git a/azure-brokerpak/azure-mssql-db.yml b/azure-brokerpak/azure-mssql-db.yml index f12226aa1..7fdf0d957 100644 --- a/azure-brokerpak/azure-mssql-db.yml +++ b/azure-brokerpak/azure-mssql-db.yml @@ -28,6 +28,7 @@ plans: description: 'SQL Server latest version. Instance properties: General Purpose - Serverless ; 0.5 - 2 cores ; Max Memory: 6gb ; 50 GB storage ; auto-pause enabled after 1 hour of inactivity' display_name: "Small" properties: + subsume: false - name: medium id: 3ee14bce-33e8-4d02-9850-023a66bfe120 description: 'SQL Server latest version. Instance properties: General Purpose - Provisioned ; Provisioned Capacity ; 8 cores ; 200 GB storage' @@ -35,6 +36,7 @@ plans: properties: cores: 8 max_storage_gb: 200 + subsume: false - name: large id: 8f1c9c7b-80b2-49c3-9365-a3a059df9907 description: 'SQL Server latest version. Instance properties: Business Critical ; Provisioned Capacity ; 32 cores ; 500 GB storage' @@ -42,6 +44,7 @@ plans: properties: cores: 32 max_storage_gb: 500 + subsume: false - name: extra-large id: 09096759-58a8-41d0-96bf-39b02a0e4104 description: 'SQL Server latest version. Instance properties: Business Critical ; Provisioned Capacity ; 80 cores ; 1 TB storage' @@ -49,6 +52,7 @@ plans: properties: cores: 80 max_storage_gb: 1024 + subsume: false - name: subsume id: 7781fa41-f486-447a-942c-ded8cccb8299 description: 'Subsume control of an existing SQL Database' @@ -77,7 +81,6 @@ provision: plan_inputs: - field_name: subsume type: boolean - default: false details: Subsume existing DB user_inputs: - field_name: cores diff --git a/azure-brokerpak/terraform/azure-mongodb/azure-mongodb.tf b/azure-brokerpak/terraform/azure-mongodb/azure-mongodb.tf index 44cd0ff76..84cea9610 100644 --- a/azure-brokerpak/terraform/azure-mongodb/azure-mongodb.tf +++ b/azure-brokerpak/terraform/azure-mongodb/azure-mongodb.tf @@ -83,6 +83,10 @@ resource "azurerm_cosmosdb_account" "mongo-account" { enable_multiple_write_locations = var.enable_multiple_write_locations ip_range_filter = var.ip_range_filter tags = var.labels + + capabilities { + name = "EnableAggregationPipeline" + } } resource "azurerm_cosmosdb_mongo_database" "mongo-db" { diff --git a/azure-brokerpak/terraform/azure-mssql-db-failover/mssql-db-fog-outputs.tf b/azure-brokerpak/terraform/azure-mssql-db-failover/mssql-db-fog-outputs.tf index 7e17e8c37..3497f8268 100644 --- a/azure-brokerpak/terraform/azure-mssql-db-failover/mssql-db-fog-outputs.tf +++ b/azure-brokerpak/terraform/azure-mssql-db-failover/mssql-db-fog-outputs.tf @@ -1,14 +1,16 @@ locals { - serverFQDN = var.existing ? format("%s.database.windows.net", var.instance_name) : format("%s.database.windows.net", azurerm_sql_failover_group.failover_group[0].name) + serverName = var.existing ? var.instance_name : azurerm_sql_failover_group.failover_group[0].name + serverFQDN = format("%s.database.windows.net", local.serverName) + dbName = var.existing ? var.db_name : azurerm_mssql_database.primary_db[0].name } -output sqldbName {value = var.db_name} -output sqlServerName {value = var.instance_name} +output sqldbName {value = local.dbName} +output sqlServerName {value = local.serverName} output sqlServerFullyQualifiedDomainName {value = local.serverFQDN} output hostname {value = local.serverFQDN} output port {value = 1433} -output name {value = var.existing ? var.db_name : azurerm_mssql_database.primary_db[0].name} +output name {value = local.dbName} output username {value = var.server_credential_pairs[var.server_pair].admin_username} output password {value = var.server_credential_pairs[var.server_pair].admin_password} output status { diff --git a/scripts/azure-create-mssql-db.sh b/scripts/azure-create-mssql-db.sh new file mode 100755 index 000000000..67d3bad92 --- /dev/null +++ b/scripts/azure-create-mssql-db.sh @@ -0,0 +1,41 @@ +#!/usr/bin/env bash + +set -o pipefail +set -o nounset +#set -o errexit + +if [ $# -lt 3 ]; then + echo "Usage: ${0} " + exit 1 +fi + +RG=${1}; shift +SERVER_NAME=${1}; shift +LOCATION=${1}; shift + +USERNAME=$(cat /dev/urandom | env LC_CTYPE=C tr -dc 'a-zA-Z' | fold -w 16 | head -n 1) +PASSWORD=$(cat /dev/urandom | env LC_CTYPE=C tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1) + +if [ $# -gt 0 ]; then + USERNAME=$1; shift +fi + +if [ $# -gt 0 ]; then + PASSWORD=$1; shift +fi + +DB_NAME=csb-db + +az sql server create --resource-group ${RG} --name ${SERVER_NAME} --location ${LOCATION} --admin-user ${USERNAME} --admin-password ${PASSWORD} + +az sql server firewall-rule create --resource-group ${RG} --server ${SERVER_NAME} --name ${SERVER_NAME}-ip --start-ip-address 0.0.0.0 --end-ip-address 0.0.0.0 + +az sql db create --name ${DB_NAME} --resource-group ${RG} --server ${SERVER_NAME} -e GeneralPurpose -f Gen5 -c 2 --compute-model Serverless --auto-pause-delay 120 + +DETAILS=$(az sql server show --resource-group ${RG} --name ${SERVER_NAME}) + +echo Server Details +echo FQDN: $(echo ${DETAILS} | jq -r .fullyQualifiedDomainName) +echo Admin Username: ${USERNAME}@${SERVER_NAME} +echo Admin Password: ${PASSWORD} +echo Database Name: ${DB_NAME}